Commit 5323cfa9 authored by James Goppert's avatar James Goppert

Enabled data streams for common interface.

parent 1e004938
......@@ -187,6 +187,7 @@ void SerialLink::readBytes()
const qint64 maxLength = 2048;
char data[maxLength];
qint64 numBytes = port->bytesAvailable();
if(numBytes > 0)
{
/* Read as much data in buffer as possible without overflow */
......
......@@ -881,13 +881,12 @@ void UAS::readParametersFromStorage()
void UAS::enableAllDataTransmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
// 0 is a magic ID and will enable/disable the standard message set except for heartbeat
stream.req_stream_id = 0;
stream.req_stream_id = MAV_DATA_STREAM_ALL;
// Select the update rate in Hz the message should be send
// All messages will be send with their default rate
stream.req_message_rate = 0;
......@@ -902,17 +901,15 @@ void UAS::enableAllDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enableRawSensorDataTransmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 1;
stream.req_stream_id = MAV_DATA_STREAM_RAW_SENSORS;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -926,17 +923,15 @@ void UAS::enableRawSensorDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enableExtendedSystemStatusTransmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 2;
stream.req_stream_id = MAV_DATA_STREAM_EXTENDED_STATUS;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 10;
// Start / stop the message
......@@ -950,17 +945,19 @@ void UAS::enableExtendedSystemStatusTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enableRCChannelDataTransmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
#if defined(MAVLINK_ENABLED_UALBERTA_MESSAGES)
mavlink_message_t msg;
mavlink_msg_request_rc_channels_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, enabled);
sendMessage(msg);
#else
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 3;
stream.req_stream_id = MAV_DATA_STREAM_RC_CHANNELS;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -974,21 +971,16 @@ void UAS::enableRCChannelDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#elif defined(MAVLINK_ENABLED_UALBERTA_MESSAGES)
mavlink_message_t msg;
mavlink_msg_request_rc_channels_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, enabled);
sendMessage(msg);
#endif
}
void UAS::enableRawControllerDataTransmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 4;
stream.req_stream_id = MAV_DATA_STREAM_RAW_CONTROLLER;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -1002,17 +994,15 @@ void UAS::enableRawControllerDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enableRawSensorFusionTransmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 5;
stream.req_stream_id = MAV_DATA_STREAM_RAW_SENSOR_FUSION;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -1026,17 +1016,15 @@ void UAS::enableRawSensorFusionTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enablePositionTransmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 6;
stream.req_stream_id = MAV_DATA_STREAM_POSITION;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -1050,17 +1038,15 @@ void UAS::enablePositionTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enableExtra1Transmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 7;
stream.req_stream_id = MAV_DATA_STREAM_EXTRA1;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -1074,17 +1060,15 @@ void UAS::enableExtra1Transmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enableExtra2Transmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 8;
stream.req_stream_id = MAV_DATA_STREAM_EXTRA2;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -1098,17 +1082,15 @@ void UAS::enableExtra2Transmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
void UAS::enableExtra3Transmission(bool enabled)
{
#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
stream.req_stream_id = 9;
stream.req_stream_id = MAV_DATA_STREAM_EXTRA3;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
......@@ -1122,7 +1104,6 @@ void UAS::enableExtra3Transmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
#endif
}
/**
......
......@@ -37,7 +37,6 @@ QGCSensorSettingsWidget::QGCSensorSettingsWidget(UASInterface* uas, QWidget *par
ui(new Ui::QGCSensorSettingsWidget)
{
ui->setupUi(this);
connect(ui->sendRawCheckBox, SIGNAL(toggled(bool)), mav, SLOT(enableRawSensorDataTransmission(bool)));
connect(ui->sendControllerCheckBox, SIGNAL(toggled(bool)), mav, SLOT(enableRawControllerDataTransmission(bool)));
connect(ui->sendExtendedCheckBox, SIGNAL(toggled(bool)), mav, SLOT(enableExtendedSystemStatusTransmission(bool)));
......
......@@ -98,13 +98,25 @@
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="sendRawCheckBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>RAW Sensor Data</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="sendRCCheckBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>RC Values</string>
</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment