ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Abnormal in simple rosbridge v2 / turtlesim example

asked 2012-10-26 19:48:53 -0500

clark gravatar image

updated 2012-10-26 19:50:03 -0500

There is a good tutorial for rosbridge v1 quick start, at, but I can't find a similar tutorial for rosbridge v2, so I tried to mimic turtlesim with rosbridge 2, based on the example file under rosjs, and here is the link of my html file link text

During testing, I run the following commands in terminal,

rosrun turtlesim turtlesim_node
rosrun rosbridge_server

and then load the html file in Firefox.

Basically there are two issues observed,

1 when the 4 buttons are pressed, the turtle never move and rostopic echo /turtle1/command_velocity always give me

linear: 0.0 angular: 0.0

2 the subscription to topic "/turtle/pose" returns undefined and only returns once,

Received message on /turtle1/pose: undefined

Obviously I missed something in the above html file, so appreciate if anyone can give me some clue.

thanks clark

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-11-04 06:50:17 -0500

odestcj gravatar image

I am not yet familiar with "ros_bundle.min.js". However, I can answer this issue using "ros.js", found under "rosbridge_clients" in the release version of rosbridge_suite. Using this ros.js, I used the following example page to control both turtlebots and AR.Drones:

In this case, the connection is created as follows:

var con = new Bridge("ws://localhost:9090");

Addressing point 1, publishing command velocity for moving forward is done as follows:

con.publish('/cmd_vel', {"linear":{"x":1.0,"y":0,"z":0},"angular":{"x":0,"y":0,"z":0}});

In Chrome, you should be able to inspect the actual websocket frame that is sent using the development tools (regardless of which ros.js you are using). I found this description of inspecting websocket traffic useful:

I haven't tried subscribing to pose yet, so I will pass on speculating about the second issue.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2012-10-26 19:48:53 -0500

Seen: 812 times

Last updated: Nov 04 '12