A practice on Ros path planning and navigation
- Using actionlib::SimpleActionClient to send instruct(goal pose) to the robot to move.
- Subscribe topic(odom) to check the the location of robot only on pick_object node.
- However, the goal pose is not the same as the pose from odom topic - always different. As a compromise, I prefer to trust odom's data.
- Register a doneCallback function for action client so that we know when the action finish.
- Regard the robot has reached the goal(pick up zone or drop off zone), if either action client's doneCallback occur or the pose from odom topic close to(buffer) goal's pose.
- Node pick_object maintain the state to control the whole process.
- The key point is to synchronize the action between add_marker and pick_object. I have tried using a topic , but finally choose a service as I do need a response.
So, the complete procedure as below. I indicate all the actions by different states which can be found in the programme:
- On node pick_objects: init register subscriber to topic /odom, init a action client for moving the base and a service client to communicate with node add_markers
- On the node add_markers, init a service server to communicate with pick_objects node, and init a publisher for simulating pickup/dropoff action by show/hide virtual objects in RViz.
- add_markers set a default place for the virtual object.
- pick_object set a pickup goal for robot.
- state => ON_THE_WAY_TO_PICKUP_ZONE
- pick_object continuously check the pose postion from topic /odom
- If robot arrives the pick up zone(either from topic odom callback or from action client doneCallback), send a request to add_markers to hide the object
- Set state => START_PICKING_UP
- when add_markers receives the request from pick_objects, it start to hide the object, wait for 5 seconds(like a real picking action), then send the response back to pick_objects node.
- when pick_object receive the response (hide action done), state => FINISH_PICKING_UP
- pick_objects set drop off goal for robot
- state =>ON_THE_WAY_TO_DROPOFF_ZONE
- pick_object continuously checks the pose postion from topic /odom, like ON_THE_WAY_TO_PICKUP_ZONE.1.
- Like ON_THE_WAY_TO_PICKUP_ZONE.2 when robot arrives the drop off zone, send another request to add_markers to show the object at the drop off place
- state => START_DROPPING_OFF
- add_markers show the object, wait for 5 seconds, and send back the response
- pick_objects receives the response and set state => FINISH_DROPPING_OFF.
- print "job done" and state => END
PS. I use turtlebot for this project.
├── # Official ROS packages
|
├── slam_gmapping # gmapping_demo.launch file
│ ├── gmapping
│ ├── ...
├── turtlebot # keyboard_teleop.launch file
│ ├── turtlebot_teleop
│ ├── ...
├── turtlebot_interactions # view_navigation.launch file
│ ├── turtlebot_rviz_launchers
│ ├── ...
├── turtlebot_simulator # turtlebot_world.launch file
│ ├── turtlebot_gazebo
│ ├── ...
├── # My packages and direcotries
|
├── map # map files
│ ├── ...
├── scripts # shell scripts files
│ ├── ...
├──rvizConfig # rviz configuration files
│ ├── ...
├──pick_objects # pick_objects C++ node
│ ├── src/pick_objects.cpp
│ ├── ...
├──add_markers # add_marker C++ node
│ ├── src/add_markers.cpp
│ ├── ...
└──