コード例 #1
0
    def __init__(self):
        self.chairbot_number = chairbot_number()
        self.teleop_node_name = 'teleop' + self.chairbot_number
        self.chairmovement_topic_name = 'chairMovement' + self.chairbot_number
        self.cbon_topic_name = 'cbon' + self.chairbot_number
        
        rospy.init_node(self.teleop_node_name)

        self.port = rospy.get_param('~port1 ', "/dev/ttyACM0")
        rospy.loginfo("Using port: %s"%(self.port))

        self.robot = Botvac(self.port)
    
        rospy.loginfo("Object is successfully init")
        rospy.Subscriber(self.chairmovement_topic_name, Twist, self.twist_handler, queue_size=10)
        rospy.Subscriber(self.cbon_topic_name, Int8, self.cbon, queue_size=10)
        self.latest_twist = Twist() # crete an empty twist packet
    
        self.SPEED = 150
        self.DIST = 20
        self.lastx = 0
        self.lasty = 0
        self.xramp = 0
        self.yramp = 0
        self.status = False
コード例 #2
0
    def __init__(self):
        """ Start up connection to the Neato Robot. """
        rospy.init_node('neato')

        self.port = rospy.get_param('~port', "/dev/ttyUSB0")
        self.lds = rospy.get_param('~lds', True)
        rospy.loginfo("Using port: %s" % self.port)

        self.robot = Botvac(self.port, self.lds)

        rospy.Subscriber("cmd_dist", Movement, self.cmdMovementCb)
        self.scanPub = rospy.Publisher('base_scan', LaserScan, queue_size=1)
        self.odomPub = rospy.Publisher('odom', Odometry, queue_size=1)
        self.buttonPub = rospy.Publisher('button', Button, queue_size=1)
        self.sensorPub = rospy.Publisher('sensor', Sensor, queue_size=1)
        self.accelerationPub = rospy.Publisher('acceleration',
                                               Vector3Stamped,
                                               queue_size=1)
        self.wallPub = rospy.Publisher('wall', Range, queue_size=1)
        self.drop_leftPub = rospy.Publisher('drop_left', Range, queue_size=1)
        self.drop_rightPub = rospy.Publisher('drop_right', Range, queue_size=1)
        self.magneticPub = rospy.Publisher('magnetic', Sensor, queue_size=1)
        self.odomBroadcaster = TransformBroadcaster()

        rospy.Service('set_info_led', SetLed, self.setInfoLed)
        rospy.Service('play_sound', PlaySound, self.playSound)
        rospy.Service('set_lds', SetBool, self.setLDS)

        self.cmd_vel = 0
        self.cmd_dist = [0, 0]
        self.old_dist = self.cmd_dist
        self.encoders = [0, 0]
コード例 #3
0
ファイル: new_default.py プロジェクト: charisma-lab/chairbot
    def __init__(self):
        """ Start up connection to the Neato Robot. """
        rospy.init_node('teleop04', anonymous=True)

        self.port = rospy.get_param('~port1 ', "/dev/ttyACM1")
        rospy.loginfo("Using port: %s"%(self.port))

        self.robot = Botvac(self.port)

        rospy.Subscriber("/joy04", Joy, self.joy_handler, queue_size=10)
        rospy.Subscriber("/cbon04", Int8, self.cbon04, queue_size=10)
        rospy.Subscriber('/touches04', Int8, self.touch_handler, queue_size=10)
        self.Axess = (-0.0, -0.0, 1.0, -0.0, -0.0, 1.0, -0.0, -0.0)
        self.Butt = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        self.SPEED = 0
        self.DIST = 20
        self.SPEEDSET = 0
        self.SPEEDRAMP = 0
        self.lastx = 0
        self.lasty = 0
        self.xramp = 0
        self.yramp = 0
        self.touch_number = -1
        self.touch0 = False
        self.touch1 = False
        self.touch2 = False
        self.touch3 = False
        self.touch4 = False
        self.touch5 = False
        self.touch6 = False
        self.touch7 = False
        self.touch8 = False
