Questions about MSP_SET_RAW_RC

Questions about MSP_SET_RAW_RC

Postby calVong » Mon Nov 21, 2016 6:42 am

Hi guys,

I am quite new to MSP and I am trying to control a cleanflight FC (the naze32 from banggood) using a raspberry pi to achieve some autonomous control. At moment Im able to read (IMU data etc) from the FC via USB using MSP, but I have encountered the following issue/problem.

1) I am having trouble using MSP_SET_RAW_RC. I tried sending through the command but nothing happened. I tried sending in a while loop, data = [0 0 0 2000 0 0 0] to arm the FC but with no success. I read from http://www.multiwii.com/forum/viewtopic.php?f=23&t=6341 this post that I need to "set serialrx_type=4" for msp? I tried to set that using the cleanflgiht GUI on UART 1 (the USB port?) but it just reset back to "disable" after reboot. Does that mean I have to use UART 2 or UART 3 and enable "Serial RX" in order to use MSP_SET_RAW_RC? This leads to my next question....

2) Assuming now I can set the raw RC input, after setting RX to "Serial RX", would I still be able to control the FC via a normal radio transmitter and the Rpi at the same time. Is there a way to achieve this? I want the pilot to be able to input the pitch channel while the raspberry pi control the other channels (roll and yaw etc)

3) After I use MSP_SET_RAW_RC to override the transmitter inputs, if I read MSP_RC, what does return? the values that I override? or the values from the transmitter?

Any help would be appreciated!

*Edit: I have now solved problem 1 and 3. But still trying to find a way to have the flight controller listen to sbus (legacy RX) and the MSP override at the same time.

Thanks!
Attachments
cleanfight GUI.PNG
Cleanflight GUI ports config
calVong
 
Posts: 3
Joined: Mon Oct 17, 2016 6:42 am

Re: Questions about MSP_SET_RAW_RC

Postby MattQ4 » Thu Dec 01, 2016 5:56 am

I think you have a really cool project going! It makes me think of my own. My system runs on MSP_SET_RAW_RC entirely, no legacy RX back up. It uses XBee radios https://www.digi.com/products/xbee-rf-solutions/modules/xbee-pro-900hp to communicate with my transmitter over async serial.

1) the payload of MSP_SET_RAW_RC when trying to arm the motors should look something like [1500, 1500, 2000,1000, 1500, 1500, 1500, 1500]. you need to put 1500 or it'll get confused. Also I have only been able to arm the motors through serial 0. not sure why but it works. I have a Megapirate AIO btw, your board could be different

2) MSP_SET_RAW_RC will always override all legacy values until .5sec after the last good packet.

3) During that time the legacy values are pretty much not there, and MSP_RC returns the values from the last MSP_SET_RAW_RC.

To better answer #2 tell me more about your setup, like is the RPI in the air or on the ground near the pilot? How does the RPI communicate with the FC?
If it's on the ground my advice would be to compile MSP_SET_RAW_RC packets in the RPI and send them to the quad using a two way radio system like me. You would need to get the pitch or whatever user input into the RPI (Joystick??) but you can get telemetry back, like battery level and GPS, over the same radio.
If the RPI is in the air it will be a little harder. I'm not sure what s.bus or timer input capture capabilities an RPI has but if it could read that signal you could just compile the packets in the RPI with pitch from the ground.

hope this helps! lemme know
MattQ4
 
Posts: 6
Joined: Fri Apr 04, 2014 1:35 pm

Re: Questions about MSP_SET_RAW_RC

Postby calVong » Fri Dec 02, 2016 4:59 am

Hi Matt, thanks for the reply and you advice! And it sounds like you have an interesting project going on as well! Are you running motion capture system indoor to control your system?

My current setup is having a Rpi on a quad, taking inputs from external sensors, and send RC command via MSP to control a naze FC. I have a ground station computer linked to the Rpi via wifi (just ssh) to stream some live data and send commands. I was really hoping that it's possible to have the FC listen to MSP_SET_RAW_RC and the legacy RC at the same time. Having the opinion to still be able to fly the quad without relying on the onboard is nice. At the moment I am actually trying to read the sbus from the rc receiver using an arduino, then the arduino send those info back to the Rpi via serial. It's not an elegant solution....... but I am hoping this would work.

Somehow it never occurs to me that I could be connecting the RC radio to the computer and send the legacy values over to the onboard computer. I might try that later on. Anyway, just wondering, how's the latency of the xbee radio? Do you see any noticeable lag in the response when controlling your system via xbee radio? I have used the xbee series 1 before (very low power/short range), the latency was quite terrible once you have some obstruction in between.

Thanks
calVong
 
Posts: 3
Joined: Mon Oct 17, 2016 6:42 am

Re: Questions about MSP_SET_RAW_RC

Postby MattQ4 » Sat Dec 03, 2016 5:31 am

No problem! I know how hard it is to find info on MSP. I am not doing anything with motion capture as I like to fly outside. Those are really cool though! I've seen some wild videos of quads dancing in a very confined space. Is that what you're working on?

I think you have a good setup with the Naze doing the flight necessary work and rpi giving it control guidance, if the rpi has an error its not gonna fall out of the sky right away. You could force the FC to listen to MSP_SET_RAW_RC and the legacy pitch signal, but you would need to edit your Multiwii code to read the legacy signals and only use pitch when there is valid MSP data. I personally would avoid that because that would be hard for me, and that code is keeping your investment in the air; best to only edit it when you really know what you're doing.

Connecting the legacy rx to the computer and sending pitch over wifi would do the trick, and if you can get a second Rx listening to your Tx then you could connect the second one to the FC on all channels so if the rpi fails you'll have manual control within a second. I would definitely try to have redundant control like that if you're testing a new control system for the first time like this. Having and Arduino on board to read the s.bus signal for the rpi would work too and you could send the s.bus signal to the Naze too, again for redundancy. That Arduino may also be able to help you debug the rpi.

If I were you I'd go for the on board Arduino approach for now until you figure out a more integrated solution and get the rpi working reliably.

I don't have any numbers on latency but I can tell you from experience it's not noticeable and flightworthy, or at least the 250mW/900MHz ones I use. I haven't gone for range further than 100 meters or so but I wouldn't be worried about going out to 500m at least, they're rated for 28 miles LOS. You may have also had the broadcast multi-transmit parameter set to default 3, I have found that adds a good .5sec delay to flight response compared to 0 multi transmits.
MattQ4
 
Posts: 6
Joined: Fri Apr 04, 2014 1:35 pm

Re: Questions about MSP_SET_RAW_RC

Postby calVong » Sun Dec 11, 2016 5:15 am

Sorry been really busy with some other stuff didnt check forum. My project is actually about navigating quad through small tunnels, its quite challenging but its an interesting problem.

As you said I probably wont modify the MSP source code because that just take too much effort. But I might try the xbee later tho, will see how i go with the arduino solution. The problem with xbee is that Im from Melbourne, and only 25mW/900MHz is legal here in Australia, not sure if that is enough, but we'll see.
calVong
 
Posts: 3
Joined: Mon Oct 17, 2016 6:42 am


Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest