nilay994 / trytime

0 stars 0 forks source link

Connecting an ELRS receiver to Raspberry Pi #4

Closed Automate5462 closed 1 year ago

Automate5462 commented 1 year ago

How is it possible, to read out the channel values of the ELRS receiver on the raspberry pi? The ELRS receiver is connected to the rpi over UART. How can the rpi understand the CRSF protocol? Those channel values could then be modified on the rpi and then sent to the flight controller over msp. If the rpi is also connected to a distance sensor, it would then be possible to modify the throttle value (by code on the rpi) for smooth landing of the semi-autonomous drone.

nilay994 commented 1 year ago

Which file in the repository is this question towards? Files maintained here were for maintainability and maybe sharing some snippets with collaborators. Maybe you wanted to open one in https://github.com/nilay994/simple-cpp-drone?

However to answer your question, I've never readout the CRSF protocol on a mcu/rpi.

In my implementation, there only existed two modes, either selecting the fully autonomous or the manual mode. There haven't been any attempts by that repository to fly semi-autonomously. Hence, it was only required to map a switch from the transmitter for arm/disarm and another one for manual/autonomous.

To read out the CRSF protocol, maybe this provides a good reference: https://github.com/AlessioMorale/crsf_parser/blob/35b4b8a2f41646b5a46fc6942daa4355ebd3d27b/example/parse_serial.py Looking at this, I do think the you can hook a receiver up to the uart and blatantly parse the packets, however, lookout for inverting the data line if that was required (MSP lines usually required so).

However, I suspect that you'd require quicker parsing for semi autonomous flights and a python implementation might not cut it ~ and you'd have to make a cython/c implementation to read them out?!

About adding a distance sensor to make landing better, sure it is your playground once you've managed to read CRSF out and fuse the distance setpoints with your throttle commands in someway.

Hope I've understood and addressed your question right?

Also to note that these repositories are three years old, and haven't been actively maintained either on github or in my mind.

Automate5462 commented 1 year ago

Thank you for the reply and the references. My question is not targeted at a specific repository, I thought to just ask a question relating to drones. I tried it with the help of chatGPT and so far it has not yet worked. ChatGPT proposed a python code with the line "import crsf" and in the terminal to "git clone https:/github.com/betaflight/crsf.git" But I got the error that this repository is not found. I don't know why chatGPT proposed this. Might be, that this repository existed some years ago, but got deleted? I will look into the cython/c implementation.