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

How to change the output of a /cmd_vel topic ?

asked 2021-04-12 11:45:44 -0500

Kupofty gravatar image

Hi, I'm currently working on a project with a BlueRov2 and I measured the global speed (with motion tracking cameras) of the ROV for different input in the /cmd_vel topic and now I have the equation that matches the input (in the topic) to the real speed.

What I would like to do is to change the coefficient (according to my equation) so that when I publish (for exemple) linear x=0.1 my ROV goes to 0.1 m/s (in real life).

I'm quite new to ROS and I have no idea on how to do that, could somebody advise me on what's the best solution would be ?

Thanks !

(I'm using ROS melodic btw)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2021-04-12 23:11:44 -0500

jayess gravatar image

updated 2021-04-13 19:28:27 -0500

One option is to create a new node that subscribes to the /cmd_vel topic and does the transformation that you're looking for and publishes the transformed data and then have the robot subscribe to that topic instead of the /cmd_vel.

edit flag offensive delete link more

Comments

Seems like a very good option, I'll dig into that, thank you ! =)

Kupofty gravatar image Kupofty  ( 2021-04-13 07:24:35 -0500 )edit
0

answered 2021-04-12 15:17:36 -0500

ZYS gravatar image

updated 2021-04-12 23:09:57 -0500

jayess gravatar image

You can specify the velocity input via the command below:

rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.01, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.05}}'
edit flag offensive delete link more

Comments

Yes I know how to publish in the topic, maybe I wasn't clear enough.

For example everytime I publish in the topic I want the x=0.1 to be modified before being sent to the rov/thrusters

So if my equation is f(x)=exp(x)+x and my input is linear x : 0.1 then I would like the linear x to be equal to exp(0.1)+0.1 and then sent to the rov.

I hope my explanations are clear enough ! =)

Kupofty gravatar image Kupofty  ( 2021-04-12 17:02:47 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-04-12 11:45:44 -0500

Seen: 582 times

Last updated: Apr 13 '21