mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 15:51:36 +08:00
orb_advert_t changed to void * and checks changed to nullptr
The existing orb_advert_t use thoughout the code sometimes tries to treat it as a file descriptor and there are checks for < 0 and ::close calls on orb_advert_t types which is an invalid use of an object pointer, which is what orb_advert_t really is. Initially I had changed the -1 initializations to 0 but it was suggested that this should be nullptr. That was a good recommendation but the definition of orb_advert_t had to change to void * because you cannot initialize a uintptr_t as nullptr. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
committed by
Lorenz Meier
parent
180c8b0cb0
commit
1ca05aaa64
@@ -129,11 +129,11 @@ AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() :
|
||||
_armedSub(-1),
|
||||
|
||||
/* publications */
|
||||
_att_pub(0),
|
||||
_global_pos_pub(0),
|
||||
_local_pos_pub(0),
|
||||
_estimator_status_pub(0),
|
||||
_wind_pub(0),
|
||||
_att_pub(nullptr),
|
||||
_global_pos_pub(nullptr),
|
||||
_local_pos_pub(nullptr),
|
||||
_estimator_status_pub(nullptr),
|
||||
_wind_pub(nullptr),
|
||||
|
||||
_att({}),
|
||||
_gyro({}),
|
||||
@@ -469,7 +469,7 @@ int AttitudePositionEstimatorEKF::check_filter_state()
|
||||
|
||||
|
||||
|
||||
if (_estimator_status_pub > 0) {
|
||||
if (_estimator_status_pub != nullptr) {
|
||||
orb_publish(ORB_ID(estimator_status), _estimator_status_pub, &rep);
|
||||
|
||||
} else {
|
||||
@@ -797,7 +797,7 @@ void AttitudePositionEstimatorEKF::publishAttitude()
|
||||
_att.rate_offsets[2] = _ekf->states[12] / _ekf->dtIMUfilt;
|
||||
|
||||
/* lazily publish the attitude only once available */
|
||||
if (_att_pub > 0) {
|
||||
if (_att_pub != nullptr) {
|
||||
/* publish the attitude setpoint */
|
||||
orb_publish(ORB_ID(vehicle_attitude), _att_pub, &_att);
|
||||
|
||||
@@ -830,7 +830,7 @@ void AttitudePositionEstimatorEKF::publishLocalPosition()
|
||||
_local_pos.yaw = _att.yaw;
|
||||
|
||||
/* lazily publish the local position only once available */
|
||||
if (_local_pos_pub > 0) {
|
||||
if (_local_pos_pub != nullptr) {
|
||||
/* publish the attitude setpoint */
|
||||
orb_publish(ORB_ID(vehicle_local_position), _local_pos_pub, &_local_pos);
|
||||
|
||||
@@ -878,7 +878,7 @@ void AttitudePositionEstimatorEKF::publishGlobalPosition()
|
||||
_global_pos.epv = _gps.epv;
|
||||
|
||||
/* lazily publish the global position only once available */
|
||||
if (_global_pos_pub > 0) {
|
||||
if (_global_pos_pub != nullptr) {
|
||||
/* publish the global position */
|
||||
orb_publish(ORB_ID(vehicle_global_position), _global_pos_pub, &_global_pos);
|
||||
|
||||
@@ -900,7 +900,7 @@ void AttitudePositionEstimatorEKF::publishWindEstimate()
|
||||
_wind.covariance_east = _ekf->P[15][15];
|
||||
|
||||
/* lazily publish the wind estimate only once available */
|
||||
if (_wind_pub > 0) {
|
||||
if (_wind_pub != nullptr) {
|
||||
/* publish the wind estimate */
|
||||
orb_publish(ORB_ID(wind_estimate), _wind_pub, &_wind);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user