Skip to content

ROS 2 (rosbridge)

Beta

Talks to ROS 2 through rosbridge (WebSocket and JSON). Topic fields become ordinary CONNECT signals. Beta; needs CONNECT 1.11 or newer.

CONNECT reaches ROS 2 like this.

CONNECT reaches ROS 2 through rosbridge On the ROS computer, rosbridge_server exposes ROS 2 topics and services over a WebSocket, by default ws://localhost:9090. CONNECT connects to it with JSON messages. Topic fields become CONNECT signals such as /cmd_vel#linear.x, which the viewer reads and writes. Nothing from ROS has to be installed on the CONNECT computer. ROS computer ROS 2 nodesIsaac Sim, MoveIt, Nav2, ... rosbridge_servertopics and services as JSONws://host:9090 CONNECT computer ROS 2 interfaceFields, JointState, Pose, Twist/cmd_vel#linear.x Signalsto the viewer and your tools WebSocket
CONNECT talks to rosbridge over a WebSocket; topic fields become ordinary signals.

CONNECT talks to ROS 2 through rosbridge (WebSocket and JSON). Topic fields become ordinary CONNECT signals, so forcing, recording and binding work as for any other interface. Nothing from ROS has to be installed on the CONNECT computer, and the interface runs on Windows and Linux.

On the ROS computer, install rosbridge_suite and start the server. The reference setup is ROS 2 Jazzy with rosbridge 2.7.1:

Terminal window
sudo apt install ros-jazzy-rosbridge-suite
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
ParameterDefaultMeaning
URLws://localhost:9090rosbridge WebSocket, ws:// or wss://
TokenEmptyStored like every interface password. CONNECT does not send it to rosbridge yet, so it does not authenticate the connection.
AxisCount0Number of joints published as <interface>.axis1 … axisN in JointState mode
TopicsEmptyOne row per topic with message type, mode and the settings below
ServicesEmptyOne row per service with service name and type

Each topic row has these settings:

SettingDefaultMeaning
TopicEmptyTopic name starting with /, for example /cmd_vel
MessageTypeEmptyFor example geometry_msgs/msg/Twist. Needed to publish; signals that only read can do without
ModeFieldsFields, JointState, Pose or Twist, see below
UnitModeSiSi converts to millimetres and degrees, Raw keeps the ROS values
JointNamesEmptyOptional joint order by name for JointState mode
ThrottleRateMs0Asks rosbridge to send at most one message per this many milliseconds
QueueLength1Subscription queue. Keep 1; larger queues built up a backlog in measurements
PublishIntervalMs100Cycle of outgoing messages, 20…60000 ms
PublishOnChangeoffAlso sends changed values on the next cycle; the cyclic publish continues

Signals are addressed as <topic>#<field path>:

AddressValue
/cmd_vel#linear.xNested field of a message
/joint_states#position[2]Third element of an array (zero-based)
/chatter#dataText payload

Use dots for nested fields and one fixed, non-negative index for an array element. The topic is part of the address, so /a#data and /b#data stay distinct. Wildcards, whole arrays and empty segments are rejected.

The direction follows the PLC convention. A PLCOutput signal is read: CONNECT subscribes to the topic. A PLCInput signal is written: CONNECT advertises the topic and publishes it. Keep all signals of one topic in the same direction; a mix is reported as a signal issue.

Publishing always sends the complete message: bound fields carry their latest values, unbound fields their defaults. One invalid value pauses that topic until it is corrected. Writing needs Allow web to PLC, and a write hold blocks it too. A change made while writing is blocked is held and sent when writing is released.

With Si, CONNECT converts the values of built-in robot messages: metres to millimetres, metres per second to millimetres per second, radians to degrees and radians per second to degrees per second. Writes reverse the conversion. Time and duration values are seconds. Types that were only learned through discovery are never converted. Float signals have 32-bit precision, also for ROS float64.

Poses use REP-103 roll-pitch-yaw: rx is roll about X, ry pitch about Y and rz yaw about Z, in degrees in both unit modes.

  • Fields binds individual scalar fields. Use it for quaternion components and for joint commands.
  • JointState reads one sensor_msgs/msg/JointState topic per interface and creates <interface>.axis1 … axisN. With JointNames set, axes are matched by name even if the order of the message changes. It does not write.
  • Pose reads or writes one Pose, PoseStamped, Transform, TransformStamped or Odometry topic per interface and creates <interface>.pose.x, .y, .z, .rx, .ry, .rz.
  • Twist binds linear.x/y/z and angular.x/y/z of a Twist (prefix twist. for TwistStamped) and publishes them together.

