Hi
I’m trying to debug a dronekit script which should move Aux Servo 1 but has no effect. Would someone help me out please?
python 3.4 on the latest apsync. dronekit-python is cloned from github today. Running on an Edison inside a Pixhawk 2.1.
The test script looks like this:
import sys
sys.path.append("/home/apsync/dronekit-python/")
print(sys.path)
import time
from dronekit import connect, VehicleMode, mavutil
connection_string = '0.0.0.0:9000'
def set_servo(vehicle, servo_number, pwm_value):
pwm_value_int = int(pwm_value)
msg = vehicle.message_factory.command_long_encode(
0, 0,
mavutil.mavlink.MAV_CMD_DO_SET_SERVO,
0,
servo_number,
pwm_value_int,
0,0,0,0,0
)
vehicle.send_mavlink(msg)
print("Connecting to plane on %s" % (connection_string,))
vehicle = connect(connection_string)
print(" GPS: %s" % vehicle.gps_0)
print(" Battery: %s" % vehicle.battery)
print(" Last Heartbeat: %s" % vehicle.last_heartbeat)
print(" Is Armable?: %s" % vehicle.is_armable)
print(" System status: %s" % vehicle.system_status.state)
print(" Mode: %s" % vehicle.mode.name)
for x in range(1, 60):
set_servo(vehicle, 1, 1100)
time.sleep(1)
set_servo(vehicle, 1, 1500)
time.sleep(1)
set_servo(vehicle, 1, 1100)
vehicle.close()
print("Completed")
and the output looks like this
apsync@apsync:~$ python3 servo.py
['/home/apsync', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-i386-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/lib/python3/dist-packages', '/home/apsync/dronekit-python/']
Connecting to plane on 0.0.0.0:9000
>>> Exception in message handler for HEARTBEAT
>>> mode (0, 0) not available on mavlink definition
>>> ArduPlane V3.8.0beta5 (708b483d)
>>> PX4: 8d505a02 NuttX: 1a99ba58
>>> PX4v2 0038002F 30365111 35323931
GPS: GPSInfo:fix=1,num_sat=0
Battery: Battery:voltage=0.0,current=None,level=None
Last Heartbeat: 0.05578364600000896
Is Armable?: False
System status: CRITICAL
Mode: RTL
>>> Exception in message handler for HEARTBEAT
>>> mode (0, 0) not available on mavlink definition
>>> Exception in message handler for HEARTBEAT
>>> mode (0, 0) not available on mavlink definition
>>> Exception in message handler for HEARTBEAT
>>> mode (0, 0) not available on mavlink definition
>>> Exception in message handler for HEARTBEAT
>>> mode (0, 0) not available on mavlink definition
...
Completed
None of the aux servos move.
Any ideas what I’ve missed and where more logging could be?
Thanks.