46 self.
last = rospy.Time.now()
80 import xml.dom.minidom
82 from math
import pi, radians
87 description = rospy.get_param(
"robot_description")
88 robot = xml.dom.minidom.parseString(description).getElementsByTagName(
'robot')[0]
91 for child
in robot.childNodes:
92 if child.nodeType
is child.TEXT_NODE:
94 if child.localName ==
'joint':
95 jtype = child.getAttribute(
'type')
98 name = child.getAttribute(
'name')
99 if jtype ==
'continuous':
103 limit = child.getElementsByTagName(
'limit')[0]
104 minval = float(limit.getAttribute(
'lower'))
105 maxval = float(limit.getAttribute(
'upper'))
107 if minval > 0
or maxval < 0:
108 zeroval = (maxval + minval)/2
112 joint = {
'min':minval,
'max':maxval,
'zero':zeroval,
'value':zeroval }
116 rospy.loginfo(
'No URDF defined, proceeding with defaults')
122 min_angle = radians(default_min)
123 max_angle = radians(default_max)
126 min_angle = joint_defaults[name][
'min']
130 min_angle = radians(rospy.get_param(
"/arbotix/dynamixels/"+name+
"/min_angle"))
134 min_angle = radians(rospy.get_param(
"/arbotix/joints/"+name+
"/min_angle"))
138 min_angle = rospy.get_param(
"/arbotix/joints/"+name+
"/min_position")
143 max_angle = joint_defaults[name][
'max']
147 max_angle = radians(rospy.get_param(
"/arbotix/dynamixels/"+name+
"/max_angle"))
151 max_angle = radians(rospy.get_param(
"/arbotix/joints/"+name+
"/max_angle"))
155 max_angle = rospy.get_param(
"/arbotix/joints/"+name+
"/max_position")
159 return (min_angle, max_angle)
Joints hold current values.
def getJointsFromURDF()
Get joint parameters from URDF.
def getJointLimits(name, joint_defaults, default_min=-150, default_max=150)
Get limits of servo, from YAML, then URDF, then defaults if neither is defined.
def __init__(self, device, name)
Constructs a Joint instance.
def interpolate(self, frame)
Get new output, in raw data format.
def getDiagnostics(self)
Get a diagnostics message for this joint.
def setCurrentFeedback(self, raw_data)
Set the current position from feedback data.
def setControlOutput(self, position)
Set the goal position.