コード例 #4
0
    def __init__(self):
        """ Start up connection to the Neato Robot. """
        rospy.init_node('neato')

        self.CMD_RATE = 2

        self.port = rospy.get_param('~port', "/dev/ttyUSB0")
        rospy.loginfo("Using port: %s" % self.port)

        self.odom_topic = rospy.get_param('~odom_topic', "odom")
        self.dist_topic = rospy.get_param('~dist_topic', "dist")
        self.cmd_vel_topic = rospy.get_param('~cmd_vel_topic', "cmd_vel")
        self.base_frame = rospy.get_param('~base_frame', "base_link")
        self.odom_frame = rospy.get_param('~odom_frame', "odom")

        self.cmd_angle_instead_rotvel = rospy.get_param(
            '~cmd_angle_instead_rotvel', False)
        self.wheelbase = rospy.get_param('~wheelbase', 1)

        self.robot = Botvac(self.port)

        rospy.Subscriber(self.cmd_vel_topic, Twist, self.cmdVelCb)
        #        self.scanPub = rospy.Publisher('base_scan', LaserScan, queue_size=10)
        self.odomPub = rospy.Publisher(self.odom_topic,
                                       Odometry,
                                       queue_size=10)
        self.distPub = rospy.Publisher(self.dist_topic,
                                       Vector3Stamped,
                                       queue_size=10)
        #        self.buttonPub = rospy.Publisher('button', Button, queue_size=10)
        #        self.sensorPub = rospy.Publisher('sensor', Sensor, queue_size=10)
        self.odomBroadcaster = TransformBroadcaster()
        self.cmd_vel = [0, 0]
        self.old_vel = self.cmd_vel
コード例 #5
0
    def __init__(self):
        """ Start up connection to the Neato Robot. """
        rospy.init_node('neato')

        self.port = rospy.get_param('~port', "/dev/neato")
        rospy.loginfo("Using port: %s" % (self.port))

        self.robot = Botvac(self.port)

        rospy.Subscriber("cmd_vel", Twist, self.cmdVelCb)
        self.scanPub = rospy.Publisher('scan', LaserScan, queue_size=10)
        self.odomPub = rospy.Publisher('odom', Odometry, queue_size=10)
        self.odomBroadcaster = TransformBroadcaster()

        self.cmd_vel = [0, 0]
コード例 #6
0
ファイル: dominant03.py プロジェクト: charisma-lab/chairbot
    def __init__(self):
        """ Start up connection to the Neato Robot. """
        rospy.init_node('teleop03', anonymous=True)

        self.port = rospy.get_param('~port', "/dev/ttyACM0")
        rospy.loginfo("Using port: %s" % (self.port))

        self.robot = Botvac(self.port)

        rospy.Subscriber("/joy03", Joy, self.joy_handler, queue_size=10)

        self.Axess = (-0.0, -0.0, 1.0, -0.0, -0.0, 1.0, -0.0, -0.0)
        self.Butt = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        self.SPEED = 0
        self.DIST = 20
        '''
コード例 #7
0
ファイル: generate_manual.py プロジェクト: keroe/neato_robot
def readCommandsFromNeato():
    port = rospy.get_param('~port', "/dev/ttyACM0")
    robot = Botvac(port)
    doc = ""
    commands = robot.getAllCommands()
    for c in commands:
        com = robot.getCommandDescription(c)
        doc += "### " + com.command + "\n\n"
        doc += "**Description:** " + com.description  + "\n\n"
        if len(com.arguments) > 0:
            doc += "**Options:** \n\n| Flag | Description |\n|------|-------------|\n"
            for arg in com.arguments:
                doc += "| " + arg + " | "  + com.arguments[arg] + " |\n"
            doc += "\n\n"
    robot.exit()
    return doc
コード例 #8
0
ファイル: neato.py プロジェクト: anatolykabakov/neato_robot
    def __init__(self):
        """ Start up connection to the Neato Robot. """
        rospy.init_node('neato')

        self.CMD_RATE =2 

        self.port = rospy.get_param('~port', "/dev/ttyACM0")
        rospy.loginfo("Using port: %s" % self.port)

        self.robot = Botvac(self.port)

        rospy.Subscriber("cmd_vel", Twist, self.cmdVelCb)
        self.scanPub = rospy.Publisher('scan', LaserScan, queue_size=10)
        self.odomPub = rospy.Publisher('odom', Odometry, queue_size=10)
        #self.buttonPub = rospy.Publisher('button', Button, queue_size=10)
        #self.sensorPub = rospy.Publisher('sensor', Sensor, queue_size=10)
        self.odomBroadcaster = TransformBroadcaster()
        self.cmd_vel = [0, 0]
        self.old_vel = self.cmd_vel