Classes | Functions | Variables
lama_interfaces::cleartext_interface_factory Namespace Reference

Classes

class  DBInterface
class  RosSqlTable
class  SqlMsg
class  TypeInspector

Functions

def addRosFields
def cleartext_interface_factory
def getFromTable
def getListItem
def getMsgArgFromTable
def getMsgArgType
def getMsgArgValue
def getMsgSubtypes
def insertInTable
def parentSeqs
def rosFieldToSql
def setListItem
def setMsgArgFromTable
def setMsgArgValue
def setRosFields
def sqlFieldToRos

Variables

string _suffix_for_array_table = '_data_'
string _suffix_for_builtin = '_value_'
dictionary _type_map
string _types_table_name = 'message_types'

Function Documentation

def lama_interfaces.cleartext_interface_factory.addRosFields (   insert_args,
  msg,
  rossqltable,
  seq_nums 
)
Insert an argument for a SQL insert argument dictionnary

Helper function for SqlMsg.setter.

Parameters
----------
- insert_args: an argument dictionnary for a SQL insert statement.
- msg: an instance of ROS message.
- rossqltable: an instance of RosSqlTable.
- seq_nums: a list of ordered seq_num, from parent to child.

Definition at line 380 of file cleartext_interface_factory.py.

def lama_interfaces.cleartext_interface_factory.cleartext_interface_factory (   interface_name,
  getter_srv_msg,
  setter_srv_msg 
)
generate the interface class and run the getter and setter services

Example of call: interface_factory('laser_descriptor',
  'lama_interface/get_laser_descriptor',
  'lama_interface/set_laser_descriptor').

Parameters
----------
- interface_name: str, uniquely identifies an interface between jockeys
  and the database.
- getter_srv_msg: str, identifies the service message used when retrieving
  a descriptor from the database. For example
  'lama_interfaces/GetVectorLaserScan'.
  Service definition must be in form:
        int32 id
        ---
        * descriptor
- setter_srv_msg: str, identifies the service message used when adding
  a descriptor to the database. For example
  'lama_interfaces/SetVectorLaserScan'.
  Service definition must be in form:
        * descriptor
        ---
        int32 id

This function should be called only once with each parameter set because
it starts ROS services and an error is raised if services are started
twice.

Definition at line 852 of file cleartext_interface_factory.py.

def lama_interfaces.cleartext_interface_factory.getFromTable (   msg,
  rossqltable,
  ids,
  connection 
)
Retrieve information from the database

Helper function for SqlMsg.getter.

Parameters
----------
- msg: an instance of ROS message.
- rossqltable: an instance of RosSqlTable.
- ids: dict, a map "(table, seq_nums): id".
- connection: an sqlalchemy engine connection instance.

Definition at line 340 of file cleartext_interface_factory.py.

Definition at line 42 of file cleartext_interface_factory.py.

def lama_interfaces.cleartext_interface_factory.getMsgArgFromTable (   msg,
  tablename,
  field = '',
  seq_nums = [],
  has_srvname = True 
)
Return the part of a message determined by a table name and a field

Return the part of a message determined by a table name and a field. If the
tablename contains _suffix_for_array_table, seq_nums must give the index of
each item. There is a list in the message each time _suffix_for_array_table
is met.

Definition at line 194 of file cleartext_interface_factory.py.

Return the type of msg.arg, where arg can be a nested arg

Return the type of msg.arg, where arg can be a nested arg. For
example, with odom = nav_msgs.msg.Odometry() the following are valid:
    getMsgArgType(msg, 'pose') ==> 'nav_msgs/Odometry'
    getMsgArgType(msg, 'pose.pose.position.x') ==> 'float64
The separator in arg can be either '.' or '@', so that
    getMsgArgType(msg, 'pose@pose@position@x') ==> 'float64

Parameters
----------
- msg: instance of ROS message.
- arg: str, argument to get from msg. Valid values for arg are given by
    roslib.message.get_printable_message_args(msg).split().

Definition at line 156 of file cleartext_interface_factory.py.

Return the value of msg.arg, where arg can be a nested arg

Return the value of msg.arg, where arg can be a nested arg. For
example, with odom = nav_msgs.msg.Odometry() the following are valid:
    getMsgArgValue(msg, 'pose') <==> msg.pose
    getMsgArgValue(msg, 'pose.pose.position.x') <==>msg.pose.pose.position.x
The separator in arg can be either '.' or '@', so that
    getMsgArgValue(msg, 'pose@pose@position@x') <==>msg.pose.pose.position.x
