-
Notifications
You must be signed in to change notification settings - Fork 14.4k
UAVCAN servo feedback added #19822
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
base: main
Are you sure you want to change the base?
UAVCAN servo feedback added #19822
Conversation
Minor style failure in CI (run make check_format locally). https://github.com/PX4/PX4-Autopilot/runs/6986710557?check_suite_focus=true |
msg/servo_status.msg
Outdated
uint64 timestamp # time since system start (microseconds) | ||
uint8 CONNECTED_SERVO_MAX = 8 # The number of ESCs supported. Current (Q2/2013) we support 8 ESCs | ||
|
||
uint8 SERVO_CONNECTION_TYPE_PPM = 0 # Traditional PPM ESC |
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.
I would drop these until we actually need them, many of these connection types will never be real.
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.
Cool, I have dropped these.
msg/servo_report.msg
Outdated
@@ -0,0 +1,8 @@ | |||
uint64 timestamp # time since system start (microseconds) | |||
|
|||
float32 servo_position # feedback position of servo |
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.
Are there are units we can supply here?
msg/servo_report.msg
Outdated
|
||
float32 servo_position # feedback position of servo | ||
float32 servo_speed # feedback speed of servo | ||
float32 servo_force # force experienced by servo |
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.
Units?
Set to NAN if force not provided?
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.
Added units in latest commit. servo_force has been updated to servo_acceleration. More on this in the conversation section
msg/servo_report.msg
Outdated
float32 servo_force # force experienced by servo | ||
uint8 servo_id # id of servo | ||
uint8 servo_function # servo output function (one of Servo1...ServoN) | ||
|
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.
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.
Yes, Hitec provides a power rating, or a load percentage which the servo is experiencing. I have updated as such
This looks good and is fine for now if it solves your immediate needs, but longer term I was thinking about changing the interface a bit. Fundamentally we get status per available actuator asynchronously, so I think ultimately we should be publishing an instance of Separately I was also going to put together a more generic |
1603ebc
to
83552b3
Compare
Hitec provides a configuration app, to set many specifics of the servo such as: units of the feedback, max torque, max speed and more. So its possible that other servo manufacturers will send their feedback in other units resulting in the uorb topic definition to be incorrect. Remarks on power_rating_pct and force in the Dronecan message
Its not clear for me whether the force variable in the dronecan message is torque or acceleration. Here is a test bench log or here is a screenshot: If I press hard on the servo horn (between timestamp 40 and 50) we can see the load_pct increasing due to the load I am applying, however servo_acceleration stays close to zero, which tells me uavcan::equipment::actuator::Status::force is not a torque as mentioned in the definition. When I am sweeping the servo as seen from timestamp 50, the acceleration spikes during servo_speed changes and steadies at zero during constant speed. During this sweeping, we can also see load_pct is a non-zero constant. However I cannot confirm the acceleration values being logged, and might be coupled by another gain converting it to torque such as: |
Any comments? 😄 |
- Added same functionality that is seen for ESC's in UAVCAN as for servo's: * Added servo_report & servo_status similiar to that of esc_status and esc_report. * check for online servos * connection types - Tested with Hitec MD950 CAN servo. Work as excepted using the Actuator Tab in QGC. Updated units and feedback received Update format Style Conform to new uorb msg naming scheme
83552b3
to
edd8a3b
Compare
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.
A couple of ideas to make the message more informative and concise. The servos we're using report
- min/max/mid position
- current position
- torque
- voltage
- temperature
- failure
uint64 timestamp # time since system start (microseconds) | ||
|
||
float32 servo_position # feedback position of servo. [-1;1] | ||
float32 servo_speed # feedback speed of servo [deg/s] |
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.
Is it not enough to derive the speed from the position?
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.
yes true, but since the servo provides feedback about its speed, we should at least log it.
|
||
float32 servo_position # feedback position of servo. [-1;1] | ||
float32 servo_speed # feedback speed of servo [deg/s] | ||
float32 servo_acceleration # feedback of acceleration |
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.
Just curious, what would you use acceleration feedback for?
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.
We are not using it for something specific currently, but since the servo provides feedback about its acceleration, we should at least log it.
float32 servo_position # feedback position of servo. [-1;1] | ||
float32 servo_speed # feedback speed of servo [deg/s] | ||
float32 servo_acceleration # feedback of acceleration | ||
uint8 load_pct # Load percentage |
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.
Is this equal to Torque?
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.
I dont think so, because if I look at the graphs, during constant speed, load_pct is constant and my expectation would be a first order behavior for the torque.
It could be a constant current/torque for a given speed command, but not too sure.
Describe problem solved by this pull request
There is no feedback implemented for uavcan servo's
Describe your solution
Follow a close implementation of that of uavcan esc's:
servo_status
andservo_report
uorb messages and resembles that ofesc_status
andesc_report
uavcan::equipment::actuator::Status
message in the callback to fill in the feedback infoTest data / coverage
Additional context
The following is also added in the code comments at the relevant places:
The
check_servos_status()
function is only helpful if you have more than 1 UAVCAN servo connected, since if you have only one, and it gets disconnected, the callback function will not execute, thus not updating thecheck_servo_status()
functionThe timeout check in the
check_servo_status()
function can be too short for a given servo periodic stream rate, and may result in a servo being timeout. (untested)Make sure your ID number set on your uavcan servo is between 0-8 otherwise it wont be picked up here. (untested)
The above points is also applicable to the uavcan ESC's implementation. (untested)
Also added a similar implementation for the
mixerChanged()
method as that ofUavcanMixingInterfaceESC::mixerChangerd()
but not too sure of the implications.