mirror of
https://github.com/YikeStone/ros_arduino_bridge.git
synced 2025-08-05 20:14:07 +05:30
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:
parent
1289091111
commit
489debcdd5
@ -51,6 +51,6 @@ sensors: {
|
|||||||
|
|
||||||
# Joint name and configuration is an example only
|
# Joint name and configuration is an example only
|
||||||
joints: {
|
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_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_angle: -90, max_angle: 90, invert: False, continous: False}
|
head_tilt_joint: {pin: 5, init_position: 0, init_speed: 90, neutral: 90, min_position: -90, max_position: 90, invert: False, continuous: False}
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,5 @@ sensors: {
|
|||||||
|
|
||||||
# Joint name and pin assignment is an example only
|
# Joint name and pin assignment is an example only
|
||||||
joints: {
|
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}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ class Servo(Joint):
|
|||||||
|
|
||||||
# Min/max/neutral values
|
# Min/max/neutral values
|
||||||
self.neutral = radians(rospy.get_param(n + "neutral", 90.0)) # degrees
|
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.max_position = radians(rospy.get_param(n + "max_position", 90.0)) # degrees
|
||||||
self.min_angle = radians(rospy.get_param(n + "min_angle", -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.range = radians(rospy.get_param(n + "range", 180)) # degrees
|
||||||
self.max_speed = radians(rospy.get_param(n + "max_speed", 250.0)) # deg/s
|
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):
|
def command_cb(self, req):
|
||||||
# Check limits
|
# Check limits
|
||||||
if req.data > self.max_angle:
|
if req.data > self.max_position:
|
||||||
req.data = self.max_angle
|
req.data = self.max_position
|
||||||
|
|
||||||
if req.data < self.min_angle:
|
if req.data < self.min_position:
|
||||||
req.data = self.min_angle
|
req.data = self.min_position
|
||||||
|
|
||||||
# Adjust for the neutral offset
|
# Adjust for the neutral offset
|
||||||
if self.invert:
|
if self.invert:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user