Ask Your Question
0

Message format rosbridge v2.0

asked 2013-02-04 03:58:54 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi, I have to publish on topic \cmd_vel a message:'{"linear":{"x":1,"y":0,"z":0}, "angular":{"x":0,"y":0,"z":0}}', of the type geometry_msgs/Twist using rosbridge v2.0. I have written: connection = new ros.Connection("ws://localhost:9090"); connection.publish('/cmd_vel', 'geometry_msgs/Twist', '{"linear":{"x":1,"y":0,"z":0}, "angular":{"x":0,"y":0,"z":0}}'); But the format message is for rosbridge v1.0. What I can write to publish the same message in the correct format of rosbridge v2.0? Thanks a lot!
Chiara

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2013-02-04 20:42:10 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

edit flag offensive delete link more
0

answered 2013-02-04 22:16:45 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Thank you, i tried with:

var cmdVel = new ros.Topic({ name : 'cmd_vel', messageType : 'geometry_msgs/Twist' }); var twist = new ros.Message({ angular : { x : 0, y : 0, z : 0 }, linear : { x : 1, y : 0, z : 0 } }); cmdVel.publish(twist);

                }

But the console of java script says me that in the line: var cmdVel = new ros.Topic({ there is: Uncaught TypeError: undefined is not a function Do you say what it means?

edit flag offensive delete link more

Comments

not too sure it's purely a javascript issue or rosjs related. But have you included the rosjs script in your file, like this example file, https://github.com/RobotWebTools/keyboardteleopjs/blob/groovy-devel/example/keyboardteleop.html ?

clark gravatar imageclark ( 2013-02-05 12:49:13 -0600 )edit
0

answered 2013-02-07 11:42:38 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I cannot say for sure why you are getting an error. I can say that this command worked for me:

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

in the context of this tutorial:

http://www.rosbridge.org/doku.php?id=tutorials:ardrone&s[]=drone

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-02-04 03:58:54 -0600

Seen: 781 times

Last updated: Feb 07 '13