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)

  • classFunction:
    function to create a publisher
  • input:
    pubTopicName: topic name to publish, actual topic will be /exudyn/pubTopicName
    pubType: data type used in topic
    queSize: 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:
s:
       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)

  • classFunction:
    function to create a generic callback function for a subscriber
  • input:
    topic: topic name generated by init Subscriber
    data: data structure for regarding individual topic
  • author:
    Peter Manzl

Class function: InitSubscriber

InitSubscriber(self, subTopicNameSpace, subTopicName, subType)

  • classFunction:
    function to create a subscriber
  • input:
    subTopicNameSpace: topic namespace: ‘exudyn/’
    subTopicName: topic name to subscribe
    subType: data type for topic to subscribe
  • author:
    Peter Manzl
    **note: callback function will be automatic generated for each subscriber, depending
    on subTopicName. Data will be found under self.subTopicName

Class function: CheckROSversion

CheckROSversion(self)

  • classFunction:
    check the current used ROS version
  • author:
    Martin Sereinig
    **note: just supports ROS1, ROS2 support will be given in future releases

Class function: PublishPoseUpdate

PublishPoseUpdate(self, mbs, tExu, getData = 'node')

  • classFunction:
    Example method to be called once per frame/control cycle in Exudyn PreStepUserFunction
    **note: reads sensor values, creates message, publish and subscribe to ROS
  • input:
    mbs: mbs (exudyn.exudynCPP.MainSystem), multi-body simulation system from exudyn
    tExu: tExu (float), elapsed time since simulation start
    getData: 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')

  • classFunction:
    Example method to be called once per frame/control cycle in Exudyn PreStepUserFunction
    **note: reads sensor values, creates message, publish and subscribe to ROS
  • input:
    mbs: mbs (exudyn.exudynCPP.MainSystem), multi-body simulation system from exudyn
    tExu: tExu (float), elapsed time since simulation start
    getData: 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)

  • classFunction:
    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 exudyn
    tExu: tExu (float), simulation time
    systemStateData: systemStateData (list), full Exudyn SystemState
  • author:
    Martin Sereinig
    **note: collects important exudyn system data and send it to ros-topic

Relevant Examples (Ex) and TestModels (TM) with weblink to github: