jsk-ros-pkg / jsk_aerial_robot

The platfrom for aerial robot (e.g. general multirotor, hydrus, di, dragon, etc)
http://www.jsk.t.u-tokyo.ac.jp/index-j.html
34 stars 34 forks source link

[Spinal][Neuron][Servo] solve the joint pulley round offset problem #534

Closed tongtybj closed 2 years ago

tongtybj commented 2 years ago

What is this

This PR can compensate the round offset between servo and joint.

Detail

The joint pulley may make an undesired round offset between servo abs encoder and joint real angle. For example, in case of a pulley ratio of 1:2 (servo:joint), the servo encoder need a true value over 360 deg for joint angle with more than 180 deg. But the abs encoder can only have an initial value around 0~360 deg, which means the abs encoder will give a very small initial value theta for joint angle more than 180 deg.

This PR enables manual compensation by user with rosservice of Spinal/SetBoardConfig. Command ID is 11, and the command data should be [slave_id, servo_index, compensate_servo_angle].

We also provide an automatic compensate code:

$ rosrun spinal servo_rough_calib.py

This will automatically find the initial joint (servo) angles from the Servo.yaml. The joint angle in simualtion (e.g., https://github.com/jsk-ros-pkg/jsk_aerial_robot/blob/master/robots/dragon/config/quad/Servo.yaml#L32-L33) will be used to compensate the pully round offset.

tongtybj commented 2 years ago

Also refactor the homing_offset calibration for dynamixel servo in 006497b. The core process is

https://github.com/jsk-ros-pkg/jsk_aerial_robot/blob/def5c91cabb3b07e574c1ceb4c13220e936b8dab/aerial_robot_nerve/neuron/neuronlib/Servo/Dynamixel/dynamixel_serial.cpp#L132-L151

https://github.com/jsk-ros-pkg/jsk_aerial_robot/blob/def5c91cabb3b07e574c1ceb4c13220e936b8dab/aerial_robot_nerve/neuron/neuronlib/Servo/Dynamixel/dynamixel_serial.h#L306

tongtybj commented 2 years ago

@Takuzumi240

Please have a glance at this PR, which sends a command about joint servo from ROS to Spinal (via rosserial), then Spinal to Neuron (via CAN).