Skip to content

Commit

Permalink
Experimental Roboteq driver
Browse files Browse the repository at this point in the history
Sights v1 is end of life?? no
  • Loading branch information
Conr86 committed Jun 20, 2021
1 parent c135fd7 commit af1f2c2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/motors/roboteq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from motor_wrapper import MotorWrapper
import serial
import logging

class RoboteqConnection(MotorWrapper):
# What type of motor this wrapper handles
type_ = 'roboteq'

def __init__(self, config):
MotorWrapper.__init__(self, config)
from PyRoboteq import RoboteqHandler
from PyRoboteq import roboteq_commands as cmds

self.port = config.get('port')
self.controller = RoboteqHandler(debug_mode = True, exit_on_interrupt = False)
self.is_connected = self.controller.connect(self.port)
self.channels = config.get('channels')
try:
self.channels.get('left')
self.channels.get('right')
except AttributeError:
self.channels['left'] = 1
self.channels['right'] = 0

def move_raw(self, left=None, right=None):
# Left side
if left is not None:
self.controller.send_command(SET_SPEED, self.channels.get('left'), abs(round(1000 / 1024 * left)))
# Right side
if right is not None:
self.controller.send_command(SET_SPEED, self.channels.get('right'), abs(round(1000 / 1024 * right)))

def stop(self):
self.controller.send_command(cmds.DUAL_DRIVE, 0, 0)

def close(self):
print("Not implemented")

0 comments on commit af1f2c2

Please sign in to comment.