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)



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值