AP_Scripting: add example script for Traxxas Velineon ESC's #30976
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a script which uses a serial port to control a Traxxas Velineon ESC and receive ESC telem. The protocol is not documented, this is based on snooping on a receiver with a logic analyser. Its likely possible to get other data, but I only needed RPM.
This is a half duplex protocol, I could not get native half duplex working (possibly due to the input protection on the CubeOrange which I know can cause issues with the FrSky protocols). The work around is to just connect the RX and TX together and filter out our own messages in the script.
There is a bit of a annoying handshake to kick the ESC output of normal PWM mode, to get this working smoothly I added a binding for
set_unbuffered_writes
so the port sends immediately.I also found that the
esc_telem:update_rpm
method was left as auint16
binding when the underlying method was changed to float in #21499. That means if you hit more than 65,535 RPM you get a out of range error and your script dies.Luacheck was being annoying so I have found out how to globally ignore unused arguments that start with a underscore. mpeterv/luacheck#11 (comment)
Tested with a VXL4.