mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00: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:
@@ -221,7 +221,7 @@ void BlockLocalPositionEstimator::update()
|
|||||||
{
|
{
|
||||||
|
|
||||||
// wait for a sensor update, check for exit condition every 100 ms
|
// wait for a sensor update, check for exit condition every 100 ms
|
||||||
int ret = poll(_polls, 3, 100);
|
int ret = px4_poll(_polls, 3, 100);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* poll error, count it in perf */
|
/* poll error, count it in perf */
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <px4_posix.h>
|
||||||
#include <controllib/uorb/blocks.hpp>
|
#include <controllib/uorb/blocks.hpp>
|
||||||
#include <mathlib/mathlib.h>
|
#include <mathlib/mathlib.h>
|
||||||
#include <systemlib/perf_counter.h>
|
#include <systemlib/perf_counter.h>
|
||||||
@@ -262,7 +263,7 @@ private:
|
|||||||
//BlockDelay<uint64_t, 1, 1, HIST_LEN> _tDelay;
|
//BlockDelay<uint64_t, 1, 1, HIST_LEN> _tDelay;
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
struct pollfd _polls[3];
|
px4_pollfd_struct_t _polls[3];
|
||||||
uint64_t _timeStamp;
|
uint64_t _timeStamp;
|
||||||
//uint64_t _time_last_hist;
|
//uint64_t _time_last_hist;
|
||||||
uint64_t _time_last_xy;
|
uint64_t _time_last_xy;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
void BlockSegwayController::update()
|
void BlockSegwayController::update()
|
||||||
{
|
{
|
||||||
// wait for a sensor update, check for exit condition every 100 ms
|
// 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();
|
uint64_t newTimeStamp = hrt_absolute_time();
|
||||||
float dt = (newTimeStamp - _timeStamp) / 1.0e6f;
|
float dt = (newTimeStamp - _timeStamp) / 1.0e6f;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <px4_posix.h>
|
||||||
#include <controllib/uorb/blocks.hpp>
|
#include <controllib/uorb/blocks.hpp>
|
||||||
|
|
||||||
using namespace control;
|
using namespace control;
|
||||||
@@ -22,7 +23,7 @@ private:
|
|||||||
enum {CH_LEFT, CH_RIGHT};
|
enum {CH_LEFT, CH_RIGHT};
|
||||||
BlockPI th2v;
|
BlockPI th2v;
|
||||||
BlockP q2v;
|
BlockP q2v;
|
||||||
struct pollfd _attPoll;
|
px4_pollfd_struct_t _attPoll;
|
||||||
uint64_t _timeStamp;
|
uint64_t _timeStamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user