RCSERIAL and STANDARDTX combined
RCSERIAL and STANDARDTX combined
Hi all,
Long time lurker! I have a project idea but need a few pointers in the right direction.
Basically, the functionality I'm trying to implement is that the multicopter is controlled using the standard tx/rx but then to have the aux switch, when enabled, to accept only flight commands using the serial protocol.
So far I have:
- Added new 'checkbox' to allow this to be toggled
- located '#define RCSERIAL'
- located where standardrx is (basically a 'if not any other config defined'
I have knowledge of micro controllers but it is fairly basic. It tried to stick the define in the toggle switch bit but that had no effect (surprise surprise). What I am confused about is how the multiwii differentiates the input in RX.ino, it seems very unclear where standardrx and RCSERIAL do their different methods and as such I can't work out where to put my ee switching code in.
Looking for general pointers please, not for someone to do the work as I am more than willing to do it myself if I know where the code does its thing!
Thanks all,
Regards Giles
Long time lurker! I have a project idea but need a few pointers in the right direction.
Basically, the functionality I'm trying to implement is that the multicopter is controlled using the standard tx/rx but then to have the aux switch, when enabled, to accept only flight commands using the serial protocol.
So far I have:
- Added new 'checkbox' to allow this to be toggled
- located '#define RCSERIAL'
- located where standardrx is (basically a 'if not any other config defined'
I have knowledge of micro controllers but it is fairly basic. It tried to stick the define in the toggle switch bit but that had no effect (surprise surprise). What I am confused about is how the multiwii differentiates the input in RX.ino, it seems very unclear where standardrx and RCSERIAL do their different methods and as such I can't work out where to put my ee switching code in.
Looking for general pointers please, not for someone to do the work as I am more than willing to do it myself if I know where the code does its thing!
Thanks all,
Regards Giles
-
- Posts: 3
- Joined: Fri Mar 15, 2013 5:23 am
Re: RCSERIAL and STANDARDTX combined
I sloved this problem,the main function is computeRC in Rx.ino file, just add variables to control it , everythin ok, this step
1. comment #define RCSERIAL
2. add
in config.h file
3. modify #define STANDARD_RX in def.h file
4. add some code in computeRc() function
4. then, you can control 'only_serial' via multiwii serial protocol
1. comment #define RCSERIAL
Code: Select all
//#define RCSERIAL
2. add
Code: Select all
int only_serial = 0;
in config.h file
3. modify #define STANDARD_RX in def.h file
Code: Select all
//#if !defined(SERIAL_SUM_PPM) && !defined(SPEKTRUM) && !defined(SBUS) && !defined(RCSERIALERIAL)
#if !defined(SERIAL_SUM_PPM) && !defined(SPEKTRUM) && !defined(SBUS)
#define STANDARD_RX
#endif
4. add some code in computeRc() function
Code: Select all
if (only_serial != 1) {
#if !(defined(RCSERIAL) || defined(OPENLRSv2MULTI)) // dont know if this is right here
#if defined(SBUS)
readSBus();
#endif
rc4ValuesIndex++;
debug[3] = rc4ValuesIndex;
for (chan = 0; chan < 8; chan++) {
rcData4Values[chan][rc4ValuesIndex%4] = readRawRC(chan);
rcDataMean[chan] = 0;
for (a=0;a<4;a++) rcDataMean[chan] += rcData4Values[chan][a];
rcDataMean[chan]= (rcDataMean[chan]+2)/4;
if ( rcDataMean[chan] < rcData[chan] -3) rcData[chan] = rcDataMean[chan]+2;
if ( rcDataMean[chan] > rcData[chan] +3) rcData[chan] = rcDataMean[chan]-2;
}
#endif
}
4. then, you can control 'only_serial' via multiwii serial protocol
Re: RCSERIAL and STANDARDTX combined
Geebles wrote:Hi all,
Long time lurker! I have a project idea but need a few pointers in the right direction.
Basically, the functionality I'm trying to implement is that the multicopter is controlled using the standard tx/rx but then to have the aux switch, when enabled, to accept only flight commands using the serial protocol.
So far I have:
- Added new 'checkbox' to allow this to be toggled
- located '#define RCSERIAL'
- located where standardrx is (basically a 'if not any other config defined'
I have knowledge of micro controllers but it is fairly basic. It tried to stick the define in the toggle switch bit but that had no effect (surprise surprise). What I am confused about is how the multiwii differentiates the input in RX.ino, it seems very unclear where standardrx and RCSERIAL do their different methods and as such I can't work out where to put my ee switching code in.
Looking for general pointers please, not for someone to do the work as I am more than willing to do it myself if I know where the code does its thing!
Thanks all,
Regards Giles
I guess it is a little late! but I have done the same thing. first of all you should be able to send serial command to the flight controller:
1.config RCSERIAL (disables standard rx system)
2. send MSP_SET_RAW_RC commands to set rc channels. for example : $M>+[16]+[200]+([232][3])*8 times+[checksum]. the numbers in [] are bytes needed for command where: [16] is number of payload bytes (8 channels *2 bytes), [200] is MSP_SET_RAW_RC code, [232][3] is first channel data (roll) and is equal to 0x03 E8 = 1000( you should send all 8 rc channels) , [checksum] is the generated checksum by XOR-ing all the bytes, one by one (except first three "$M>").
3. read rc data (MSP_RC = 105) to make sure step 2 is ok.
if everything goes well , now you can easily change 3-4 line of code to be able to toggle between RCSERIAL and STANDARD_RX modes. I commented two RCSERIALs in #if defs and used a variable (debug[4]) to determine which channels should be updated by STANDARD_RX routine (computeRC()).
Good luck!

Farzad
Re: RCSERIAL and STANDARDTX combined
hackers365 wrote:I sloved this problem,the main function is computeRC in Rx.ino file, just add variables to control it , everythin ok, this step
1. comment #define RCSERIALCode: Select all
//#define RCSERIAL
2. ...
I confirm that this method works, but you will need a serial link to switch between serial and standard rx modes. if the variable (only_serial) was used to set channels, you could switch between modes by an aux channel like this:
Code: Select all
for (chan = [b]only_serial[/b]; chan < 8; chan++) {
this way you can use both serial and standard rx at the same time (only_serial = 8 for serial mode, only_serial = 4 for hybrid mode, and only_serial=0 for standard rx mode).
Farzad
Re: RCSERIAL and STANDARDTX combined
Hi!!
How are you??
I want to do that as well, have two ways of controllling the MW, one with the normal radio (turnigy 9x) and the other via the computer (maybe BT or a 3dr radio), what do I require to do that??
I now that I need to write some code to make the serial protocol on the computer side and send it via the 3dr radio, and of course made some modifications on the MW code to be able to switch between radios (exactly what you done)...
Is that the same objective you got?? what hardware are you using for the extra serial connection?? have you already written something on the computer side??
Cheers!!
How are you??
I want to do that as well, have two ways of controllling the MW, one with the normal radio (turnigy 9x) and the other via the computer (maybe BT or a 3dr radio), what do I require to do that??
I now that I need to write some code to make the serial protocol on the computer side and send it via the 3dr radio, and of course made some modifications on the MW code to be able to switch between radios (exactly what you done)...
Is that the same objective you got?? what hardware are you using for the extra serial connection?? have you already written something on the computer side??
Cheers!!
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: RCSERIAL and STANDARDTX combined
now, things should be easier:
- no need to define RCSERIAL any more
- you can use the RX you want
- if a message MSP_SET_RAW_RC comes, it will override the RX
- after a small timeout (0.5s), if there is no more MSP_SET_RAW_RC, the RX regain control.
- no need to define RCSERIAL any more
- you can use the RX you want
- if a message MSP_SET_RAW_RC comes, it will override the RX
- after a small timeout (0.5s), if there is no more MSP_SET_RAW_RC, the RX regain control.
-
- Posts: 506
- Joined: Thu May 05, 2011 8:13 am
- Location: Slovenia
Re: RCSERIAL and STANDARDTX combined
@Alexinparis
How is failsafe detected/treated in your new addition?
Is it possible to create one-way RCSERIAL link (suppressing MSP response)? It could be useful to suppress switching for those that have slower uplinks and are satisfied whit one-way communication.
Best Regards
Andrej
EDIT:Looking into the code... I believe that MSP_SET_RAW_RC responses are already suppressed by default?!
How is failsafe detected/treated in your new addition?
Is it possible to create one-way RCSERIAL link (suppressing MSP response)? It could be useful to suppress switching for those that have slower uplinks and are satisfied whit one-way communication.
Best Regards
Andrej
EDIT:Looking into the code... I believe that MSP_SET_RAW_RC responses are already suppressed by default?!
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: RCSERIAL and STANDARDTX combined
crashlander wrote:@Alexinparis
How is failsafe detected/treated in your new addition?
Is it possible to create one-way RCSERIAL link (suppressing MSP response)? It could be useful to suppress switching for those that have slower uplinks and are satisfied whit one-way communication.
Best Regards
Andrej
EDIT:Looking into the code... I believe that MSP_SET_RAW_RC responses are already suppressed by default?!
Hi,
Currently, every MSP messages are acknowledged, even MSP_SET_RAW_RC
(look at headSerialReply(0);). It’s possible to suppress it for this message.
Anyway, you don’t need to wait or read this acknowledgement.
You can only connect only GND/5V/TX to the arduino and it should work as a one way RX, allowing you to use low baudrate and higher distance.
About failsafe:
If no MSP_SET_RAW_RC message is received, it’s the same as the current legacy RX.
If a MSP_SET_RAW_RC is received:
- the failsafe counter is set to 0
- after around 0.5s without new MSP_SET_RAW_RC message, the legacy RX loop takes the lead with its failsafe logic
- if no legacy RX is connected, the legacy RX loop is still active with its failsafe logic.
So failsafe is ensured in every case.
You could also imagine a redundant system with 1 legacy RX + 1 RCSERIAL device using MSP_SET_RAW_RC message.
-
- Posts: 506
- Joined: Thu May 05, 2011 8:13 am
- Location: Slovenia
Re: RCSERIAL and STANDARDTX combined
Thank you for your answers.
I can see now that is moved to .
Today I have tested both methods from same TX (MSP style with my mockup of APC802 and APC220 and controlled thru teacher/pupil port) and switchover is really nice.
Regards
Andrej
I can see now that
Code: Select all
headSerialReply(0)
Code: Select all
s_struct_w
Today I have tested both methods from same TX (MSP style with my mockup of APC802 and APC220 and controlled thru teacher/pupil port) and switchover is really nice.
Regards
Andrej
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: RCSERIAL and STANDARDTX combined
@Crashlander, this maybe a very interesting project for you, integrating the MP_SET code to this: http://www.rcgroups.com/forums/showthread.php?t=1704110
-
- Posts: 506
- Joined: Thu May 05, 2011 8:13 am
- Location: Slovenia
Re: RCSERIAL and STANDARDTX combined
copterrichie wrote:@Crashlander, this maybe a very interesting project for you, integrating the MP_SET code to this: http://www.rcgroups.com/forums/showthread.php?t=1704110
Thank you for your tip! I moved from totally modified Futaba F-14, to DX7 "module" to avoid additional electronic components and this way I also simplify the code (al the trimming, center and endpoint settings are now done in original DX7 and the only thing my code is doing is reading PPM signal and conversion to MSP).
Regards
Andrej