-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add resolution divider option to turn more #8
base: gripper-v6-devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,9 @@ def __init__(self, dxl_io, controller_namespace, port_namespace): | |
JointController.__init__(self, dxl_io, controller_namespace, port_namespace) | ||
|
||
self.motor_id = rospy.get_param(self.controller_namespace + '/motor/id') | ||
self.resolution_divider = rospy.get_param(self.controller_namespace + '/motor/resolution_divider', 1) | ||
self.dxl_io.set_resolution_divider(self.motor_id, self.resolution_divider) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should write this to all other controllers because default dynamixel_io.py considers resolution_divider as 1, which causes error when we use a motor having resolution_divider other than 1 with a controller other than joint_position_controller. |
||
|
||
self.initial_position_raw = rospy.get_param(self.controller_namespace + '/motor/init') | ||
self.min_angle_raw = rospy.get_param(self.controller_namespace + '/motor/min') | ||
self.max_angle_raw = rospy.get_param(self.controller_namespace + '/motor/max') | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -68,6 +68,7 @@ def __init__(self, port, baudrate, readback_echo=False): | |||||||||||||||||||||||||||||||||||||||||||||||
self.port_name = port | ||||||||||||||||||||||||||||||||||||||||||||||||
self.readback_echo = readback_echo | ||||||||||||||||||||||||||||||||||||||||||||||||
self.ignored_errors = {} | ||||||||||||||||||||||||||||||||||||||||||||||||
self.resolution_divider = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
except SerialOpenError: | ||||||||||||||||||||||||||||||||||||||||||||||||
raise SerialOpenError(port, baudrate) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -416,6 +417,7 @@ def set_resolution_divider(self, servo_id, divider): | |||||||||||||||||||||||||||||||||||||||||||||||
response = self.write(servo_id, DXL_RESOLUTION_DIVIDER, [divider]) | ||||||||||||||||||||||||||||||||||||||||||||||||
if response: | ||||||||||||||||||||||||||||||||||||||||||||||||
self.exception_on_error(response[4], servo_id, 'setting resolution divider to %d' % divider) | ||||||||||||||||||||||||||||||||||||||||||||||||
self.resolution_divider = divider | ||||||||||||||||||||||||||||||||||||||||||||||||
return response | ||||||||||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||||||||||
raise UnsupportedFeatureError(model, DXL_RESOLUTION_DIVIDER) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -1018,6 +1020,7 @@ def get_feedback(self, servo_id): | |||||||||||||||||||||||||||||||||||||||||||||||
position = response[11] + (response[12] << 8) | ||||||||||||||||||||||||||||||||||||||||||||||||
if position & 0x8000: | ||||||||||||||||||||||||||||||||||||||||||||||||
position += -0x10000 | ||||||||||||||||||||||||||||||||||||||||||||||||
position = position * self.resolution_divider | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I'm not confident about this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes this is ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ごめんなさい、もっと詳しく教えてほしいんですが、なんで合わないんでしょうか。
を教えてください。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://www.besttechnology.co.jp/modules/knowledge/?MX%20Series%20Control%20table#hceb4e38 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
まず、besttechnologyのドキュメントにおける「真の位置フィードバック値」は「get_feedback関数の返り値」のことではないと思います。 いったん理屈上で考えてみます。 以上を踏まえた上で、besttechnologyのドキュメントですが、「真の位置フィードバック値を本値で乗じた値がPresent Positionに現れます」とありますが、「乗じた」ではなくて「除した」の誤りなのではないかと思います。 で、
の現象についてですが、僕が怪しいと思っているのは、radian単位のrostopicで受け取った司令値をgoal_postionに変換したり、present_positionをradian単位のrostopicに変換する部分です。 dynamixel_motor/dynamixel_controllers/src/dynamixel_controllers/joint_position_controller.py Lines 194 to 197 in 7d10df4
dynamixel_motor/dynamixel_controllers/src/dynamixel_controllers/joint_position_controller.py Lines 119 to 122 in 7d10df4
dynamixel_motor/dynamixel_controllers/src/dynamixel_controllers/joint_controller.py Lines 173 to 178 in 7d10df4
dynamixel_motor/dynamixel_controllers/src/dynamixel_controllers/joint_position_controller.py Line 180 in 7d10df4
dynamixel_motor/dynamixel_controllers/src/dynamixel_controllers/joint_controller.py Lines 180 to 181 in 7d10df4
ここで使ってる RADIANS_PER_ENCODER_TICK やENCODER_TICKS_PER_RADIAN はrosparamで取ってきていて、dynamixel_motor/dynamixel_controllers/src/dynamixel_controllers/joint_position_controller.py Lines 80 to 81 in 7d10df4
このrosparamは以下で設定されています。 dynamixel_motor/dynamixel_driver/src/dynamixel_driver/dynamixel_serial_proxy.py Lines 155 to 158 in 7d10df4
この値をresolution_dividerに応じて変えるのが正しいのではないでしょうか。 なぜなら、例えばresolution_dividerが2になると、goal_positionが1変わった時の角度変化は2倍になるからです。 |
||||||||||||||||||||||||||||||||||||||||||||||||
error = position - goal | ||||||||||||||||||||||||||||||||||||||||||||||||
speed = response[13] + ( response[14] << 8) | ||||||||||||||||||||||||||||||||||||||||||||||||
if speed > 1023: speed = 1023 - speed | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be before
self.set_torque_enable(False)
at least becauseself.set_torque_enable(False)
makes motor torque off.If init_pos is taken after that, init_pos may be different from limit position.
And
self.set_torque_enable(False)
cannot be deleted for my gripper because keeping torque on around limit makes the timing belt slipped.I'm not sure whether this line should be after
self.__set_speed_wheel(0.0)
.If you can find another solution which does not change the original function order, I'm happy.