Running a DO set servo comand for channel 1 (Ailerons) in auto mode am I crazy?

Hello all,
I am hoping someone can help me with this. I am running a python script to fly my plane. When the plane is in auto mode I want to momentarily do a do set servo command on the AL and have the plane roll left roll right.

The problem I have know is I am getting Chanel 1 is in use already. This make sense because the ailerons are being used steer the plane. I hope there is a simple way to momentarily override it.

any help would be greatly appreciated.

I am hoping someone can help me with this. I am running a python script to
fly my plane. When the plane is in auto mode I want to momentarily do a do
set servo command on the AL and have the plane roll left roll right.

OK, yes, you’re crazy :slight_smile:

The problem I have know is I am getting Chanel 1 is in use already. This
make sense because the ailerons are being used steer the plane. I hope there
is a simple way to momentarily override it.

You could use stick-mixing instead; provide RC input to move the servos
using the rc override messages.

What you should probably be doing, however, is putting the Plane into
guided mode and pushing it around in there.

The mavlink set_attitude_target message is what you’re probably after.
Here are the autotests for that feature:

Thank peter ill check this out. Since posting my first message i tried running in guided mode. I tried the do set servo again on channel one but got the same result.

if I am reading the documentation right the do set servo should work on the way to the next waypoint

I take a look at what you posted

Brian

So I tried the rc override in guided mode and got Al rolling the plane left and right.
Peter do you know how the index values work? ie what gives me a 1000pwm and 2000pwm signal?

So I tried the rc override in guided mode and got Al rolling the plane left
and right.

Well, as mentioned, there are way better ways to move the aircraft
around than simulating RC input.

Peter do you know how the index values work? ie what gives me a 1000pwm and
2000pwm signal?

Without looking too closely, 1000pwm should be output when at or
below the RCn_MIN parameter and 2000pwm when at or above RCn_MAX. Linear
in-between. At a guess :slight_smile: Tell me if I’m wrong and I’ll dig.

Peter so I looked at the link you posted. I assume you are pointing me use mavproxy.send???
Mabey not but if so can I use it out of the sim??

Peter I get this part:
Without looking too closely, 1000pwm should be output when at or
below the RCn_MIN parameter and 2000pwm when at or above RCn_MAX. Linear
in-between. At a guess :slight_smile: Tell me if I’m wrong and I’ll dig.

More specifically this is what I am stuck on.
I am following this document:
http://python.dronekit.io/examples/channel_overrides.html

in this example they are setting there elevator to 200 using this line

vehicle.channels.overrides[‘2’] = 200

what dose the 200 mean in terms of pwm. It sure dose turn the plane though. LOL that all I know so far.

Thanks

Peter so I looked at the link you posted. I assume you are pointing me use
mavproxy.send???
Mabey not but if so can I use it out of the sim??

No, I’m suggesting you use the appropriate mavlink commands as tested in
that test :slight_smile:

See also the “set_attitude_target” dronekit-python example.

More specifically this is what I am stuck on.
I am following this document:
http://python.dronekit.io/examples/channel_overrides.html

in this example they are setting there elevator to 200 using this line

AFAICS, 200 is just out-of-band. I thought I wrote a dronekit-python
example which does an entire flight using RC overrides, but I can’t find
it now…

Try graphing (e.g.) RC_CHANNELS_RAW.chan1_raw in SITL to see how the
packets are being interpreted.

vehicle.channels.overrides[¡2¢] = 200

what dose the 200 mean in terms of pwm. It sure dose turn the plane though.
LOL that all I know so far.

I’m guessing that will get clamped to RC2_MIN

Thanks

Yours,

I don’t know what version of plane you are trying to use, but we reject attempts to DO_SET_SERVO to any servo channel that has a function assigned in master, and we are planning to maintain this behavior which means even if you get it to work now, it will be broken on you on the next stable release.

You may want to look into the MANUAL_CONTROL message instead. If you use channel override you are responsible for figuring out how to map that within each input channel’s calibrated min/max value. Manual control allows you to use a normalized control value and the autopilot will manage the mapping for you. (Just beware that the throttle mapping behavior is inconsistent between copter/rover/plane/sub)

Okay, thanks for the input
Do you all know were I can find an example of creating an attribute that is setable for this manual_ control mavlink?
I see there is one for reading the RawIMU but not to make setabule like airspeed and overided.

Hello WickedShell
So by master you mean we cant DO_SET_SERVO to any AETR channel? Here I am trying to control the elevator in arduplane 3.10 in manual mode and the print screen below shows what I am getting.

Can you point me in the right direction as to what code is preventing me from writing to it.

Thanks

image

@Brian_Duvall correct, you are not allowed to use a DO_SET_SERVO for any of your flight control (or other channels such as gimbals/cameras). https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_ServoRelayEvents/AP_ServoRelayEvents.cpp#L35 Note that removing this and taking control of a flight channel can result in unsafe (and undefined behavior).

I’m afraid I can’t point you at anything with using a Python toolkit for sending MAVLink messages, I’ve always generated messages directly with either Clojure/C/Java bindings.

Okay thanks for the help!

Back to the Manual control stuff
I think what would work best for my situation is to have the plane in CRUISE mode and give it manual control inputs. All I need is for the plane to fly at a constant airspeed and altitude for about 10 seconds while a roll maneuver is performed.

If I did it like this would I still run into the channel already in use error?

Thanks

It sounds like you might want to look into the SET_ATTITUDE_TARGET message. On Plane when in guided mode you can send this to selectively set the roll/pitch/yaw of the aircraft which is probably the best solution.

Otherwise you can explore the stick mixing option @peterbarker indicated, but I suspect you will always get slightly weird results from it, as it will trying to mix your stick inputs vs the autopilot outputs which can be a bit messy. (I’m personally a detractor to stick mixing so I’m probably not the one to sell you on it/know how well it will work for your use case).