I’m working on APM 2.5 retroware. Mission Planner 1.3.44, ArduCopter 3.2.1. I attached a servo to my power distribution board and RC10. Then I ran the following code:
def CountDown (phrase,maxcount): #This just makes an announcement and does a countdown
for value in range(maxcount,0,-1):
payload_servo = 10
CountDown(“Servo test 1”,3)
CountDown(“Servo test 2”,3)
I get the two messages and the countdown, but the Script.SendRC’s do nothing. When I test the servos at the MP’s Servo tab, they work just fine, clockwise for low and counterclockwise for high. I checked that under Config/Tuning RC10_FUNCTION is set to 0. Later I changed RC10_TRIM to 1500, but my script still didn’t do anything. My code seems awfully short to not work. Am I missing something? (Also, how can I make my code show up as code in the forum?)
SendRC only support the first 8 channels
Hi, Michael, thanks for responding so quickly (and thanks for all of your work on Mission Planner- I look forward to properly supporting the project after I graduate). The “common-servo” page states that for 2.x, the servo has to be connected to either A10 or A11. If SendRC only supports the first 8 channels, how can I send a specific PWM to channel 10 in Python script?
MAV.doCommand(MAVLink.MAV_CMD.DO_SET_SERVO, servo, pwm, 0, 0, 0, 0, 0)
this is the same code the servo tab uses
Thank you Michael, that worked. However I did have to try out a few statements at the beginning of the code so it knew what MAVLink was. After Googling for example code, I added the following:
I don’t know which of those were necessary, but it worked after that. Thanks again.
Dear Michael Oborne,
cygwin says “MAV was not declared in this scope”… How can I solve this?
Did you add
import MissionPlanner before the statement
MAV.doCommand(MAVLink.MAV_CMD.DO_SET_SERVO, servo, pwm, 0, 0, 0, 0, 0)?
MAV is defined in (MissionPlanner/ ExtLibs/ ArduPilot/ Mavlink/ MAVLinkInterface.cs) (Please see the line 217;
public MAVState MAV)
I think you just need to import the statement below:
from MissionPlanner.ExLibs.ArduPilot.Mavlink import MAVLinkInterface.cs
Hello, might want to ask if mav_cmd.do_set_servo work command works on manual mode?