Fejemis bridge
Back to fejemis.
Contents |
Bridge overview
The bridge combines different inputs from hardware sources to a single message database from which the messages can be seubscriber. This makes the bridge a combination of a bridge (slightly reformatting the messsages) and a message broker, from which clients can subscribe to messages. Messahes can also be send from any of these broker-clients.
Selected interface points are made available as ROS messages and key commands can be received from ROS.
The main input and output connections are to the Drive and Front Teensy boards, these connections are protected by a simple checksum, the ';99' part, to avoid false or half messages when powering up.
- All data items are single lines of text. These data items start with a key and optionally additional parameters. The data item has further a data source associated.
- Data items can be directed to a destination (data forward).
- A data item can be requested, or updates to a data item can be subscribed.
The ini-file holds a set of commands, e.g. calibration data or subscription of data to any destination.
All data items can be logged individually with a timestamp.
The client GUI is to help configure/calibrate the sensors and low-level control loops.
Bridge initialization file
The initialization file holds a list of commands that will be handled by the bridge. The file is called bridge.ini and is positioned in the same directory as the executable
Most commands start with a destination keyword. If that interface is opened after the initial read of the initialization file, then the file is read again for the commands destinated for this interface.
An example of an initialization file could be:
; inifile to fejemis bridge ; start both Teensy connections bridge teensy 0 1 bridge teensy 1 1 ; front teensy help # Text from ini-loader drive posei drive veli drive gyroi drive confi ; subscribe to regular stream of data drive sub pose 10 drive sub gyro 11 drive sub enc 9 drive sub bat 400 drive sub conf 801 drive sub hbt 601 drive sub mot 23 drive sub id 2000 drive sub ver 2001 ; front led 1 200 0 0 front led 2 200 0 0 front led 3 200 0 0 front led 4 200 0 0 front led 5 200 0 0 front led 6 200 0 0 front sub id 2000 front sub ver 2001 front sub hbt 601 ; debug with regbot regbot sub pose 40 regbot sub ver 2000 regbot sub hbt 620 ; max values for RC control ; velocity (m/sec), turnrate deg/sec and slow factor (0.2'ish) joy rcmax 2.0 45 0.2 ;drive:pose logopen ;drive:gyro logopen ; allow robot to drive ;drive arm ; send RC to both front and drive gamepad:rc subscribe -1 front gamepad:rc subscribe -1 drive gamepad:rc subscribe -1 regbot ; send steer angle to drive front:fwl subscribe -1 drive ; ; command-line options ; if bridge is run from the command line regbot:# subscribe -1 console front:# subscribe -1 console drive:# subscribe -1 console ; ; publish pose to ROS ; if source is a regbot ;regbot:pose subscribe -1 ros ; if source is fejemis ;drive:pose subscribe -1 ros
Management commands
Both data items and data sources can be managed by a set of reserved keywords. That is, if a command is sent to a destination with one of these keywords, the message is not sent to the data source, but handled by the interface.
Reserved commands for an inteface
The reserved keywords handled by an interface:
- onupdate (set a message to be handled, when this data item is updated, e.g. request a gyro message, when an actuator is activated "drive:).
- name (set name of the data item).
- meta (get the meta data related the interface, a text message).
- logopen (create logfile with all updates to this data item or all traffic through this data source).
- logclose (close the logfile).
- help (get a list of available commands (reserved keywords).
Reserved commands for a data item
The reserved keywords handled by a data item are:
- subscribe (e.g. 'drive:pose subscribe -1 ros', where the data item is 'pose' from the source 'drive', the parameter -1 means all updates, and the destination interface is 'ROS'.
- onupdate (set a message to be handled, when this data item is updated, e.g. request a gyro message, when an actuator is activated "drive:).
- status (request status for the interface or data item ??)
- name (set name of the data item, e.g. 'drive::conf name Configuration values for drive system', anything after 'name ' is the new description of the data item).
- get (get the latest value of the data item).
- meta (get the meta data related to the data item (including the name)).
- logopen (create logfile with all updates to this data item or all traffic through this data source).
- logclose (close the logfile).
- help (get a list of available commands (like this list).