Fejemis bridge

From Rsewiki
Revision as of 11:36, 17 October 2023 by Jca (talk | contribs)

Back to fejemis.


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.

Commads to an inteface

The reserved keywords handled by the interface or 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 (a command issued, when the data item is updated. @todo, is this implemented??
  • status (request status for the interface or data item ??)
  • name (set name of the data item).
  • get (get the latest value of the data item).
  • meta (get the meta data related to the data item).
  • logopen (create logfile with all updates to this data item or all traffic through this data source).
  • logclose (close the logfile).
  • logpath (set the logpath)
  • help (get a list of available commands (like this list).