mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 05:33:33 +08:00
switch the modules implementing the block structure to px4_poll such that in posix_sitl simulation the poll works as expected, blocks the module and doesn't overload the CPU
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
void BlockSegwayController::update()
|
||||
{
|
||||
// wait for a sensor update, check for exit condition every 100 ms
|
||||
if (poll(&_attPoll, 1, 100) < 0) { return; } // poll error
|
||||
if (px4_poll(&_attPoll, 1, 100) < 0) { return; } // poll error
|
||||
|
||||
uint64_t newTimeStamp = hrt_absolute_time();
|
||||
float dt = (newTimeStamp - _timeStamp) / 1.0e6f;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <px4_posix.h>
|
||||
#include <controllib/uorb/blocks.hpp>
|
||||
|
||||
using namespace control;
|
||||
@@ -22,7 +23,7 @@ private:
|
||||
enum {CH_LEFT, CH_RIGHT};
|
||||
BlockPI th2v;
|
||||
BlockP q2v;
|
||||
struct pollfd _attPoll;
|
||||
px4_pollfd_struct_t _attPoll;
|
||||
uint64_t _timeStamp;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user