Hi,
I'm trying to subscribe to turtlebotSensorState to get bumps_wheeldrops. I think I've done everything right but in gazebo simulator when the robot hits an object it's not stopping. below is my codes, any help is appreciated. Also,it doesn't matter that I put the callback before main, does it?
#include turtlebot_node/TurtlebotSensorState.h>
#include ros/rate.h>
void callback01(const turtlebot_node::TurtlebotSensorState::ConstPtr& msg){
turtlebot_node::TurtlebotSensorState bumperState = msg->bumps_wheeldrops;
}
//this part goes to main:
ros::Subscriber sens_sub_ = n.subscribe<turtlebot_node::TurtlebotSensorState>("sensor_state", 1000, callback01);
ros::Rate loop_rate(10);
while (ros::ok()){
if (bumperState !=0){
publish (0,0);
}else
publish(angular_,linear_):
loop_rate.sleep();
ros::spin();
}
Originally posted by Arash on ROS Answers with karma: 11 on 2012-08-27
Post score: 0