ROS Topic Publisher/Subscriber

../../../../_images/ros_topic_publisher_subscriber1.png

Within a Gazebo Plugin GenericDomainModel, a ROS Topic Publisher or Subscriber is represented by a GenericDomainModelPort with the following Attributes.

Attributes Value Description
Type topic  
Attribute 0 [default topic name] Default ROS Topic name
Attribute 1    
Attribute 2 [msg type] ROS Topic Msg Type - e.g. WrenchStamped
Attribute 7 ros  

If the CyPhy Master Interpreter is run, these Attributes will be used to populate the parent ROS Gazebo Plugin’s corresponding gazebo element in the generated URDF file.

For each netlist of connected ports, the Interpreter will check that the the port types all match (e.g. a ROS Topic Publisher cannot broadcast to a ROS Service Server) and that the Topic Msg types (if specified) all match.

If the port is connected to other ports, a unique ROS Topic name will be generated and assigned to ports in that netlist.

Otherwise, Attribute 0’s Value will be used.

The ROS Topic Publisher or ROS Topic Subscriber GenericDomainModelPort’s name is used as a key to populate the Gazebo Plugin GenericDomainModel’s connected template file Resource with the ROS Topic name.

Example ROS Topic Subscriber GenericDomainModelPort

../../../../_images/example_ros_topic_subscriber.png

Example Template Resource

<robot>
  <gazebo>
    <plugin name="diffdrive_plugin_multiwheel" filename="libdiffdrive_plugin_multi_wheel.so">
          <commandTopic>${commandTopic}</commandTopic>
      ...
  </gazebo>
</robot>

Example Generated URDF

<robot>
  ...
  <gazebo>
    <plugin name="diffdrive_plugin_multiwheel" filename="libdiffdrive_plugin_multi_wheel.so">
          <commandTopic>cmd_vel</commandTopic>
      ...
  </gazebo>
  ...
</robot>