mirror of
https://github.com/YikeStone/ros_arduino_bridge.git
synced 2025-08-03 19:24:09 +05:30
Backed out changes that were accidently checked into hbrobotics repository. Explaination: I am president of Homebrew Roboics, so I am also an 'owner' of the hbrobotics repository. By accident, I checked in some untested changes into the hbrobotics web site, when I thought I was checking them into a staging repository. Me bad. This should get us back to the way we were at pull request #18.
This commit is contained in:
parent
1d43339c00
commit
8963ce8c59
@ -22,8 +22,6 @@ base_frame: base_link
|
|||||||
#encoder_resolution: 8384 # from Pololu for 131:1 motors
|
#encoder_resolution: 8384 # from Pololu for 131:1 motors
|
||||||
#gear_reduction: 1.0
|
#gear_reduction: 1.0
|
||||||
#motors_reversed: True
|
#motors_reversed: True
|
||||||
#left_motor_reversed: True
|
|
||||||
#right_motor_reversed: True
|
|
||||||
|
|
||||||
# === PID parameters
|
# === PID parameters
|
||||||
#Kp: 10
|
#Kp: 10
|
||||||
|
@ -49,9 +49,6 @@ class Arduino:
|
|||||||
self.encoder_count = 0
|
self.encoder_count = 0
|
||||||
self.writeTimeout = timeout
|
self.writeTimeout = timeout
|
||||||
self.interCharTimeout = timeout / 30.
|
self.interCharTimeout = timeout / 30.
|
||||||
self.motors_reversed = False
|
|
||||||
self.left_motor_reversed = False
|
|
||||||
self.right_motor_reversed = False
|
|
||||||
|
|
||||||
# Keep things thread safe
|
# Keep things thread safe
|
||||||
self.mutex = thread.allocate_lock()
|
self.mutex = thread.allocate_lock()
|
||||||
@ -95,12 +92,6 @@ class Arduino:
|
|||||||
'''
|
'''
|
||||||
self.port.close()
|
self.port.close()
|
||||||
|
|
||||||
def motors_configure(self, motors_reversed = False,
|
|
||||||
left_motor_reversed = False, right_motor_reversed = False):
|
|
||||||
self.motors_reversed = motors_reversed
|
|
||||||
self.left_motor_reversed = left_motor_reversed
|
|
||||||
self.right_motor_reversed = right_motor_reversed
|
|
||||||
|
|
||||||
def send(self, cmd):
|
def send(self, cmd):
|
||||||
''' This command should not be used on its own: it is called by the execute commands
|
''' This command should not be used on its own: it is called by the execute commands
|
||||||
below in a thread safe manner.
|
below in a thread safe manner.
|
||||||
@ -276,12 +267,6 @@ class Arduino:
|
|||||||
raise SerialException
|
raise SerialException
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
if self.motors_reversed:
|
|
||||||
values[0], values[1] = values[1], values[0]
|
|
||||||
if self.left_motor_reversed:
|
|
||||||
values[0] = -values[0]
|
|
||||||
if self.right_motor_reversed:
|
|
||||||
values[1] = -values[1]
|
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def reset_encoders(self):
|
def reset_encoders(self):
|
||||||
@ -292,13 +277,6 @@ class Arduino:
|
|||||||
def drive(self, right, left):
|
def drive(self, right, left):
|
||||||
''' Speeds are given in encoder ticks per PID interval
|
''' Speeds are given in encoder ticks per PID interval
|
||||||
'''
|
'''
|
||||||
if self.left_motor_reversed:
|
|
||||||
left = -left
|
|
||||||
if self.right_motor_reversed:
|
|
||||||
right = -right
|
|
||||||
if self.motors_reversed:
|
|
||||||
left, right = right, left
|
|
||||||
|
|
||||||
return self.execute_ack('m %d %d' %(right, left))
|
return self.execute_ack('m %d %d' %(right, left))
|
||||||
|
|
||||||
def drive_m_per_s(self, right, left):
|
def drive_m_per_s(self, right, left):
|
||||||
|
@ -50,10 +50,7 @@ class BaseController:
|
|||||||
|
|
||||||
self.accel_limit = rospy.get_param('~accel_limit', 0.1)
|
self.accel_limit = rospy.get_param('~accel_limit', 0.1)
|
||||||
self.motors_reversed = rospy.get_param("~motors_reversed", False)
|
self.motors_reversed = rospy.get_param("~motors_reversed", False)
|
||||||
self.left_motor_reversed = rospy.get_param("~left_motor_reversed", False)
|
|
||||||
self.right_motor_reversed = rospy.get_param("~right_motor_reversed", False)
|
|
||||||
arduino.motors_configure(self.motors_reversed, self.left_motor_reversed, self.right_motor_reversed)
|
|
||||||
|
|
||||||
# Set up PID parameters and check for missing values
|
# Set up PID parameters and check for missing values
|
||||||
self.setup_pid(pid_params)
|
self.setup_pid(pid_params)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user