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
print phrase
for value in range(maxcount,0,-1):
print value
Script.Sleep(1000)
payload_servo = 10
CountDown(“Servo test 1”,3)
Script.SendRC(payload_servo,1200,True)
CountDown(“Servo test 2”,3)
Script.SendRC(payload_servo,1500,True)
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?)
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?
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 think you just need to import the statement below: from MissionPlanner.ExLibs.ArduPilot.Mavlink import MAVLinkInterface.cs
or just import MissionPlanner