Fejemis bridge: Difference between revisions
(6 intermediate revisions by the same user not shown) | |||
Line 59: | Line 59: | ||
front led 5 200 0 0 | front led 5 200 0 0 | ||
front led 6 200 0 0 | front led 6 200 0 0 | ||
; steering control settings | |||
; cssteer 1 Kp I_use I_tau I_lim 1 Df_use tz tp Db_use tz tp ... | |||
; pre_use tz tp lim_use max min ff_use Kff fff_use tz tp angAdj | |||
; Kp ---I------- fwd-filter- bk-filt- pre-f out-limit--- --ff+filt- fold | |||
front cssteer 1 5 0 1 100 1 1 0.5 0.05 1 0 0.02 0 1 1 0 -1000 1000 0 1 0 1 1 1 | |||
front sub id 2000 | front sub id 2000 | ||
front sub ver 2001 | front sub ver 2001 | ||
front sub hbt 601 | front sub hbt 601 | ||
; max values for RC control | ; max values for RC control | ||
; velocity (m/sec), | ; velocity (m/sec), turn rate deg/sec, and slow factor (0.2'ish) | ||
gamepad rcmax 2.0 45 0.2 | |||
;drive:pose logopen | ;drive:pose logopen | ||
;drive:gyro logopen | ;drive:gyro logopen | ||
Line 91: | Line 92: | ||
; if source is fejemis | ; if source is fejemis | ||
;drive:pose subscribe -1 ros | ;drive:pose subscribe -1 ros | ||
Lines starting with ';' is a comment | |||
==Management commands== | ==Management commands== | ||
Line 109: | Line 112: | ||
* load <filename> Load a specific initialization file (bridge.ini is always loaded at the start of the bridge). | * load <filename> Load a specific initialization file (bridge.ini is always loaded at the start of the bridge). | ||
* reload <interface name> Reloads the system initialization file (bridge.ini) for this interface. | * reload <interface name> Reloads the system initialization file (bridge.ini) for this interface. | ||
* logopen Creates a log for use of ini-file. | |||
* logclose Closes log for ini-use. | |||
* help This list | * help This list | ||
==== Teensy interface ==== | ==== Teensy interface ==== | ||
There are two Teensy interfaces 'drive' and 'front' | |||
e.g.: | e.g.: | ||
Line 119: | Line 126: | ||
* meta Get the metadata related to the interface, a text message. | * meta Get the metadata related to the interface, a text message. | ||
* logopen Create logfile with all updates through this data source. | * logopen Create logfile with all updates through this data source (one for tx and one for rx). | ||
* logclose Close the | * logclose Close the logfiles. | ||
* help This list | * help This list | ||
The Teensys has data items and commands as described here: ???? | |||
==== Bridge ==== | ==== Bridge ==== |
Latest revision as of 14:57, 21 October 2023
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 ; steering control settings ; cssteer 1 Kp I_use I_tau I_lim 1 Df_use tz tp Db_use tz tp ... ; pre_use tz tp lim_use max min ff_use Kff fff_use tz tp angAdj ; Kp ---I------- fwd-filter- bk-filt- pre-f out-limit--- --ff+filt- fold front cssteer 1 5 0 1 100 1 1 0.5 0.05 1 0 0.02 0 1 1 0 -1000 1000 0 1 0 1 1 1 front sub id 2000 front sub ver 2001 front sub hbt 601 ; max values for RC control ; velocity (m/sec), turn rate deg/sec, and slow factor (0.2'ish) gamepad 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
Lines starting with ';' is a comment
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 interface
The reserved keywords or commands related to an interface:
Ini-file handler
A command line starting with the destination 'ini' is handled by the initialization module, e.g.:
ini reload drive
Command list:
* load <filename> Load a specific initialization file (bridge.ini is always loaded at the start of the bridge). * reload <interface name> Reloads the system initialization file (bridge.ini) for this interface. * logopen Creates a log for use of ini-file. * logclose Closes log for ini-use. * help This list
Teensy interface
There are two Teensy interfaces 'drive' and 'front'
e.g.:
drive logopen
Command list:
* meta Get the metadata related to the interface, a text message. * logopen Create logfile with all updates through this data source (one for tx and one for rx). * logclose Close the logfiles. * help This list
The Teensys has data items and commands as described here: ????
Bridge
e.g.:
bridge list
Command list:
* list List all data items and data sources in the system as text * items List all data items in the format 'item N U L source: keyword params', where N is item number, U is number of updates received, L is logfile open. * restart Is a command to restart the bridge (and thereby delete all data points) * quit Quit the bridge * batlow V Set the battry low value to V (the system shuts down, when this value is passed). * teensy D A Starts or stops a teensy connection, D is device (0 or 1), set A=1 to activate or A=0 to deactivate. * help This list
Joystick (gamepad)
e.g.:
gamepad dev
Command list:
* dev Lists gamepad interface details * rcmax V T S Set maximum velocity (m/s), turnrate (deg/sec) and slow factor ]0..1] * spgm B cmd Associate a buttom B on the gamepad with a command 'cmd' * help This list
ROS interface
No specific commands.
Reserved commands for a data item
The reserved keywords handled by a data item are:
e.g.:
drive:pose subscribe -1 ROS
Command list:
* 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 P C Set a message to be handled, when this data item is updated, e.g. request a gyro message, when an actuator is activated. P=-1 all updates, 0=none, else interval in ms as fastest rate. C is the action string. * status Request status for the data item (number of updates, and list of subscribers). * name string Set the 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 metadata 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 This list).