Limit linear velocity [closed]
Hi everyone,
I wrote a node that subscribes to the topic sensor_msgs/LaserScan and publishes in the topic geometry_msgs/Twist. I want to limit the maximum linear velocity that a powered wheelchair can reach. How can I do that?
Here's the code of how I publish the velocity: (this is just an example, I don't want to set the linear velocity to 1.4m/s, I want that the maximum velocity reachable is 1.4 m/s)
ros::Publisher vel_pub_=n.advertise<geometry_msgs::Twist>("cmd_vel", 1);
(...)
vel.linear.x=1.4;
vel.angular.z+=M_PI/8;
vel_pub_.publish(vel);
can you describe more
+bvbdort Hi want to limit the max linear velocity. I am new to ROS and I don't know which topic should I publish or with what parameter can I limit the linear velocity.
Divide your 'linear.x' by a factor in the Twist message that you send to /command_velocity or cmd_vel. Or limit your linear.x
please post your code how you are publishing your linear velocity.
+McMurdo divide linear.c by what factor?? I want to limit my linear velocity (linear.x) just like you said, but I don't know how, please explain it to me... +bvbdort I'll post the code now!
`linear.x` is zero in the code you posted. I don't know how you want to limit that more.
If you just want to enforce a max velocity, check the value of vel.linear.x and change it if it is too large. If you want to scale the velocity to another range, that can be done in one line - see http://stackoverflow.com/questions/929103/convert-a-number-range-to-another-range-maintaining-ratio
+dornhege This was just an example of how I publish the velocity. I want to limit the maximum linear velocity of the wheelchair. I want that, no matter which part of my code is executing, the maximum velocity that the power wheelchair user can reach (joystick is the HMI) is for example 1.4m/s!