How to access servo 9 output with custom code

I’m modifying Mavproxy and need to read the returned output from servo 9, similar to this:

       elif type == 'SERVO_OUTPUT_RAW':
            steer_servo=msg.servo4_raw
            self.ERS_console.set_status('Steer', 'Steer %u' % steer_servo)            
            kill_servo=msg.servo9_raw

However, there’s no servo9 in SERVO_OUTPUT_RAW. Now according to the MAVLINK spec there should be a “port” parameter, but I can’t see that in the Pymavlink spec (but I’m also not sure where to find the latest spec).

How do I choose the appropriate port?

Are you using MAVLink2?
Since MAVLink2 extension is starting with servo9_raw.
I just run my SITL firmware and connected to it using MAVProxy.
When I run watch SERVO_OUTPUT_RAW, I got the following:

< SERVO_OUTPUT_RAW {time_usec : 103344479, port : 0, servo1_raw : 1000, servo2_raw : 1000, servo3_raw : 1000, servo4_raw : 1000, servo5_raw : 0, servo6_raw : 0, servo7_raw : 0, servo8_raw : 0, servo9_raw : 0, servo10_raw : 0, servo11_raw : 0, servo12_raw : 0, servo13_raw : 0, servo14_raw : 0, servo15_raw : 0, servo16_raw : 0}
< SERVO_OUTPUT_RAW {time_usec : 104342413, port : 0, servo1_raw : 1000, servo2_raw : 1000, servo3_raw : 1000, servo4_raw : 1000, servo5_raw : 0, servo6_raw : 0, servo7_raw : 0, servo8_raw : 0, servo9_raw : 0, servo10_raw : 0, servo11_raw : 0, servo12_raw : 0, servo13_raw : 0, servo14_raw : 0, servo15_raw : 0, servo16_raw : 0}

Which has the servo9_raw field.
What do you mean by saying port?

Hmm, maybe I’m using Mavlink 1. I will check.

1 Like