alduxvm / pyMultiWii

MultiWii Serial Protocol (MSP) API to send and receive data from firmware using MSP
GNU General Public License v3.0
153 stars 84 forks source link

Raw RC problems #39

Closed ZZ9-Plural closed 2 years ago

ZZ9-Plural commented 2 years ago

I'm running multiwii on an arduino nano, and it won't let me input raw rc signals. I have success in requesting information, but raw rc commands seem not to be going through. Is there a setup procedure I have overlooked? I know that some boards need to be told what kind of rc input to receive.

alduxvm commented 2 years ago

oh wow! its been a while since I see someone using an arduino and multiwii!! what imu are you using?? ok, in order to enable the raw rc signals, you need to enable "Serial RX", if you check the readme of this repo you will see that step prior doing raw rc signals.

Because you are using an arduino, it means you need to find the SERIAL_RX constant, edit it and then compile again... as far as I remember if you enable that, you will no be able to control using a normal RC... is either one of the other...

Let me know if it worked! Good luck!!

ZZ9-Plural commented 2 years ago

I was unsure if that applied to the particular board I am using. I combed through the Arduino IDE to see if I could alter the SERIAL_RX value, but I have not been able to find a way. I'll keep looking, but if you have any advice, I would greatly appreciate it!

ZZ9-Plural commented 2 years ago

Problem solved! It was a human error on my part, I'm afraid. I will write some stuff down because I struggled a lot and others may find this info useful.

I used an Arduino Mega as the flight controller (FC), and actually ended up using an ESP32 based Arduino board as the flight computer instead of a Raspberry Pi. This is because I am more familiar with C++, and the ESP32 has a lot of serial ports to carry MSP, with bluetooth and wifi on board for wireless control. So I couldn't use the Python code in the end, but it was good reference to work off of. For those looking for an Arduino library to do MSP, I got one from the following link: https://github.com/fdivitto/MSP

I found that uploading the Multiwii code onto an Arduino board like the Nano or Mega does not require the user to enable MSP RC input by changing the "Serial RX" setting. This is only necessary for Cleanflight or Betaflight FCs, as far as I can tell. My FC was set to receive PPM RC input through an RC receiver linked to a PPM encoder, and the MSP raw input took priority as long as commands were sent frequently -the source code counts 50 loops of the main flight code when a raw rc command is sent, and if a new one is not received before the end of the count, defaults to whatever RX setting the user configured. This means both MSP RC input and PPM input can be used, as long as the flight computer (ESP32 in my case) is programmed to stop or start MSP RC commands on demand.

In short, MSP is perfectly doable on an Arduino board. The ability to use and RC transmitter and an onboard flight computer to control the drone makes it quite useful too.

alduxvm commented 2 years ago

thanks a lot for your input! I'm sure it will be helpful for the future!

alduxvm commented 2 years ago

https://www.youtube.com/watch?v=XyyfGp-IomE&ab_channel=AldoVargas