I want to use all four range sensors of the Rosbot.
I did subscribe to all four range topics. Since each subsriber has its own callback function (one for fr, fl …) I would like to know how I can write a publisher to cmd_vel which uses all 4 range topics as its function input.
This may be a trivial problem, however I am stuck and help would be appreciated.
In main loop process the ranges and publish cmd_vel:
ros::Rate loop_rate(10);
while (ros::ok())
{
// Process ranges here
// place your output into cmd_vel_msg
cmd_vel_pub.publish(cmd_vel_msg);
ros::spinOnce();
loop_rate.sleep();
}