Retractable landing gear for px4 using mavros

#1

Hello guyz,
Im trying to use a retractable landing gear with a px4 and a overlaying odroid control. Therefore the px is running in offboard mode and I controll the drone via attitude control. I thought about sending actuator controls but that seems to mess up the attitude control. Unfortunatly if I send mavcmd DO_SET_SERVO the request fails:

Request failed. Check mavros logs. ACK: 3

Am I doing sth wrong with the MAV_CMD or is there a better way?

Here is the diagnostic feedback:
Mavros:
[ INFO] [1532619055.611560442]: IMU: Attitude quaternion IMU detected!
[ INFO] [1532619055.612270816]: IMU: High resolution IMU detected!
[ INFO] [1532619055.749501500]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
[ INFO] [1532619055.847462525]: IMU: Attitude quaternion IMU detected!
[ INFO] [1532619055.848405104]: IMU: High resolution IMU detected!
[ INFO] [1532619056.758370289]: VER: 1.1: Capabilities 0x000000000000e4ef
[ INFO] [1532619056.758512267]: VER: 1.1: Flight software: 010800ff (00000000F3E3ADAE)
[ INFO] [1532619056.758640717]: VER: 1.1: Middleware software: 010800ff (00000000F3E3ADAE)
[ INFO] [1532619056.758772548]: VER: 1.1: OS software: 071600ff (0000000000000000)
[ INFO] [1532619056.758896976]: VER: 1.1: Board hardware: 00000011
[ INFO] [1532619056.759019372]: VER: 1.1: VID/PID: 26ac:0011
[ INFO] [1532619056.759104005]: VER: 1.1: UID: 3036510e36373734
[ WARN] [1532619056.759928950]: CMD: Unexpected command 520, result 0
[ INFO] [1532619065.750967546]: HP: requesting home position
[ INFO] [1532619070.755120888]: WP: mission received
[ INFO] [1532619075.750572389]: HP: requesting home position
[ WARN] [1532619085.713035388]: GP: No GPS fix
[ INFO] [1532619085.750970183]: HP: requesting home position
[ WARN] [1532619092.754518791]: CMD: Unexpected command 183, result 3

header:
seq: 118
stamp:
secs: 1532619200
nsecs: 479749153
frame_id: ‘’
status:

level: 0
name: “mavros: FCU connection”
message: “connected”
hardware_id: “/dev/ttyACM0:921600”
values:

key: “Received packets:”
value: “49170”

key: “Dropped packets:”
value: “0”

key: “Buffer overruns:”
value: “0”

key: “Parse errors:”
value: “0”

key: “Rx sequence number:”
value: “34”

key: “Tx sequence number:”
value: “134”

key: “Rx total bytes:”
value: “2177802”

key: “Tx total bytes:”
value: “84796”

key: “Rx speed:”
value: “22179.000000”

key: “Tx speed:”
value: “890.000000”

level: 2
name: “mavros: GPS”
message: “No satellites”
hardware_id: “/dev/ttyACM0:921600”
values:

key: “Satellites visible”
value: “0”

key: “Fix type”
value: “0”

key: “EPH (m)”
value: “99.99”

key: “EPV (m)”
value: “99.99”

level: 0
name: “mavros: Heartbeat”
message: “Normal”
hardware_id: “/dev/ttyACM0:921600”
values:

key: “Heartbeats since startup”
value: “145”

key: “Frequency (Hz)”
value: “0.959986”

key: “Vehicle type”
value: “Quadrotor”

key: “Autopilot type”
value: “PX4 Autopilot”

key: “Mode”
value: “MANUAL”

key: “System status”
value: “Standby”

level: 0
name: “mavros: System”
message: “Normal”
hardware_id: “/dev/ttyACM0:921600”
values:

key: “Sensor present”
value: “0x0027002F”

key: “Sensor enabled”
value: “0x0021000F”

key: “Sensor helth”
value: “0x0027002F”

key: “3D gyro”
value: “Ok”

key: “3D accelerometer”
value: “Ok”

key: “3D magnetometer”
value: “Ok”

key: “absolute pressure”
value: “Ok”

key: “rc receiver”
value: “Ok”

key: “AHRS subsystem health”
value: “Ok”

key: “CPU Load (%)”
value: “61.1”

key: “Drop rate (%)”
value: “0.0”

key: “Errors comm”
value: “0”

key: “Errors count #1
value: “0”

key: “Errors count #2
value: “0”

key: “Errors count #3
value: “0”

key: “Errors count #4
value: “0”

level: 0
name: “mavros: Battery”
message: “Normal”
hardware_id: “/dev/ttyACM0:921600”
values:

key: “Voltage”
value: “22.58”

key: “Current”
value: “0.0”

key: “Remaining”
value: “49.0”

level: 0
name: “mavros: Time Sync”
message: “Normal”
hardware_id: “/dev/ttyACM0:921600”
values:

key: “Timesyncs since startup”
value: “1449”

key: “Frequency (Hz)”
value: “9.999868”

key: “Last dt (ms)”
value: “0.492667”

key: “Mean dt (ms)”
value: “0.040468”

key: “Last system time (s)”
value: “24659.926831000”

key: “Time offset (s)”
value: “1532594540.519011736”

#2

@Bernhard Could you be more specific on how you are sending the DO_SET_SERVO command?

#3

Thanks for the answer and sorry for my late one. On the weekends Im usually not in the lab :wink:

I call the service from the terminal (Ubuntu 16) directly to test it:

rosrun mavros mavcmd long 183 5 1500 0 0 0 0 0
So in this case I tried to set AUX5 to 1500 PWM signal. I tried also different AUX ports but non seems working like this. 183 is the corresponding value to DO_SET_SERVO as far as I understood from the documentation. I also tried the INT command just to be sure, but same result.

Of course the mavlink/mavros is also running as u can see in my previous post.

#4

@Bernhard The attitude controller and the retractable landing gear are on a different control group, I believe you can still use the actuator control setpoints in order to control the landing gear.

As you can see in the mavros_msgs/ActuatorControl message, you can set the group_mix to control the landing gear

#5

I was thinking of the mixer as well. Last time I had problems since despite the different control groups the sent messages seemed to interfere with the attitude controller. Ill give it a shot shortly and keep u up to date if it works with publishing Actuator controls.

Is the SET_SERVO in generel not supported by the PX4 stack ?

#6

Ok I tried to use the actuator control and published in the topic /mavros/actuator_control the following msgs:

header:
seq: 565
stamp:
secs: 1532958499
nsecs: 837877140
frame_id: “ENU”
group_mix: 2
controls: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1500.0]

Control group 2 should only correspond to payload aka gimball but it messes up the flight control. the flight control is handled in OFFBOARD mode by publishing attitudes in “/mavros/setpoint_raw/attitude”.

I guess the combination of the setpoint raw and the actuator control does not work out. Its a pitty that the SET_SERVO is not working for me.

#7

@Bernhard The actuator controls for groups 1, 2 and 3 is only enabled in the latest master (not on 1.8.0).

Also, the control should be: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] and the mode should be OFFBOARD.