Calling/setting a parameter in events.cpp

Is it possible to call & change a parameter declared in libraries in Arducopter>events.cpp?

I understand there is probably a lot of redundancy built into the codebase to prevent parameters being set during flight. I just think since i am calling it in a failsafe event it should be possible.

Any guidance would be appreciated.

I have never tried that but I think you can achieve what you want using: MAV_CMD_DO_SET_PARAMETER. You can send this command in GUIDED mode from your script or add this to the mission item list.

1 Like

Is it only possible to send this in Guided mode?

Sorry for the incorrect information since MAV_CMD_DO_SET_PARAMETER is not implemented yet.
May I ask which parameter you want to change?
There is no parameter declaration in events.cpp.
But you can always change a listed parameter in here using parameter protocol by pymavlink, changing the parameter values in some ground control station software like Mission Planner, mavproxy and writing it to the vehicle or simply setting vehicle.parameters["PARAM_NAME"] = VALUE in dronekit.

1 Like

I want to call RC_OPTIONS = 0 in a radio failsafe event.

I have been looking at pymavlink and Dronekit - to my understanding it required manual input via a terminal.

ultimately i want my radio failsafe to switch back to autopilot stabilize instead of holding last known pilot command - Herelink

EDIT:
I don’t think this is an ArduPilot problem. It sounds like perhaps you have a receiver mis-configuration. Generally speaking, it should stop sending pulses when the transmitter loses connection. See this link: Radio Failsafe — Copter documentation

1 Like

There seems to be no receiver configuration for the Herelink - Air Unit receiver, very limited documentation on that. The link demonstrates how to configure older receivers, which usually have a F/S binding button.

Yeah, having a script to detect a failsafe and set a parameter change is what I’m going for at the moment.

Ok, according to another forum post on another site, you cannot change the Herelink failsafe behavior (which makes it a poor choice, in my opinion).

You should look into Lua scripting for this purpose. I don’t have a Herelink transmitter, so I cannot test for the conditions present during an RC failsafe with that hardware.

Thank you for your help, yeah it is quite surprising.

I’ll look into Lua scripts.