Publish a cmd_vel geometry msgs/twist from webserver over rosbridge to RVIZ

asked 2019-06-26 02:21:29 -0600

Qualityland gravatar image

updated 2022-04-17 11:08:59 -0600

lucasw gravatar image

I am new to ROS and I am trying to publish a cmd_vel geometry_msgs/twist from my Webserver and visualize it in RVIZ, so that I can see the robot moving.

I am running the ROS distro kinetic on a virtual machine with Ubuntu 16.04.6 LTS. And I built my webserver using nodejs.

I also already installed rosbridge on the VM and successfully launched it using:

$ roslaunch rosbridge_server rosbridge_websocket.launch

And with this cmd I successfully launch RVIZ version 1.12.17 (kinetic):

$ roslaunch franka_own_simulator demo.launch rviz_tutorial:=true

This is the code I implemented on my webserver:

var ros = new ROSLIB.Ros({
  url: 'ws://'

ros.on('connection', () => {
  console.log('connected to webserver')

ros.on('error', function(error) {
  console.log('Error connecting to websocket server: ', error)

var cmdVel = new ROSLIB.Topic({
  ros: ros,
  name: '/cmd_vel',
  messageType: 'geometry_msgs/Twist'

var twist = new ROSLIB.Message({
  linear : {
    x : 0.1,
    y : 4.2,
    z : 0.3
  angular : {
    x : -0.1,
    y : -0.2,
    z : -4.3
console.log('message sent')

With this code I am able to connect to the rosbridge I launched on the VM and I am also able to echo the cmdVel message, on the VM, that was sent, using:

$ rostopic echo /cmd_vel
  x: 0.1
  y: 4.2
  z: 0.3
  x: -0.1
  y: -0.2
  z: -4.3

But the simulated robot in RVIZ doesn't move.

My Question now is: How am I able to subscribe RVIZ to this topic, so that I am able to steer the robot by sending messages from my webserver? Or am I just using the wrong topic?

I don't know if this is of relevance in order to help with my problem, but these are the active nodes on my VM:

$ rosnode list

edit retag flag offensive close merge delete