ROS Publisher

Block Category: Extensions > ROS

Inputs: Determined by the ROS Message Type parameter.

     A: Alpha values of pixels; double

     angular[x,y,z]: Angular acceleration in x y and z direction; 3x1 matrix double

     B: Blue color intensity; double

     Byte[data]: Array of data matrix

     char data: Character data

     com[x,y,z]: Center of mass; 3x1 matrix double

     covariance[36]: Row-major representation of the 6x6 covariance matrix;  36x1 matrix double

     Empty data: Empty data

     Floatx [data]: Multidimensional array

     force[x,y,z]: Force in x, y, and z direction; 3x1 matrix double

     frame_id: Frame associated with the data; string

     G: Green color pixel value; double

     intx [data]: Multidimensional array

     ixx: The moment of inertia of a body along the horizontal axis passing throgh the centroid of the body; double

     iyx: The moment of inertia of a body along the vertical axis passing through the centroid of the body; double

     izz: The moment of inertia of a body along the axis perpendicular to both the horizontal and vertical axes through the centroid of the body; double

     [label]: Label of given dimension; string

     linear[x,y,z]: Linear acceleration in x, y, and z direction; 3x1 matrix double

     M: Mass in kilograms; double

     offset: Padding values preceding data; unsigned integer

     position[x,y,z]: Position in free space in x, y, and z coordinates; 3x1 matrix double

     quaternion[x,y,z,w]: Orientation in free space in quaternion form; 4x1 matrix double

     R: Red color pixel value; double

     Rotation[x,y,z,w]: Orientation in free space in quaternion form; 4x1 matrix double

     seq: Consecutively increasing ID; integer

     [size]: Size of given dimension; unsigned integer

     [stride]: Stride of given dimension; unsigned integer

     string data: String data

     theta: Rotation angle in radiance; double

     time: Current ROS server time; double

     timestamp: Time at which the data is received; double

     torque[x,y,z]: 3x1 matrix double

     translation[x,y,z]: Vector in free space in x y and z direction; 3x1 matrix double

     UIntx [data]: Multidimensional array

     [x]: Position of array in x direction that can support up to 32 inputs of data; matrix

     X: Position in X direction; double

     [y]: Position of array in y direction that can support up to 32 inputs of data; matrix

     Y: Position in Y direction; double

     [z]: Position of array in z direction that can support up to 32 inputs of data; matrix

     Z: Position in Z direction; double

 

Description: The ROS Publisher block allows communication with ROS-enabled robots. ROS Publisher publishes a specific type of ROS message over a given ROS topic. The message is updated, if necessary, at each time step. Interested ROS Subscriber blocks can access the messages. Messages are exchanged until the simulation terminates.

A screenshot of a computer

Description automatically generated

Communication protocol: Indicates UDP or Websocket communication protocol. UDP is faster, but works only with ROS 1.

Publisher Client ID: Indicates the ID required to differentiate between different instances of the publisher.

Port: Indicates a dedicated port number set by the ROS bridge server.

ROS Message Type: Defines the type of message and the data format. The ROS Message Type determines the inputs on the ROS Publisher block. For example, geometry_msgs/Pose is a representation of pose in free space, composed of position and quaternion (orientation), which are the inputs to the block.

ROS Publisher recognizes two types of messages: geometry and standard. Message types are described at https://index.ros.org/p/geometry_msgs/ and https://index.ros.org/p/std_msgs/ .

ROS Server IP: Indicates the ROS bridge server name or IP address. If you do not have a ROS bridge server, you can install one on Windows Subsystem for Linux (WSL) on Windows 10+. If you do, to access the IP address, open a Linux shell by entering WSL in the Search box in the lower left corner of your screen and enter ifconfig | grep -o 'inet [0-9.]\+'

Use the first inet address from the displayed list.

ROS Topic: Lists the available ROS topics. Click Refresh Topics to refresh the list.

Status: Displays the connectivity to the ROS server. Click Check Status to see the current connectivity.

Examples

See Examples > Blocks > Extensions > ROS.