aboutsummaryrefslogtreecommitdiff
path: root/src/modules/uavcan/uavcan_main.cpp
diff options
context:
space:
mode:
authorAndrew Chambers <achamber@gmail.com>2014-07-02 19:06:30 -0700
committerAndrew Chambers <achamber@gmail.com>2014-07-02 19:06:30 -0700
commit6c5e3d53412fa1cdad687818328b3bfc1a83e9ca (patch)
tree09d84c97c5da08ea1edee8d4c5528e56ec0bf120 /src/modules/uavcan/uavcan_main.cpp
parent607b6511a413b5bc2b2b0ae350a9451e83da9803 (diff)
downloadpx4-firmware-6c5e3d53412fa1cdad687818328b3bfc1a83e9ca.tar.gz
px4-firmware-6c5e3d53412fa1cdad687818328b3bfc1a83e9ca.tar.bz2
px4-firmware-6c5e3d53412fa1cdad687818328b3bfc1a83e9ca.zip
Address Paval's comments regarding extracting matrix from uavcan msg, position covariance calculation, and _poll_fds_num
Diffstat (limited to 'src/modules/uavcan/uavcan_main.cpp')
-rw-r--r--src/modules/uavcan/uavcan_main.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp
index c0c07be53..5bc437670 100644
--- a/src/modules/uavcan/uavcan_main.cpp
+++ b/src/modules/uavcan/uavcan_main.cpp
@@ -243,22 +243,21 @@ int UavcanNode::run()
_node.setStatusOk();
- /*
- * This event is needed to wake up the thread on CAN bus activity (RX/TX/Error).
- * Please note that with such multiplexing it is no longer possible to rely only on
- * the value returned from poll() to detect whether actuator control has timed out or not.
- * Instead, all ORB events need to be checked individually (see below).
- */
- _poll_fds[_poll_fds_num] = ::pollfd();
- _poll_fds[_poll_fds_num].fd = busevent_fd;
- _poll_fds[_poll_fds_num].events = POLLIN;
- _poll_fds_num += 1;
-
while (!_task_should_exit) {
if (_groups_subscribed != _groups_required) {
subscribe();
_groups_subscribed = _groups_required;
+ /*
+ * This event is needed to wake up the thread on CAN bus activity (RX/TX/Error).
+ * Please note that with such multiplexing it is no longer possible to rely only on
+ * the value returned from poll() to detect whether actuator control has timed out or not.
+ * Instead, all ORB events need to be checked individually (see below).
+ */
+ _poll_fds[_poll_fds_num] = ::pollfd();
+ _poll_fds[_poll_fds_num].fd = busevent_fd;
+ _poll_fds[_poll_fds_num].events = POLLIN;
+ _poll_fds_num += 1;
}
const int poll_ret = ::poll(_poll_fds, _poll_fds_num, PollTimeoutMs);
@@ -272,7 +271,7 @@ int UavcanNode::run()
} else {
// get controls for required topics
bool controls_updated = false;
- unsigned poll_id = 1;
+ unsigned poll_id = 0;
for (unsigned i = 0; i < NUM_ACTUATOR_CONTROL_GROUPS; i++) {
if (_control_subs[i] > 0) {
if (_poll_fds[poll_id].revents & POLLIN) {