Add a service with its type: std_srvs/srv/Trigger, SetBool or Empty. For interface robot and service /enable, CONNECT creates robot.srv.enable.cmd (PLC input) and .busy, .done, .error (PLC outputs); Trigger and SetBool also give .message. Bind request fields as inputs (/enable#request.data) and response fields as outputs (/enable#response.success).

Set the request values, then switch .cmd from false to true: this calls the service once with the values at that moment. Holding .cmd true does not repeat the call, a call is never repeated after a reconnect, and a blocked write discards it. No answer within 30 seconds, or a failed call, sets .error. .done only confirms a valid response; read success for the result of the service itself.

Browse asks rosapi (part of rosbridge_suite) for the topics of the ROS graph and proposes one signal per scalar field, with data type and direction: a topic with a publisher is proposed as an output, a topic with subscribers only as an input. Review the proposals before you add them. Browse does not need write access. Without rosapi, add topics and signals manually.

  • Images, camera information, point clouds, laser scans and maps are rejected as unsupported. They do not fit a signal bridge.
  • ROS actions are not supported.
  • Unbounded arrays and fixed arrays above 16 elements are not proposed by Browse. Add single elements by hand or use JointState mode.
  • Publishing needs a known message type, built in or learned through Browse.
  • A connected socket proves neither that a topic exists nor that values arrive. rosbridge accepts a subscription to a missing topic without an error, so check the interface’s read health and signal issues.
  • Manually. Add a topic row, then address fields as <topic>#<field path>: /cmd_vel#linear.x, /joint_states#position[2], /chatter#data. In Pose mode the components are addressed as /pose#x … /pose#rz (see Robot shapes above).
  • Browse. Yes. Browse asks rosapi for the topics of the ROS graph and proposes one signal per scalar field with data type and direction (a topic with a publisher is proposed as output, one with subscribers only as input). Review the proposals before adding. Without rosapi, add topics and signals manually.
  • File import. No protocol-specific file import.
  • From the model. When the model already has its PLC signals, Addresses → Fill from controller… in the signal-mapping section of the CONNECT panel previews matches by exact name against what Browse finds and then writes the addresses. Addresses → Import address table… takes a CSV or TSV with name;address[;dataType[;topic]] rows. New signals take direction and type from the same-named model signal; signals that already exist keep their configured type. See Configuring interfaces.

How direction, data types and write access are decided is explained in Common concepts and Configuring interfaces.

A UR10e packs chocolate bars into a display carton. The sequence runs either in the model’s built-in Structured Text programs (Simulation) or in ROS 2: a sequencer node sends FollowJointTrajectory goals to the Universal Robots driver, and CONNECT carries the joint angles and the cell signals. No robot is needed, the driver runs with mock hardware.

The UR10e packing cell: the robot places a chocolate bar into the display carton

Download the ROS 2 package (ZIP, 10 KB): setup, start and stop scripts, the sequencer node, the joint poses and the CONNECT configuration of the interface.

On the ROS computer (Ubuntu 24.04 natively, in a VM or in a WSL2 distro):

Terminal window
sudo bash setup-ros-jazzy-ur.sh # once: ROS 2 Jazzy, UR driver, rosbridge_suite
bash start-workcell.sh # UR10e driver (mock hardware), rosbridge on port 9090, sequencer
bash stop-workcell.sh

start-workcell.sh ends with sequencer ready: variant packing, 27 poses. The scripts use ROS_DOMAIN_ID=42; logs are in /tmp/rv-ur10e/.

One interface of type ROS 2 with Url ws://<ROS computer>:9090. UR10e-ChocolatePacking.connect.json in the download holds the complete configuration with these topics:

TopicTypeDirectionSignals
/joint_statessensor_msgs/msg/JointState, mode JointState, units SiROS to CONNECTrUR_ShoulderPan, rUR_ShoulderLift, rUR_Elbow, rUR_Wrist1, rUR_Wrist2, rUR_Wrist3 (degrees)
/rv/cell/start, /stop, /reset, /estopstd_msgs/msg/BoolCONNECT to ROSOperator panel
/rv/cell/part_presentstd_msgs/msg/BoolCONNECT to ROSPhoto eye at the feed tray
/rv/cell/vacuum, /auto, /conveyor, /clear_carton, /lamp_green, /lamp_white, /lamp_red, /lamp_orangestd_msgs/msg/BoolROS to CONNECTVacuum, mode, conveyor, carton exchange, stack light
/rv/cell/parts, /cartons, /slot, /stepstd_msgs/msg/Int32ROS to CONNECTCounters and sequence step
/rv/cell/cycle_timestd_msgs/msg/Float64ROS to CONNECTCycle time of the last bar in seconds

The joints are matched by name (shoulder_pan_joint … wrist_3_joint), because the driver publishes them in a different order. Only plain std_msgs and sensor_msgs are used, so no custom message types are needed.

  • While the interface is enabled and connected, ROS drives the cell: the viewer shows PLC and the built-in programs write nothing.
  • After ROS moved the robot, the cell stops with ROBOT MOVED EXTERNALLY - PRESS ACKNOWLEDGE (RESET). Acknowledge on the operator panel lifts the robot, moves it home and continues.