|
|
@ -354,15 +354,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) |
|
|
|
case MAVLINK_MSG_ID_DEBUG: |
|
|
|
case MAVLINK_MSG_ID_DEBUG: |
|
|
|
emit valueChanged(uasId, QString("debug ") + QString::number(mavlink_msg_debug_get_ind(&message)), mavlink_msg_debug_get_value(&message), MG::TIME::getGroundTimeNow()); |
|
|
|
emit valueChanged(uasId, QString("debug ") + QString::number(mavlink_msg_debug_get_ind(&message)), mavlink_msg_debug_get_value(&message), MG::TIME::getGroundTimeNow()); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MAVLINK_MSG_ID_WAYPOINT: |
|
|
|
case MAVLINK_MSG_ID_WAYPOINT: |
|
|
|
{ |
|
|
|
{ |
|
|
|
mavlink_waypoint_t wp; |
|
|
|
mavlink_waypoint_t wp; |
|
|
|
mavlink_msg_waypoint_decode(&message, &wp); |
|
|
|
mavlink_msg_waypoint_decode(&message, &wp); |
|
|
|
// FIXME
|
|
|
|
// FIXME
|
|
|
|
emit waypointUpdated(uasId, wp.id, wp.x, wp.y, wp.z, wp.yaw, wp.autocontinue, true); |
|
|
|
emit waypointUpdated(uasId, wp.id, wp.x, wp.y, wp.z, wp.yaw, wp.autocontinue, wp.active); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MAVLINK_MSG_ID_WAYPOINT_REACHED: |
|
|
|
case MAVLINK_MSG_ID_WAYPOINT_REACHED: |
|
|
|
{ |
|
|
|
{ |
|
|
|
mavlink_waypoint_reached_t wp; |
|
|
|
mavlink_waypoint_reached_t wp; |
|
|
|
mavlink_msg_waypoint_reached_decode(&message, &wp); |
|
|
|
mavlink_msg_waypoint_reached_decode(&message, &wp); |
|
|
@ -377,7 +377,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) |
|
|
|
//b.append('\0');
|
|
|
|
//b.append('\0');
|
|
|
|
QString text = QString(b); |
|
|
|
QString text = QString(b); |
|
|
|
int severity = mavlink_msg_statustext_get_severity(&message); |
|
|
|
int severity = mavlink_msg_statustext_get_severity(&message); |
|
|
|
//qDebug() << "RECEIVED STATUS:" << text;
|
|
|
|
//qDebug() << "RECEIVED STATUS:" << text;false
|
|
|
|
//emit statusTextReceived(severity, text);
|
|
|
|
//emit statusTextReceived(severity, text);
|
|
|
|
emit textMessageReceived(uasId, severity, text); |
|
|
|
emit textMessageReceived(uasId, severity, text); |
|
|
|
} |
|
|
|
} |
|
|
@ -559,17 +559,16 @@ int UAS::getCommunicationStatus() const |
|
|
|
void UAS::requestWaypoints() |
|
|
|
void UAS::requestWaypoints() |
|
|
|
{ |
|
|
|
{ |
|
|
|
mavlink_message_t msg; |
|
|
|
mavlink_message_t msg; |
|
|
|
//messagePackGetWaypoints(MG::SYSTEM::ID, &message); FIXME
|
|
|
|
mavlink_msg_waypoint_request_list_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, uasId, 25); |
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
sendMessage(msg); |
|
|
|
sendMessage(msg); |
|
|
|
sendMessage(msg); |
|
|
|
|
|
|
|
qDebug() << "UAS Request WPs"; |
|
|
|
qDebug() << "UAS Request WPs"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UAS::requestParameters() |
|
|
|
void UAS::requestParameters() |
|
|
|
{ |
|
|
|
{ |
|
|
|
mavlink_message_t msg; |
|
|
|
mavlink_message_t msg; |
|
|
|
mavlink_msg_param_request_list_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), 0); |
|
|
|
mavlink_msg_param_request_list_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), 25); |
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
sendMessage(msg); |
|
|
|
sendMessage(msg); |
|
|
|
} |
|
|
|
} |
|
|
@ -839,8 +838,9 @@ void UAS::setWaypoint(Waypoint* wp) |
|
|
|
//name.truncate(MAVLINK_MSG_WAYPOINT_SET_FIELD_NAME_LEN);
|
|
|
|
//name.truncate(MAVLINK_MSG_WAYPOINT_SET_FIELD_NAME_LEN);
|
|
|
|
//strcpy((char*)set.name, name.toStdString().c_str());
|
|
|
|
//strcpy((char*)set.name, name.toStdString().c_str());
|
|
|
|
set.autocontinue = wp->autocontinue; |
|
|
|
set.autocontinue = wp->autocontinue; |
|
|
|
set.target_component = 0; |
|
|
|
set.target_component = 25; // FIXME
|
|
|
|
set.target_system = uasId; |
|
|
|
set.target_system = uasId; |
|
|
|
|
|
|
|
set.active = wp->current; |
|
|
|
set.x = wp->x; |
|
|
|
set.x = wp->x; |
|
|
|
set.y = wp->y; |
|
|
|
set.y = wp->y; |
|
|
|
set.z = wp->z; |
|
|
|
set.z = wp->z; |
|
|
@ -848,7 +848,6 @@ void UAS::setWaypoint(Waypoint* wp) |
|
|
|
mavlink_msg_waypoint_set_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &set); |
|
|
|
mavlink_msg_waypoint_set_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &set); |
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
sendMessage(msg); |
|
|
|
sendMessage(msg); |
|
|
|
sendMessage(msg); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UAS::setWaypointActive(int id) |
|
|
|
void UAS::setWaypointActive(int id) |
|
|
@ -857,7 +856,7 @@ void UAS::setWaypointActive(int id) |
|
|
|
mavlink_waypoint_set_active_t active; |
|
|
|
mavlink_waypoint_set_active_t active; |
|
|
|
active.id = id; |
|
|
|
active.id = id; |
|
|
|
active.target_system = uasId; |
|
|
|
active.target_system = uasId; |
|
|
|
active.target_component = 0; // FIXME
|
|
|
|
active.target_component = 25; // FIXME
|
|
|
|
mavlink_msg_waypoint_set_active_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &active); |
|
|
|
mavlink_msg_waypoint_set_active_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &active); |
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
sendMessage(msg); |
|
|
|
sendMessage(msg); |
|
|
@ -1090,9 +1089,12 @@ void UAS::stopLowBattAlarm() |
|
|
|
|
|
|
|
|
|
|
|
void UAS::clearWaypointList() |
|
|
|
void UAS::clearWaypointList() |
|
|
|
{ |
|
|
|
{ |
|
|
|
mavlink_message_t message; |
|
|
|
mavlink_message_t msg; |
|
|
|
// FIXME
|
|
|
|
// FIXME
|
|
|
|
//messagePackRemoveWaypoints(MG::SYSTEM::ID, &message);
|
|
|
|
mavlink_waypoint_clear_list_t clist; |
|
|
|
sendMessage(message); |
|
|
|
clist.target_system = uasId; |
|
|
|
|
|
|
|
clist.target_component = 25; // FIXME
|
|
|
|
|
|
|
|
mavlink_msg_waypoint_clear_list_encode(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, &clist); |
|
|
|
|
|
|
|
sendMessage(msg); |
|
|
|
qDebug() << "UAS clears Waypoints!"; |
|
|
|
qDebug() << "UAS clears Waypoints!"; |
|
|
|
} |
|
|
|
} |
|
|
|