Module: robotics.rosInterface
This interface collects interfaces and functionality for ROS comunication This library is under construction (2023-05); To make use of this libraries, you need to install ROS (ROS1 noetic) including rospy Please consider following workflow: make sure to have a working ROS1-NOETIC installation, ROS2 is not supported yet tested only with ROS1-NOETIC, ubuntu 20.04, and Python 3.8.10 you find all ROS1 installation steps on: http://wiki.ros.org/noetic/Installation/Ubuntu Step 1.4 we recommend to install: (sudo apt install ros-noetic-desktop) Check the installation of the turtlesim package (rosrun turtlesim turtlesim_node ) if not installed: sudo apt install ros-noetic-turtlesim use a catkin workspace and build a ROS1 Package Follow instructions on: http://wiki.ros.org/ROS/Tutorials (recommend go trough step 1 to 6) Minimal example to use: create catkin workspace: mkdir -p ~/catkin_ws/src cd ~/catkin_ws catkin_make source devel/setup.bash build ROS package: cd ~/catkin_ws/src catkin_create_pkg my_pkg_name rospy roscpp std_msgs geometry_msgs sensor_msgs build catkin workspace and sourcing setup file cd ~/catkin_ws cakin_make source ~/catkin_ws/devel/setup.bash for more functionality see also: ROSExampleMassPoint.py, ROSExampleBringup.launch, ROSExampleControlVelocity.py
Author: Martin Sereinig, Peter Manzl
Date: 2023-05-31 (created)
CLASS ROSInterface (in module robotics.rosInterface)
class description: interface super class to establish a ROS Exudyn interface see specific class functions which can be used and extended by inheritance with class MyClass(ROSInterface)
author: Martin Sereinig, Peter Manzl
notes: some inspiration can be taken from
Class function: InitPublisher
InitPublisher(self, pubTopicName = '', pubType = Empty, queueSize = 10)
class function description: function to create a publisher
input:
pubTopicName: topic name to publish, actual topic will be /exudyn/pubTopicNamepubType: data type used in topicqueSize: length of queue to hold messages, should be as small as sending frequency (= simulation sample time)
author: Martin Sereinig
notes: find msgs types here http://docs.ros.org/en/melodic/api/std_msgs/html/index-msg.html
example:
publisher for poses, pubType = PoseStamped,
publisher for system data, pubType = Float64MultiArray,
publisher for filtered force, pubType = WrenchStamped,
publisher for velocities, pubType = Twist,
Class function: ExuCallbackGeneric
ExuCallbackGeneric(self, subTopicName, data)
class function description: function to create a generic callback function for a subscriber
input:
topic: topic name generated by init Subscriberdata: data structure for regarding individual topic
author: Peter Manzl
Class function: InitSubscriber
InitSubscriber(self, subTopicNameSpace, subTopicName, subType)
class function description: function to create a subscriber
input:
subTopicNameSpace: topic namespace: ‘exudyn/’subTopicName: topic name to subscribesubType: data type for topic to subscribe
author: Peter Manzl
notes: callback function will be automatic generated for each subscriber, depending on subTopicName. Data will be found under self.subTopicName
Class function: CheckROSversion
class function description: check the current used ROS version
author: Martin Sereinig
notes: just supports ROS1, ROS2 support will be given in future releases
Class function: PublishPoseUpdate
PublishPoseUpdate(self, mbs, tExu, getData = 'node')
class function description: Example method to be called once per frame/control cycle in Exudyn PreStepUserFunction
input:
mbs: mbs (exudyn.exudynCPP.MainSystem), multi-body simulation system from exudyntExu: tExu (float), elapsed time since simulation startgetData: getData (string), get pose information from ‘node’ or from ‘sensor’
author: Martin Sereinig
notes: reads sensor values, creates message, publish and subscribe to ROS publishing each and every step is too much, this would slow down the connection thus: publish every few seconds, only furthermore, as vrInterface is only updating the graphics with f=60Hz, we don’t have to update system state every 1ms, so with f=1000Hz. Instead f=60Hz equivalents to update every 1/60=17ms timing variable to know when to send new command to robot or when to publish new mbs system state update
Class function: PublishTwistUpdate
PublishTwistUpdate(self, mbs, tExu, getData = 'node')
class function description: Example method to be called once per frame/control cycle in Exudyn PreStepUserFunction
input:
mbs: mbs (exudyn.exudynCPP.MainSystem), multi-body simulation system from exudyntExu: tExu (float), elapsed time since simulation startgetData: getData (string), get pose information from ‘node’ or from ‘sensor’
author: Martin Sereinig
notes: reads sensor values, creates message, publish and subscribe to ROS
Class function: PublishSystemStateUpdate
PublishSystemStateUpdate(self, mbs, tExu)
class function description: method to be send system state data once per frame/control cycle in Exudyn PreStepUserFunction
input:
mbs: mbs (exudyn.exudynCPP.MainSystem), multi-body simulation system from exudyntExu: tExu (float), simulation timesystemStateData: systemStateData (list), full Exudyn SystemState
author: Martin Sereinig
notes: collects important exudyn system data and send it to ros-topic