def test_put_freq(self):
        pub = rospy.Publisher('/motor_raw', MotorFreqs)
        m = MotorFreqs()
        m.left_hz = 123 
        m.right_hz = 456 
        for i in range(10):
            pub.publish(m)
            time.sleep(0.1)

        self.file_check("rtmotor_raw_l0",m.left_hz,"wrong left value from motor_raw")
        self.file_check("rtmotor_raw_r0",m.right_hz,"wrong right value from motor_raw")
Beispiel #2
0
    def test_put_freq(self):
        pub = rospy.Publisher('/motor_raw', MotorFreqs)
        m = MotorFreqs()
        m.left_hz = 123 
        m.right_hz = 456 
        for i in range(10):
            pub.publish(m)
            time.sleep(0.1)

        self.file_check("rtmotor_raw_l0",m.left_hz,"wrong left value from motor_raw")
        self.file_check("rtmotor_raw_r0",m.right_hz,"wrong left value from motor_raw")
    def joy_callback(self, joy_msg):
        self.level = self.limitter(self.level)

        m = MotorFreqs()
        if joy_msg.buttons[0] == 1:
            m.left_hz = self.accel[self.level]
            m.right_hz = self.accel[self.level]
            self.motor_pub.publish(m)
        else:
            self.level = 0
            m.left_hz = 0
            m.right_hz = 0
            self.motor_pub.publish(m)
            return

        time.sleep(self.durat[self.level])
        self.level += 1