Changed min_angle to min_position and max_angle to max_position to allow for joint types other than servos

This commit is contained in:
Patrick Goebel 2015-12-17 16:17:25 -08:00
parent 1289091111
commit 489debcdd5
3 changed files with 9 additions and 9 deletions

View File

@ -51,6 +51,6 @@ sensors: {
# Joint name and configuration is an example only
joints: {
head_pan_joint: {pin: 3, init_position: 0, init_speed: 90, neutral: 90, min_angle: -90, max_angle: 90, invert: False, continous: False},
head_tilt_joint: {pin: 5, init_position: 0, init_speed: 90, neutral: 90, min_angle: -90, max_angle: 90, invert: False, continous: False}
head_pan_joint: {pin: 3, init_position: 0, init_speed: 90, neutral: 90, min_position: -90, max_position: 90, invert: False, continuous: False},
head_tilt_joint: {pin: 5, init_position: 0, init_speed: 90, neutral: 90, min_position: -90, max_position: 90, invert: False, continuous: False}
}

View File

@ -27,5 +27,5 @@ sensors: {
# Joint name and pin assignment is an example only
joints: {
head_pan_joint: {pin: 3, init_position: 30, init_speed: 90, neutral: 90, min_angle: -90, max_angle: 90, invert: False, continous: False}
head_pan_joint: {pin: 3, init_position: 30, init_speed: 90, neutral: 90, min_position: -90, max_position: 90, invert: False, continuous: False}
}

View File

@ -64,8 +64,8 @@ class Servo(Joint):
# Min/max/neutral values
self.neutral = radians(rospy.get_param(n + "neutral", 90.0)) # degrees
self.max_angle = radians(rospy.get_param(n + "max_angle", 90.0)) # degrees
self.min_angle = radians(rospy.get_param(n + "min_angle", -90.0)) # degrees
self.max_position = radians(rospy.get_param(n + "max_position", 90.0)) # degrees
self.min_position = radians(rospy.get_param(n + "min_position", -90.0)) # degrees
self.range = radians(rospy.get_param(n + "range", 180)) # degrees
self.max_speed = radians(rospy.get_param(n + "max_speed", 250.0)) # deg/s
@ -88,11 +88,11 @@ class Servo(Joint):
def command_cb(self, req):
# Check limits
if req.data > self.max_angle:
req.data = self.max_angle
if req.data > self.max_position:
req.data = self.max_position
if req.data < self.min_angle:
req.data = self.min_angle
if req.data < self.min_position:
req.data = self.min_position
# Adjust for the neutral offset
if self.invert: