ROS 进阶学习笔记(14) - About driving your iRobot Roomba-Create
ROS 进阶学习笔记(14) - About driving your iRobot Roomba/Create
There are several iRobot ROOMBA/CREATE drivers in ROS community, by May 2016, the newest one sholuld be thecreate_autonomy . Here we only discuss about the one used by the book " ROS by Example _ hydro _ vol1 “.
这篇文章主要介绍使用下面的Create驱动上电不能充电问题。至于另2篇介绍iRobot Roomba作底盘驱动的博客参考:
http://blog.csdn.net/sonictl/article/details/49908949
http://blog.csdn.net/sonictl/article/details/50207949
There are two important script file you may usually need to edit/check: turtlebot_node.py & create_driver.py
The turtlebot_node.py is starting a ROS node for controlling your turtlebot base, i.e, the iRobot Roomba® or iRobot Create®.
The create_driver.py is a lower-level driver for driving your iRobot Roomba® or iRobot Create®.
The are working like this:
[Your other control message/topic sending nodes] —-» [turtlebot_node.py] —-» [create_driver.py]
Path:
/opt/ros/hydro/lib/create_node/turtlebot_node.py
/opt/ros/hydro/lib/python2.7/dist-packages/create_driver/create_driver.py
Enjoy :)
About turtlebot_node.py, edit the set_operation_mode() function as below:
1. def set_operation_mode(self,req):
2. if not self.robot.sci:
3. rospy.logwarn("Create : robot not connected yet, sci not available")
4. return SetTurtlebotModeResponse(False)
5.
6. self.operate_mode = req.mode
7.
8. if req.mode == 1: #passive
9. rospy.logwarn("about to run passive mode, 1s...")
10. rospy.sleep(1.0)
11. self._robot_run_passive()
12. elif req.mode == 2: #safe
13. rospy.logwarn("about to run safe mode, 1s...")
14. rospy.sleep(1.0)
15. self._robot_run_safe()
16. elif req.mode == 3: #full
17. rospy.logwarn("about to run full mode, 1s...")
18. rospy.sleep(1.0) #wait 1s so I can use Ctrl+C to halt it when I hope to charge my ROOMBA
19. self._robot_run_full()
20. else:
21. rospy.logwarn("Requested an invalid mode.")
22. return SetTurtlebotModeResponse(False)
23. return SetTurtlebotModeResponse(True)
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)