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:

    def set_operation_mode(self,req):
        if not self.robot.sci:
            rospy.logwarn("Create : robot not connected yet, sci not available")
            return SetTurtlebotModeResponse(False)

        self.operate_mode = req.mode

        if req.mode == 1: #passive
            rospy.logwarn("about to run passive mode, 1s...")
            rospy.sleep(1.0)
            self._robot_run_passive()
        elif req.mode == 2: #safe
            rospy.logwarn("about to run safe mode, 1s...")
            rospy.sleep(1.0)
            self._robot_run_safe()
        elif req.mode == 3: #full
            rospy.logwarn("about to run full mode, 1s...")
            rospy.sleep(1.0)  #wait 1s so I can use Ctrl+C to halt it when I hope to charge my ROOMBA
            self._robot_run_full()
        else:
            rospy.logwarn("Requested an invalid mode.")
            return SetTurtlebotModeResponse(False)
        return SetTurtlebotModeResponse(True)



你可能感兴趣的:(ROS 进阶学习笔记(14) - About driving your iRobot Roomba/Create)