As suggested by Randy in another thread, I'm trying to use set_position_target_local_ned to control a quadcopter. Did my first test today (in a simulator) and I get an error. First, a little about my setup.
I'm running with dronekit-python, mavproxy and the vehicle_sim simulator. The simulator indicates that it's using: APM: ArduCopter V3.3-dev (10ec1b82). I created a simple test script to takeoff and then give a small x velocity using set_position_target_local_ned. Here's the relevant part of the script:
arm_and_takeoff()
home_loc = getPosition()
msg = vehicle.message_factory.set_position_target_local_ned_encode(
0, # time_boot_ms
0, 0, # target_system, target_component
mavutil.mavlink.MAV_FRAME_LOCAL_NED,
0, # type_mask
0, 0, 0, # x, y, z position
1, 0, 0, # v_x, v_y, v_z
0, 0, 0, # x, y, z acceleration
0, 0) # yaw, yaw_rate
vehicle.send_mavlink(msg)
vehicle.flush()
Note that arm_and_takeoff() is a function used in some of the examples included with dronekit and getPosition is a simple function I wrote.
Here's the error I get when I run the script:
Exception in APIThread-0: 'MPStatus' object has no attribute 'target_system'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 322, in run
self.fn()
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 593, in <lambda>
APIThread(self, lambda: execfile(args[1], g), args[1])
File "velocity_test.py", line 52, in <module>
vehicle.send_mavlink(msg)
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 244, in send_mavlink
self.__module.fix_targets(message)
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 392, in fix_targets
message.target_system = status.target_system
AttributeError: 'MPStatus' object has no attribute 'target_system'
The set_position_target_local_ned message is in the ardupilotmega.py file that I'm using so I don't think that's the issue. Does this error indicate that the simulator "firmware" doesn't support the command? It says that it's 3.3 so I assumed that it would. Is it something else?
If it is a firmware problem, I'll also likely need to update my Iris+ before trying this on a real vehicle. How stable is the APM version that includes support for set_position_target_local_ned?
Thanks.
David