Commit aa35c64a authored by Bryan Godbolt's avatar Bryan Godbolt

Merge branch 'radio'

parents 520823e1 6bd067bf
...@@ -246,6 +246,29 @@ void OpalLink::getSignals() ...@@ -246,6 +246,29 @@ void OpalLink::getSignals()
values[OpalRT::B_W_2] values[OpalRT::B_W_2]
); );
receiveMessage(bias); receiveMessage(bias);
/* send radio outputs */
mavlink_message_t rc;
mavlink_msg_rc_channels_pack(systemID, componentID, &rc,
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_1]),
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_2]),
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_3]),
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_4]),
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_5]),
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_6]),
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_7]),
duty2PulseMicros(values[OpalRT::RAW_CHANNEL_8]),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_1]*255),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_2]*255),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_3]*255),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_4]*255),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_5]*255),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_6]*255),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_7]*255),
static_cast<uint8_t>(values[OpalRT::NORM_CHANNEL_8]*255),
0 //rssi unused
);
receiveMessage(rc);
} }
else if (returnVal != EAGAIN) // if returnVal == EAGAIN => data just wasn't ready else if (returnVal != EAGAIN) // if returnVal == EAGAIN => data just wasn't ready
{ {
...@@ -294,6 +317,12 @@ bool OpalLink::isConnected() { ...@@ -294,6 +317,12 @@ bool OpalLink::isConnected() {
return connectState; return connectState;
} }
uint16_t OpalLink::duty2PulseMicros(double duty)
{
/* duty cycle assumed to be of a signal at 70 Hz */
return static_cast<uint16_t>(duty/70*1000000);
}
......
...@@ -151,6 +151,8 @@ protected: ...@@ -151,6 +151,8 @@ protected:
OpalRT::ParameterList *params; OpalRT::ParameterList *params;
unsigned short opalInstID; unsigned short opalInstID;
uint16_t duty2PulseMicros(double duty);
}; };
#endif // OPALLINK_H #endif // OPALLINK_H
...@@ -41,7 +41,7 @@ namespace OpalRT ...@@ -41,7 +41,7 @@ namespace OpalRT
Configuration info for the model Configuration info for the model
*/ */
const unsigned short NUM_OUTPUT_SIGNALS=39; const unsigned short NUM_OUTPUT_SIGNALS=57;
/* ------------------------------ Outputs ------------------------------ /* ------------------------------ Outputs ------------------------------
* *
...@@ -85,7 +85,25 @@ namespace OpalRT ...@@ -85,7 +85,25 @@ namespace OpalRT
B_F_2, B_F_2,
B_W_0, B_W_0,
B_W_1, B_W_1,
B_W_2 B_W_2,
RAW_CHANNEL_1 = 39,
RAW_CHANNEL_2,
RAW_CHANNEL_3,
RAW_CHANNEL_4,
RAW_CHANNEL_5,
RAW_CHANNEL_6,
RAW_CHANNEL_7,
RAW_CHANNEL_8,
NORM_CHANNEL_1,
NORM_CHANNEL_2,
NORM_CHANNEL_3,
NORM_CHANNEL_4,
NORM_CHANNEL_5,
NORM_CHANNEL_6,
NORM_CHANNEL_7,
NORM_CHANNEL_8,
CONTROLLER_AILERON,
CONTROLLER_ELEVATOR
}; };
/** Component IDs of the parameters. Currently they are all 1 becuase there is no advantage /** Component IDs of the parameters. Currently they are all 1 becuase there is no advantage
......
...@@ -979,6 +979,13 @@ void MainWindow::loadEngineerView() ...@@ -979,6 +979,13 @@ void MainWindow::loadEngineerView()
parametersDockWidget->show(); parametersDockWidget->show();
} }
// RADIO CONTROL VIEW
if (rcViewDockWidget)
{
addDockWidget(Qt::BottomDockWidgetArea, rcViewDockWidget);
rcViewDockWidget->show();
}
this->show(); this->show();
} }
......
...@@ -45,6 +45,7 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) : ...@@ -45,6 +45,7 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
channelLayout(new QVBoxLayout()), channelLayout(new QVBoxLayout()),
ui(new Ui::QGCRemoteControlView) ui(new Ui::QGCRemoteControlView)
{ {
//ui->setupUi(this); //ui->setupUi(this);
QGridLayout* layout = new QGridLayout(this); QGridLayout* layout = new QGridLayout(this);
layout->addLayout(channelLayout, 1, 0, 1, 2); layout->addLayout(channelLayout, 1, 0, 1, 2);
......
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