I want to control the landing of my quadcopter using Mavlink messages and a telemetry dongle. i.e. my laptop has a dongle to send Mavlink messages to my quadcopter to actively update its landing position.
I have params PLND_ENABLE set to Enabled and PLND_TYPE set to CompanionComputer.
I ensure the quadcopter is hovering in Guided mode then send MAV_CMD_NAV_LAND and the quad descends as expected.
I then use mavlink_msg_landing_target_encode to send 20 messages separated by 300ms to set the landing target.
I have mavlink_landing_target_t members set as follows:
** size_x = 0.1
** size_y = 0.1
** angle_x = tan-1(-0.5) = -0.46 radians
** All other fields are zero.
The quadcopter descends in a vertical line, never deviating off that path. What am I doing wrong? I was expecting it to descend at the angle of 0.46*(180/pi) = 26 degrees off vertical.
Hello,
Do you have a downward-facing rangefinder enabled? If not, then you probably also need to specify the “distance” (i.e Distance to the target from the vehicle) field. Also, I am not sure, but why aren’t you setting the angle_y field?
Also, AFAIK at ardupilot backend, we ignore the size_x/y field.
I do not have a rangefinder or sensors of any type. That is why I am using PLND_TYPE set to CompanionComputer.
I don’t set angle_y as I just want to test landing in a westerly direction.
Yes you’re right, size_x and size_y are not used in libraries/AC_PrecLand/AC_PrecLand_Companion.cpp.
I will now say, I did try to set the distance field in previous tests but it did not make things work.
My function is like this:
set_landing_target(float east, float north, float height)
{
// Set a landing target. All other values will land in the current position.
mavlink_landing_target_t t;
t.angle_x = atan(east/height);
t.angle_y = atan(north/height);
t.distance = sqrtf(east*east + north*north + height*height);
mavlink_msg_landing_target_encode(system_id, companion_id, &message, &t);
}
I just tested this on a simulator. As long as you have distance and the angle fields mentioned (without rangefinder or DISTANCE_SENSOR mavlink message), and update rate is greater than 0.5 hz, everything should work…
Yes, tested on Master. But we haven’t had any substantial change in prec land for a long time so I guess Copter 4.0.x should be the same… I might be wrong though
Thanks, this explains why I could not use the precision landing feature. I will test this next week when I am able to fly my drone again.
Do you know if the distance sensor input to Arducopter takes into account the drone attitude? i.e. should I provide shortest vertical distance as the distance sensor reading?
If it is windy when landing, the drone will be tilted, thus giving a larger distance sensor reading than the shortest vertical distance to the ground.
@arduouspilot, its worth noting that if you have a downward facing rangefinder installed, the vehicle will slow down its vertical descend speed just before landing… the same is not true for without the rangefinder. So it’ll just land at a constant speed.
I have been trying to precision land using mavlink based script from Tony’s (not my code) for initial testing phase. Camera is facing down, RPi is talking to FC (pixhawk4)
The aruco marker is detected but no action happens from the drones end. The Z (distance) is also working without the use of any rangefinder.
Question:
When the marker is detected by camera, what flight mode should be selected for mavlink based precision landing?