示例#1
0
'''
# brief : This file is speed script for roboclaw driver.
# @author : koji kawabata
# @date : 2019/10/23
'''

import time
import signal
import sys
import roboclaw_driver.roboclaw_driver as rc

rc.Open('/dev/ttyACM0', 115200)
address = 0x80
rc.ForwardMixed(address, 0)
rc.TurnRightMixed(address, 0)
print("run speed command")
try:
    rc.SpeedM1(address, 300)
    time.sleep(2)
    rc.SpeedM2(address, 300)
    time.sleep(2)
    rc.SpeedM1M2(address, 150, 150)
    time.sleep(2)

    rc.SpeedM1(address, -300)
    time.sleep(2)
    rc.SpeedM2(address, -300)
    time.sleep(2)
    rc.SpeedM1M2(address, -150, -150)
    time.sleep(2)
    rc.SpeedM1M2(address, 0, 0)
示例#2
0
reading from the keyboard for PWM control
-------------------------------------------
     KeyBoard
	w
     a     d
	s

e : force stop
Ctrl-c to quit
-------------------------------------------
"""
rc.Open('/dev/ttyACM0', 115200)
address = 0x80
pwm = 32
rc.ForwardMixed(address, 0)
rc.TurnRightMixed(address, 0)
kb = KBHit()


def handler(signal, frame):
    rc.ForwardMixed(address, 0)
    rc.TurnRightMixed(address, 0)
    print('Finish')
    sys.exit(0)


print(msg)
signal.signal(signal.SIGINT, handler)
try:
    while True:
        if kb.kbhit():
示例#3
0
def handler(signal, frame):
    rc.ForwardMixed(address, 0)
    rc.TurnRightMixed(address, 0)
    print('Finish')
    sys.exit(0)
def handler(signal, frame):
    rc.ForwardMixed(address, 0)
    rc.TurnRightMixed(address, 0)
    file.close()
    print('Fin')
    sys.exit(0)