Mav_cmd_do_set_servo


#1

Hi,

I need to drop a payload after landing (or while flying) using MAVLINK. I have a PX4 vtol plane with flytpi.
Have investigated the px4 doc a lot, but can not understand hoe to send a DO_SET_SERVO cmd to control AUX outputs on the pixhawk.
Can you help me, I know this is PX4 related, but can not get any help from their forum at the moment.

I can send the set servo cmd , but do not know what servo id to add to the command, and how that is connected to what AUX output. Also what is needed to be setup in PX4 in pixhawk to enable the aux output to work.
Using a switch via transmitter we can get to work, but not via mavlink command
(have it working with ardupilot, but px4 seems more complicated and less documented for me so far)

is is an EPM magnetic gripper device so need to set a certain pwm for about a second and then return to 1500 again as neutral.

best regards,
Sebastian


#2

Hi @SebastianW,

My earlier understanding was, you were using APM. Why have you switched to PX4? Any particular reason?

I might be wrong but IIUC, you have to send DO_SET_SERVO command inside a waypoint mission. Px4 does not support sending this command via mavros/cmd/command API.

This is the definition of its params:
// params[0] actuator number to be set 0…5 (corresponds to AUX outputs 1…6)
// params[1] new value for selected actuator in ms 900…2000

How did you configure Px4 to get this working?


#3

Hi!
Thanks for answering this question.

Yes we are using APm for our X8 multitoror, but we have bought a VTOL plane, which is pre-equipped and tuned with a PX4 from factory. So we can not change that for now.
Yes I send the DO_SET_SERVO command in a waypoint mission, but I do not know what servo id corresponds to what AUX output so can not get it to work. And what setups is needed in PX4 to make it work.
Also tested to send command 183 (do_set_Servo) via /mavros/cmd/command but maybe that is not working at all as you say? I used this method for APM tests sucessfully. I can not find any good doc that explains the PX4 behaviour around this.

I also get it to work via a RC switch (RC pass through to aux), but unfortunaly that is not solving what I need.
We have a pending question about this to one of teh PX4 developers, so lets see if we get some reply to get this to work. I will update this question with any info I get about this topic.

Thanks,
Sebastian


#4

Hi,

Is this information not solving your problem?


#5

Hi,
Sorry missed that part, I will test it next time I am flying.
I will also try to check if i can run a misison on the ground with takeoff commands.

Will let you know the progess.

Thanks,
Sebastian


#6

Hi Sebastian.

I Hope you’ve come thru your problem
because our team is in same situation here.
What I want to do is control servo by MAV_CMD_DO_SET_SERVO command,
which is transferred from QGC’s waypoint mission.
But all we got is moving servo by controller PWM.

I’ll really be happy with your future comment.

Thanks!


#7

Hi @Hinmo,

Are you using PX4 or APM?
Can you please explain the setup steps you perform, to configure Pixhawk to transmit PWM signals, when it receives MAV_CMD_DO_SET_SERVO command.


#8

Hi there. Thank you for reply.

I use PX4 Firmware with Pixhawk 1 board, 450 sized custom quad.
What I need to do is, Drone Takeoff -> Move to waypoint -> Land -> Servo action -> Takeoff -> RTL.
So I set waypoint mission that way in QGC.
About Servo mission, I connect servo signal pin to AUX1, and set AUX PWM range to 600 ~ 1500.
And of course, Servo has separate regulator.
And lastly, when set CMD_DO_SET_SERVO command in QGC, we set parameters like:
param1 : 1
param2 : 1300
param3 : 0
param4 : 0
and latitude, longitude, etc…

What I miss?


#9

In addition, I use sg90 servo motor, which has 50Hz update rate

connected to AUX1 pin, which has 50Hz update rate. It’s weird!

I can move it by controller, but control in mission mode is problem.

Thank you!


#10

What are the values of these parameters:
MNT_MODE_IN and SYS_AUTOSTART

make sure MNT_MODE_IN is set to 3