M0117 ESC rough control
-
@Aaky , sure, I can look into it. Can you please check if your Doodle labs serial port can generate the UART frame format that SBUS uses:
- 100,000 bps
- 2 stop bits
- 1 parity bit
If we do not follow this format, it will not be a standard protocol and does not make sense for us to make this change for a specific use case.
Alex
-
@Alex-Kushleyev I am checking with Doodle labs for this serial port settings. Actually baud rate isn't standard so I doubt 100000 would be supported. Apart from that parity and stop bits is fine. So if only standard baud rate support like 115200 is added might still work out for me.
-
@Aaky , i am thinking that perhaps the easiest thing to try would be the signal inverter like you originally proposed (between Doodle Labs and M0065 J3). Then there would be no firmware required. Ideally, the signal inverter should be symmetric (for better noise immunity). If you use the single transistor approach, you should put the inverter as close as possible to the receiving end of the signal, otherwise if the wire is long, the output of the inverter will pick up noise due to high impedance of the pull-up resistor (10K) when in "high" state.
But if you cannot output 100K baud rate, that would be a problem.
Alternatively, i think you should re-consider converting the SBUS packet in to GHST or Spektrum packet. If you share mode details how Doodle Labs device is getting the RC data (where is it coming from and in what format), I can make a suggestion how to do this. Then you can just use a standard baud rate and standard driver already supported in PX4 with no hardware changes.
I am hesitant to make changes in M0065 firmware to support your specific use case because maintaining that in the future will be an issue. So lets try to find a workaround.
Alex
-
@Alex-Kushleyev Thanks for inputs Alex.
I am thinking now as follows.
- My RC transmitter is smart android tablet with radio sticks inbuilt and has port to output SBUS data. I connected this SBUS data out and received it into Teensy 3.2 development board which is AVR microcontroller based small board.
- Now that I have decoded successfully the sbus data into Teensy, I am transmitting this data from teensy into Doodle labs serial port with normal UART setup and 115200 baud rate. My whole intention behind this activity is to route my radio telemetry via Doodle labs modem as physical interface.
- Now the doodle labs modem on GCS side will beam this serial data via UDP socket to UAV side modem and via UAV side Doodle labs modem I would get the normal UART SBUS packets out.
Now their are multiple solutions,
- This normal UART SBUS data I can either send directly into VOXL2 IO board (if possible) via J2 port with agreed upon frame format?
- I get another Teensy microcontroller which would receive normal UART data convert it into SBUS format and output the same to VOXL2 IO J3 port. I am not sure if Teensy can output inverted SBUS tough.
Note : Doodle cant decode 100000 baud rate packets and also inverted ones so direct SBUS packets into Doodle labs modem arent going to work for sure.
My main confusion is SBUS data is having multiple hops in between before it gets to PX4 and amount of latency which I would be introducing is something I dont know.
In solution 1, I am saving one more hop.
Solution 2 looks more clean.Let me know your thoughts and any background experience.
-
@Alex-Kushleyev Even I can consider converting Sbus into GHST/Spectrum packet on GCS side Teensy itself. Teensy is Arduino style board and if we have good direct libraries to do this it would be beneficial. Let me know if with Arduino style board this can be achieved as an alternative since Sbus packets are already decoded in Teensy and on UAV side I can output standard UART style packets as RC packets.
-
@Aaky ,
A few more questions:
- can you change the uart configuration of your Android radio? For example, instead of inverted SBUS at 100K baud, transmit normal UART 8N1 at 115200. This would allow you to eliminate one Teensy on the transmitter side
- are you able to change the type of data that is sent out from the Android radio? instead of SBUS, maybe another type of packet? (can you change the code running on that device)
- are you planning to send any other data via this link from the Android radio to VOXL2? If you plan to send any other messages, then you will need to encapsulate the data in some packet structure, so that the receiving end will be able to differentiate them.
Alex
-
@Alex-Kushleyev Alex I do not have any control over SBUS data been sent out of my android radio that's the reason I need a decoder in between Doodle and Android radio since Doodle can't decode the Sbus packets. Teensy does the job of decoding very well since there are Sbus library available for Arduino and can also out the Sbus channel data on its serial port comfortably. I have connected GCS side of things comfortably now and yet to see data onto Doodle labs modem now.
Customisation of packets is possible on Teensy microcontroller if library is available or if development is simple. Let me know your thoughts on the basis of this information.
Also I am not planning to send any other data on Sbus channel. I just need all data of 16 channels to receive PX4.
-
@Aaky , OK, I have an idea that you should try, which does not require any code modification, other than in your one Teensy board that you use:
- Teensy device reads SBUS from your Android RC controller
- Teensy re-packages the 16 channels of RC data into CRSF RC format
- Teensy transmits the CRSF packet to Doodle Labs transmitter using standard UART config 8N1, 115200 (or higher baud rate)
- On the drone, the Doodle Labs receiver receives the CRSF data and sends it to VOXL2 directly using standard UART config (can be the same as on the TX side) to one of the UART ports that are connected to DSP
- on VOXL2, you start the already available CRSF receiver and provide the baud rate that you use.
More details:
- how to generate CRSF packets:
- px4 driver for CRSF RC
- how to start the CRSF driver in PX4 on VOXL2
- in
/etc/modalai/voxl-px4.conf
selectRC=CRSF_RAW
- in
/usr/bin/voxl-px4-start
, change the following to add the baud rate param (115200 in this case). You will also need to update the uart device if needed (2, 6, or 7 depending on where you plug it in : https://docs.modalai.com/voxl2-connectors/). You will probably use uart 7 (RC_UART) if you haveVOXL2_IO
board plugge into J18 (ESC_UART, uart 2) :
- in
elif [ "$RC" == "CRSF_RAW" ]; then /bin/echo "Starting CRSF RC driver" qshell crsf_rc start -d 7 -b 115200
I think this should work..
You can start off by transmitting a fixed CRSF test packet from your Teensy device (you can use the python script i linked to generate the bytes stream for the packet and just hardcode this byte stream to send from Teensy at 50-100hz for a quick test. This will allow you to test everything downstream of Teensy without actually doing the SBUS->CRSF conversion yet.
-
@Alex-Kushleyev This sounds like a good plan. Let me see how far I can get.
-
@Alex-Kushleyev One quick query, while I am creating this whole pipeline, can we test the RC driver with this CRSF packet in HITL environment? I want to be sure about latency and any other hiccup before putting this setup over my aircraft. In HITL I can connect two Doodle modems in same architecture as discussed above with teensy decoding the Sbus packets. Let me know feasibility and required changes if any.
-
@Aaky In general, HITL is a good way to test RC.
-
@Eric-Katzfey So can the RC driver work in HITL directly without any additional modification in code?
-
@Aaky Should be fine. I fly with actual RC in HITL all the time.