@hainh22 wrote:
Hi everyone,
I am trying to make the SITL of precision landing with companion computer feature work on Ubuntu. My setup is a Ubuntu installed in a Windows computer inside Virtual Box.
What I want to accomplish is very simple: Check that the Arducopter receive the landing target messages in Landing mode, from a Python script running Dronekit.
Below is my code for sending the message, a very simple one:
vehicle = connect('udp:0.0.0.0:14550',wait_ready=True)
def send_land_message(x, y):
msg = vehicle.message_factory.landing_target_encode(
0, # time_boot_ms (not used)
0, # target num
0, # frame
(x-horizontal_resolution/2)*horizontal_fov/horizontal_resolution,
(y-vertical_resolution/2)*vertical_fov/vertical_resolution,
0, # altitude. Not supported.
0,0) # size of target in radians
vehicle.send_mavlink(msg)
vehicle.flush()while(1):
if (vehicle.mode.name == "LAND"):
send_land_message(0,0)
time.sleep(0.1)
print "send"My routine is:
+ Go to Arducopter folder and run "sim_vehicle.py --console --map"
+ arm throttle
+ takeoff 30
+ when it reach 30, switch to guided by "mode guided"
+ run the above Python script from another terminal
+ switch to land mode by "mode land"I expect that the Arducopter can receive the landing target messages and control the vehicle accordingly however it just performs a normal landing. Looking on the flash log, the PL part (for precision landing) all components are zeros. At first I thought the way from Python to Arducopter was wrong, however, if I could send other messages just fine, for instance, this ned velocity message, the drone did move:
def send_ned_velocity(velocity_x, velocity_y, velocity_z):
msg = vehicle.message_factory.set_position_target_local_ned_encode(
0, # time_boot_ms (not used)
0, 0, # target system, target component
mavutil.mavlink.MAV_FRAME_LOCAL_NED, # frame
0b0000111111000111, # type_mask (only speeds enabled)
0, 0, 0, # x, y, z positions (not used)
velocity_x, velocity_y, -velocity_z, # x, y, z velocity in m/s
0, 0, 0, # x, y, z acceleration (not supported yet, ignored in GCS_Mavlink)
0, 0) # yaw, yaw_rate (not supported yet, ignored in GCS_Mavlink)
vehicle.send_mavlink(msg)
vehicle.flush()Could anyone show me some guidance on this? My version is the latest 3.5 on Master. Can this be a bug?. Thanks!
Posts: 4
Participants: 2