If arg is the empty string, returns the whole message (even if it's a list).
If index is not None, the corresponding item list is returned instead of
the whole list.

Parameters
----------
- msg: instance of ROS message.
- arg: str, argument to get from msg. Valid values for arg are given by
    roslib.message.get_printable_message_args(msg).split().
- index: if not None, msg.arg[index] is returned rather than msg.arg.
    Defaults to None.

Definition at line 59 of file cleartext_interface_factory.py.

Return a dictionnary mapping slot names to slot type

Definition at line 54 of file cleartext_interface_factory.py.

def lama_interfaces.cleartext_interface_factory.insertInTable (   msg,
  rossqltable,
  ids,
  connection 
)
Write data to the database, written fields are in rossqltable

Helper function for SqlMsg.setter.

Parameters
----------
- msg: an instance of ROS message.
- rossqltable: an instance of RosSqlTable.
- ids: dict, a map "(table, seq_nums): id".
- connection: an sqlalchemy engine connection instance.

Definition at line 399 of file cleartext_interface_factory.py.

Return the sequence of parent ids for a _value_

Helper function for SqlMsg.getter and SqlMsg.setter.
Parameters
----------
- ids: dict, a map "(table, seq_nums): id".

Definition at line 305 of file cleartext_interface_factory.py.

Return the SQL table column name from a ROS field name

Return the SQL table column name from a ROS field name. SQL column names
with a period ('.') make problem to sqlalchemy.

Definition at line 625 of file cleartext_interface_factory.py.

Definition at line 48 of file cleartext_interface_factory.py.

def lama_interfaces.cleartext_interface_factory.setMsgArgFromTable (   msg,
  value,
  tablename,
  field = '',
  seq_nums = [],
  has_srvname = True 
)
Set the part of a message determined by a table name and a field

Return the part of a message determined by a table name and a field. If the
tablename contains _suffix_for_array_table, seq_nums must give the index of
each item. There is a list in the message each time _suffix_for_array_table
is met.

Definition at line 246 of file cleartext_interface_factory.py.

def lama_interfaces.cleartext_interface_factory.setMsgArgValue (   msg,
  arg,
  value,
  index = None 
)
Set the value of msg.arg, where arg can be a nested arg

Set the value of msg.arg, where arg can be a nested arg. For
example, with odom = nav_msgs.msg.Odometry() the following are valid:
    getMsgArgValue(msg, 'pose') <==> msg.pose
    getMsgArgValue(msg, 'pose.pose.position.x') <==>msg.pose.pose.position.x
The separator in arg can be either '.' or '@', so that
    getMsgArgValue(msg, 'pose@pose@position@x') <==>msg.pose.pose.position.x
The return value is msg.
If arg is the empty string and msg is not a list, returns value and do
*not* modify msg.
If index is not None, the corresponding item list is set instead of the
whole list.

Parameters
----------
- msg: instance of ROS message.
- arg: str, argument to get from msg. Valid values for arg are given by
    roslib.message.get_printable_message_args(msg).split().
- value: value to assign to msg.arg.
- index: if not None, msg.arg[index] is assigned rather than msg.arg.
    Defaults to None.

Definition at line 102 of file cleartext_interface_factory.py.

def lama_interfaces.cleartext_interface_factory.setRosFields (   msg,
  sqlresult,
  rossqltable,
  seq_nums 
)
Set an attribute of msg

Helper function for SqlMsg.getter.

Parameters
----------
- msg: an instance of ROS message.
- sqlresult: an SQL select.fetchone() result.
- rossqltable: an instance of RosSqlTable.
- seq_nums: a list of ordered seq_num, from parent to child.

Definition at line 320 of file cleartext_interface_factory.py.

Return the ROS field name from an SQL table column name

Definition at line 634 of file cleartext_interface_factory.py.


Variable Documentation

Definition at line 34 of file cleartext_interface_factory.py.

Definition at line 35 of file cleartext_interface_factory.py.

Initial value:
00001 {
00002     'bool': types.Boolean(),
00003     'char': types.SmallInteger(unsigned=True),
00004     'int8': types.SmallInteger(),
00005     'uint8': types.SmallInteger(unsigned=True),
00006     'byte': types.SmallInteger(),
00007     'int16': types.Integer(),
00008     'uint16': types.Integer(unsigned=True),
00009     'int32': types.Integer(),
00010     'uint32': types.Integer(unsigned=True),
00011     'int64': types.BigInteger(),
00012     'uint64': types.BigInteger(unsigned=True),
00013     'float32': types.Float(precision=32),
00014     'float64': types.Float(precision=64),
00015     'string': types.Text(),
00016 }

Definition at line 17 of file cleartext_interface_factory.py.

Definition at line 37 of file cleartext_interface_factory.py.



interfaces
Author(s): Gaël Ecorchard , Karel Košnar
autogenerated on Sat Jun 8 2019 19:03:14