Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RX MSP overwrite: Using MSP_SET_RAW_RC together with another serial RX #12790

Closed
cvetaevvitaliy opened this issue May 11, 2023 · 32 comments · Fixed by #13352
Closed

RX MSP overwrite: Using MSP_SET_RAW_RC together with another serial RX #12790

cvetaevvitaliy opened this issue May 11, 2023 · 32 comments · Fixed by #13352
Labels
Feature Request Feature requests are excluded from automatically being marked as stale

Comments

@cvetaevvitaliy
Copy link
Contributor

cvetaevvitaliy commented May 11, 2023

Is your feature request related to a problem? Please describe

I can only enable RX_MSP or RX_SERIAL, not both. I want to have a single board computer running on the drone (and I like Betaflight 1st_place_medal, so I don't want to use other firmware such as Ardupilot where through Mavlink I can control the drone) for autonomous flight

Describe the solution you'd like

Add a feature to the Modes or Adjustments tabs that will allow us to flexibly adjust the mode: RX MSP OVERRIDE
In detail:

  • Add option to configurator, select any RC channel (except of course Roll, Pitch, Yaw, Thr) to enable 'RX MSP OVERRIDE' feature
  • After activating this mode 'RX MSP OVERRIDE', only the Roll, Pitch, Yaw, Thr channels should be overwritten from MSP, all others from the receiver.
  • FailSafe should be unaffected and depend on the RC receiver (If the connection is lost - need to activate FS)

This will allow us to activate this mode 'RX MSP OVERRIDE' at the command of the remote control, as well as to turn it off at any time if the "autonomous flight" is out of control

Describe alternatives you've considered

I tried an autonomous flight on Ardupilot, there it is possible to send RC commands using the Mavlink protocol, but I don't like how it flies, Betaflight is best. Betaflight has the Mavlink protocol but only sends telemetry data.

Other information

I can help with testing and implementation of this feature

@cvetaevvitaliy cvetaevvitaliy added the Template: Feature Request Set by auto_close_issue. label May 11, 2023
@haslinghuis haslinghuis added Feature Request Feature requests are excluded from automatically being marked as stale and removed Template: Feature Request Set by auto_close_issue. labels May 12, 2023
@haslinghuis
Copy link
Member

Any info on the SBC and software used?

I can only enable RX_MSP or RX_SERIAL, not both. I want to have a single board computer running on the drone (and I like Betaflight 1st_place_medal, so I don't want to use other firmware such as Ardupilot where through Mavlink I can control the drone) for autonomous flight

@cvetaevvitaliy
Copy link
Contributor Author

the best software! 😀

The NPU to quickly run neural network and many thousands of code

@haslinghuis
Copy link
Member

haslinghuis commented May 13, 2023

Any repo available on that and specific NPU used?

@cvetaevvitaliy
Copy link
Contributor Author

For the part that communicates with the flight controller via MSP, will definitely be published, I have already started working on it.

sending RC commands via MSP works, i want to add other ʼmsp commandsʼ to get telemetry and stuff...

@haslinghuis
Copy link
Member

#8292

@cvetaevvitaliy
Copy link
Contributor Author

cvetaevvitaliy commented May 14, 2023

#8292

I know about this issue. I read everything, but the RX architecture in Betaflight is made so that only one receiver can work.
I suggest providing the possibility to activate this RC MSP overwriting mode from the remote control and also turn it off.

About which NPU, there are already many of them built into CPUs from different manufacturers.

I'm currently working with Rockchip, they have different performances NPU, from 1 tops to 6 tops.

https://www.rock-chips.com/a/en/products/RV11_Series/index.html

Right now I have a small prototype the size of a flight controller.
this is a render so far, PCB prototype in progress.

@haslinghuis
Copy link
Member

Thanks. Interesting. Looking good 😍
Does it run opencv ?

Would this PR not allow what you are asking for: #9915 ?
Would fixing MAVlink be the answer?

@cvetaevvitaliy
Copy link
Contributor Author

No. This PR does`t resolve this feature, always RC commands will be rewritten form receiver.
https://github.com/betaflight/betaflight/blob/master/src/main/rx/rx.c#L654-L662
You can test it, if the receiver is selected any other than MSP, the MSP_SET_RAW_RC commands will be ignored

To be able to overwrite commands with MSP_RC, need to rewrite this code something like this
the FailSafe functionality will not be affected in any way.

        if (msp_ovveride_activate && channel < NON_AUX_CHANNEL_COUNT)
            sample = rxMspReadRawRC(&rxRuntimeState, rawChannel);
        else 
            sample = rxRuntimeState.rcReadRawFn(&rxRuntimeState, rawChannel); 

where the flag msp_ovveride_activate can be activated/deactivated from the Modes or Adjustments
Also will be overwritten only: Roll, Pitch, Yaw, Thr channels

In this way, we will be able to flexibly configure this feature

@cvetaevvitaliy
Copy link
Contributor Author

@haslinghuis
So, do you want to add feature to the Betaflight configurator, if I implement the functionality on the Betaflight side
I mean, the ability to flexibly configure which RC channel will be responsible for enabling/disabling the listening of RC NON_AUX_CHANNEL commands from the MPS

@haslinghuis
Copy link
Member

Yes like to assist in client implementation. Are you able to provide a sample for testing?

@cvetaevvitaliy
Copy link
Contributor Author

Yes, I can provide sample for testing

@haslinghuis
Copy link
Member

You can contact me at my name at firmware name dot com

@cvetaevvitaliy
Copy link
Contributor Author

@haslinghuis
Hi!
I added a new mode, now you can configure any free AUX channel
After its activation, four control channels: Roll, Pitch, Yaw, Thr will be listened to from the MSP. After deactivation, control of the "sticks" will return to the pilot

Thus we have the opportunity to use MSP_SET_RAW_RC command together with another(any) RX, without breaking Failsafe mode and without overwriting other AUX channels

@danyayoe
Copy link

@cvetaevvitaliy so, you've added a possibility to control a drone with betaflight firmware via mavlink protocol? Am I right? If yes, could you please give more info or a link how to configure it?

@cvetaevvitaliy
Copy link
Contributor Author

No, via MSP protocol, BetaFlight supports mavlink but only sending telemetry data, without listening RC commands

@danyayoe
Copy link

Got it, thanks for the answer anyway. So you use MSP protocol to control the Betaflight drone from the single board computer?

@cvetaevvitaliy
Copy link
Contributor Author

cvetaevvitaliy commented May 31, 2023

That's right!
I see that you are also from Ukraine, if we have the same purpose, you can contact me

@danyayoe
Copy link

@cvetaevvitaliy with pleasure

@ledvinap
Copy link
Contributor

ledvinap commented Jun 1, 2023

@cvetaevvitaliy : Using RC override is good for initial testing, but eventually, it would be better to control PID setpoints directly. There was some PR with quaternion as angle mode setpoint

@cvetaevvitaliy
Copy link
Contributor Author

cvetaevvitaliy commented Jun 1, 2023

@ledvinap Thanks for reply. Tell us in detail about PID setpoints, how it can be controlled by MSP

@cvetaevvitaliy cvetaevvitaliy changed the title RX MSP OVERRIDE: Using MSP_SET_RAW_RC together with another serial RX RX MSP overwrite: Using MSP_SET_RAW_RC together with another serial RX Jun 14, 2023
@tgalkovskyi
Copy link

I was able to verify that with betaflight master:

  1. having firmware with msp_override_channels_mask fix Fix wrong test for BOXMSPOVERRIDE channel #12857
  2. and setting msp_override_channels_mask=0xf in betaflight cli

was enough for me to be able to issue MSP_SET_RAW_RC over either USB or non-usb UART port in MSP_OVERRIDE mode, no other changes were necessary.
MSP_OVERRIDE is bound to AUX3 and I can go into and out of this mode by switching AUX3, where my MSP_SET_RAW_RC are only respected in MSP_OVERRIDE mode and ignored otherwise.

@haslinghuis
Copy link
Member

Fixed in #12857

@Automate5462
Copy link

Hi! I added a new mode, now you can configure any free AUX channel After its activation, four control channels: Roll, Pitch, Yaw, Thr will be listened to from the MSP. After deactivation, control of the "sticks" will return to the pilot

Thus we have the opportunity to use MSP_SET_RAW_RC command together with another(any) RX, without breaking Failsafe mode and without overwriting other AUX channels

@cvetaevvitaliy Thanks for adding this mode!
I tried to achieve the same, but it did not work:
When msp_override_channels_mask is set to zero in betaflight cli, then the msp override mode disappears.
And when it is set to e.g. =1, then the msp override mode can be set, and assigned to e.g. AUX2.
But once the AUX2 triggers this mode, it is not possible to exit from this mode, as the AUX channels are not responding anymore to the transmitter.
Do you know, what needs to be done, so that the AUX-channels are not overwritten by the msp, but always taken from the transmitter?
(So that the transmitter can always start and stop the mode, when the msp overwrites the pitch, roll, yaw and throttle?)

@cvetaevvitaliy
Copy link
Contributor Author

Hi! I added a new mode, now you can configure any free AUX channel After its activation, four control channels: Roll, Pitch, Yaw, Thr will be listened to from the MSP. After deactivation, control of the "sticks" will return to the pilot
Thus we have the opportunity to use MSP_SET_RAW_RC command together with another(any) RX, without breaking Failsafe mode and without overwriting other AUX channels

@cvetaevvitaliy Thanks for adding this mode! I tried to achieve the same, but it did not work: When msp_override_channels_mask is set to zero in betaflight cli, then the msp override mode disappears. And when it is set to e.g. =1, then the msp override mode can be set, and assigned to e.g. AUX2. But once the AUX2 triggers this mode, it is not possible to exit from this mode, as the AUX channels are not responding anymore to the transmitter. Do you know, what needs to be done, so that the AUX-channels are not overwritten by the msp, but always taken from the transmitter? (So that the transmitter can always start and stop the mode, when the msp overwrites the pitch, roll, yaw and throttle?)

Hi! Thanks for your interest in my idea, but my code was not merged )

@Automate5462
Copy link

@cvetaevvitaliy Thanks a lot for your fast reply.
Do you still have the files / are they still somewhere on github?
So that I could build the firmware and flash this custom version onto an STM32F405 FC as a target?

@cvetaevvitaliy
Copy link
Contributor Author

@cvetaevvitaliy Thanks a lot for your fast reply. Do you still have the files / are they still somewhere on github? So that I could build the firmware and flash this custom version onto an STM32F405 FC as a target?

I don't have it anymore, I work immediately with angles in PID controller

@dronieee
Copy link

dronieee commented Jan 6, 2024

@cvetaevvitaliy Thanks a lot for your fast reply. Do you still have the files / are they still somewhere on github? So that I could build the firmware and flash this custom version onto an STM32F405 FC as a target?

I don't have it anymore, I work immediately with angles in PID controller

@cvetaevvitaliy Hi, I have exactly the same use-case you described in the first post. How do you control the angles from the single board computer using MSP/SERIAL? Could you please point me to any resources that would help me achieve this? Thanks!

@devnim
Copy link

devnim commented Jan 14, 2024

That's right!
I see that you are also from Ukraine, if we have the same purpose, you can contact me

@cvetaevvitaliy, Vitaliy, how do I contact you?

@cvetaevvitaliy
Copy link
Contributor Author

@devnim
You can write in BF Discord

@cvetaevvitaliy
Copy link
Contributor Author

@devnim
See hardware topic

@devnim
Copy link

devnim commented Jan 21, 2024

Hi @Automate5462 , did you find a solution to the problem you encountered below?

I tried to achieve the same, but it did not work:
When msp_override_channels_mask is set to zero in betaflight cli, then the msp override mode disappears.
And when it is set to e.g. =1, then the msp override mode can be set, and assigned to e.g. AUX2.
But once the AUX2 triggers this mode, it is not possible to exit from this mode, as the AUX channels are not responding anymore to the transmitter.
Do you know, what needs to be done, so that the AUX-channels are not overwritten by the msp, but always taken from the transmitter?
(So that the transmitter can always start and stop the mode, when the msp overwrites the pitch, roll, yaw and throttle?)

@Automate5462
Copy link

No, I have not found the solution.

Hi @Automate5462 , did you find a solution to the problem you encountered below?

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Feature requests are excluded from automatically being marked as stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants