I am a beginner at ROS and ROS navigation stack.
I have been using `roomba_500_series` and navigation stack (including `move_base` module). I would like to subscribe `/bumper` topic in move_base. The topic type of /bumper is `roomba_500_series/Bumper`. I can already use bumper data by using `kobuki_bumper2pc`. However I want to use the data in `move_base` one way or another.
First of all, I would like to try to turn rommba left when the right bumper is true after publishing /cmd_vel. I modified `move_base.cpp` like below.
`move_base.cpp` (line: 902~) [link text](https://github.com/ros-planning/navigation/blob/e538b4f4624c7f757d4868e5200ba8f8904a0d94/move_base/src/move_base.cpp#L902)
//make sure that we send the velocity command to the base
vel_pub_.publish(cmd_vel);
//***modified part
bump_sensor_sub_ = nh.subscribe("/bumper", 1000, &MoveBase::BumperSensorCB, this);
if (right_bumper==1){
publishZeroVelocity();
while(right_bumper==1){
cmd_vel.linear.x = 0.0;
cmd_vel.linear.y = 0.0;
cmd_vel.angular.z = 0.78;
vel_pub_.publish(cmd_vel);
bump_sensor_sub_ = nh.subscribe("/bumper", 1000, &MoveBase::BumperSensorCB, this);
}
} //***
function `MoveBase::BumperSensorCB` which I made
void MoveBase::BumperSensorCB(const roomba_500_series::Bumper::ConstPtr& msg)
{
left_bumper = msg->left.state;
right_bumper = msg->right.state;
}
`right_bumper` & `left_bumper` are boolean data type
bool right_bumper, left_bumper;
I modified move_base.cpp as noted above. However roomba doesn't work as I thought. It seems like `MoveBase` can't subscribe `/bumper` topic now. Although, the cause might be `CMakeLists.txt` , I have no idea how to modify it to use `/bumper` topic from `roomba_500_series`.
Sorry that was such a long post and my poor English.
I would appreciate it if you could answer my question.
Thank you.
↧