Hello everyone,
I’m trying to take off the drone by sending MAVLink command with a companion computer.
So far I have managed to set the flight mode and arm/disarm the drone.
My procedure is :
- Set the mode to GUIDED
- ARM the drone
- send a take off command with mavlink
The code looks like this (I’m using this library ESP32-MAVLink)
void MAVLink::takeoff(const float& height){
Serial.printf("Waypoint %d (takeoff) set as latitude : %f, longitude : %f, height : %f\n", this->mis_seq + 1, this->home_pos[0] / 1e7, this->home_pos[1] / 1e7, height);
mavlink_message_t msg;
uint8_t buf[MAVLINK_MAX_PACKET_LEN];
this->fly_alt = height;
uint16_t command = 22; //takeoff
uint8_t conf = 0;
float param7 = height;
mavlink_msg_mission_item_int_pack(
this->sys_id,
this->comp_id,
&msg,
this->tgt_sys,
this->tgt_comp,
this->mis_seq,
MAV_FRAME_GLOBAL_RELATIVE_ALT_INT,
command,
1,
1,
0, 0, 0, 0,
this->home_pos[0], // Home position latitude
this->home_pos[1], // Home position longitude
param7,
MAV_MISSION_TYPE_MISSION
);
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
Serial1.write(buf, len);
}
I am aware that this library is not perfect for my needs and that I may have to modify the MAVLink params but I’m not sure how.
After executing the code I get a message error :
Mission unaccepted with enum 1
Enum 1 is for Generic error / not accepting mission commands at all right now.
On mission planner I get this message :
got MISSION_REQUEST; use MISSION_REQUEST_INT!
I have the same error message when trying to set a waypoint or land the drone.
I don’t know how I’m supposed to fix that…
Thank you