-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Swift UAVCAN servo actuation #12984
Swift UAVCAN servo actuation #12984
Conversation
Syncing with upstream master
Co-authored-by: ksp-kirby <rkirby@kspresearch.com>
… get of UAVCAN servo parameters.
…, max, rate, and disarm value. Added support member variables and constexprs.
…utputs. Set disarmed actuator values. Populated uORB actuator out message.
Awesome! |
All checks were passed before last master merge. [px4.rosunit-pub_test/test_hz] [FAILURE] |
@PX4/testflights do you currently have a UAVCAN test vehicle? |
@dagar we tried with this PR but the vehicle does not arm, we get a message that one or more ESC's are not online. It doesn't detect them. We tried it with Master and vehicle arms and flies fine. |
@m1kelyons m1kelyons |
Hi! |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
We should try to keep this alive. @dagar |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
What is the status of this pr? I'm also very interested in being able to use UAVCAN servos! |
It needs to be rebased and tested. The per actuator configuration (and mixing) is where things got a little sidetracked last time. Do you have UAVCAN servos? Which model? |
I do have UAVCAN capable servos available. I currently have the HITEC MD950TW-CAN and pixhawk 2 to test with. I was looking into how the ESC is implemented to see if I could adapt that to work with the servos before I found this pull request. Given all the changes done to the mixing in the mean time, it might almost be worth it to start over while taking this PR as heavy inspiration, but that is just a gut feeling. |
We should be getting some UAVCAN servos soon so I'll try to find the bandwidth to take this for a spin. We have this in our roadmap but not necessarily short term but if we can get this working and merged sooner, the better. :) |
Sometimes the PX4 documentation is really confusing me. As far as I understand this PX4 does already support controlling Servos via UAVCAN. But the fact that this pull request exists and is not yet merged makes me believe that it is not yet possible. Can you shed some light into my dark here, @TSC21, @dagar ? |
PX4 supports UAVCAN ESCs, not Servos. I believe it is quite clear from that documentation page no? I guess this
is not 100% clear and could be
but other than that there's no other mention of servos in that page. Where else did you get that idea from, so that we can correct it. EDIT: Perhaps it is more clear with PX4/PX4-user_guide#1007 |
@RicardoM17 Obrigado pela sua resposta! Yes, exactly the sentence you quoted was one of the things, that made me believe that it works with actuators as well. Another thing is further down in the article there is a mention of UC4H's esc_actuator_node. This also makes it sound like it can be used for servos, too. Regardless of all this confusion: Did you already make any progress on this topic? As you mentioned before that you were going to test/work on it? EDIT: Your edit of the doc indeed makes it a lot more clear. Thanks. |
Not yet. The servo that I can use will be bought this week still. So I'm hoping to start with this next week, or worst case in two weeks I should be firing this. I've already started the rebase to get ahead of things. It was quite straightforward apart from the changes in |
@RicardoM17 Allright, this sounds good. If you need a collaborator feel free to contact me. I'd be willing to help you in your endeavors. I'm not sure if I can be much of a help since I am not yet very experienced with the whole PX4 stack, but I'd give it my best |
Thanks @max11gen I'll take that into account. Do you have any UAVCAN servos to test with? And if so what model? Let me know also if you are on the PX4 Slack as I might reach out to you there to coordinate. |
@RicardoM17 No, unfortunately I don't. I am planning to use NXP UCANS32K146 as a UAVCAN node and have them control my servos. Alternatively, I was considering to use Arduinos and build the UAVCAN nodes myself based on 107-Arduino-UAVCAN. The servos I have are FUTABA HPS A700 Air Servos. I am on slack. However, I just registered there at some point and haven't used it since. |
Thanks @RicardoM17 for updating the docs to reflect that servos not yet supported. When this goes in, can someone please remove that note in http://docs.px4.io/master/en/peripherals/uavcan_escs.html#uavcan-escs-motor-controllers - or raise an issue in the docs repo. |
Hi @hamishwillee I will make sure to mention that in the coming PR, or I'll track it down if someone else ends up doing it. |
What is current blocker to implement UAVCAN servos? Few months ago I get one sample of MD245MW-UAVCAN for testing. These servos listen to I don't know if I will be able to help with code, but I can offer my time to test any implementation. |
hi @rligocki. The current blocker is people to work on this issue. I intend to do this task but there has been some setbacks when it comes to ordering the servos at my company so I haven't started. Hopefully within this week and the next there will be some progress. I already rebased most of this PR so I hope that it won't take too long to get this in a testable state but let's see. If that happens I'll make sure to ping you for testing but like I said I can't progress much until I have a servo I can use. |
This allows airframes that use a combination of UAVCAN ESCs and UAVCAN servo motors to be configured, scaled, and trimmed via PX4 parameters by allowing the aux mixer to be mapped to either PWM outputs or to UAVCAN outputs. If mapped to UAVCAN outputs, the firmware in this PR enables mapping of each aux mixer channel to any combination of UAVCAN ESCs and/or UAVCAN servo motors (actuators) on a channel by channel basis.
Test data / coverage
The firmware in this PR has been tested both on a HIL setup and on the Swift Engineering 021_trailsitter airframe. Both the HIL setup and the 021 tailsitter airframe use adapter PCBs that convert UAVCAN actuator commands to RS485 to drive Dynamixel RS485 smart servo motors. The servo motors are used to control elevon deflection.
Validation:
A video demonstration of the UAVCAN servo actuation on a HIL setup.
The Swift Engineering 021 prototype has flown.
The mapping of the aux mixer to PWM outputs or UAVCAN outputs is controlled by the UAVCAN_ENABLE parameter.
A new UAVCAN servo class takes an actuator ID and a value between -1.0 and 1.0 for normalized deflection. The new UAVCAN_TRIMx and UAVCAN_SCALEx PX4 paramaters are applied to this value and the value is published as a UAVCAN message using the actuator.ArrayCommand. The actuator_id field is assigned based on the position in the aux mixer.
The UavcanNode::run() method uses the parameters UAVCAN_MAP_CHx to determine where to map a particular channel of the aux mixer. ESC mixer channels are mapped to the UAVCAN ESC publisher and control surface channels are mapped to the UAVCAN servo publisher. In addition, the UAVCAN_MAP_CHx parameters can be used to disable an aux mixer channel. If the airframe uses UAVCAN servo motors, but no UAVCAN ESCs, the new logic in the UavcanNode::run() method detects this and disables the UAVCAN ESC publisher. This prevents filling UAVCAN bus bandwidth unnecessarily.