mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 16:23:34 +08:00
@@ -134,7 +134,10 @@ MODULES += lib/geo
|
|||||||
|
|
||||||
# Tutorial code from
|
# Tutorial code from
|
||||||
# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control
|
# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control
|
||||||
MODULES += examples/fixedwing_control
|
#MODULES += examples/fixedwing_control
|
||||||
|
|
||||||
|
# Hardware test
|
||||||
|
#MODULES += examples/hwtest
|
||||||
|
|
||||||
#
|
#
|
||||||
# Transitional support - add commands from the NuttX export archive.
|
# Transitional support - add commands from the NuttX export archive.
|
||||||
|
|||||||
@@ -128,8 +128,12 @@ MODULES += lib/geo
|
|||||||
# https://pixhawk.ethz.ch/px4/dev/debug_values
|
# https://pixhawk.ethz.ch/px4/dev/debug_values
|
||||||
#MODULES += examples/px4_mavlink_debug
|
#MODULES += examples/px4_mavlink_debug
|
||||||
|
|
||||||
|
# Tutorial code from
|
||||||
|
# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control
|
||||||
|
#MODULES += examples/fixedwing_control
|
||||||
|
|
||||||
# Hardware test
|
# Hardware test
|
||||||
MODULES += examples/hwtest
|
#MODULES += examples/hwtest
|
||||||
|
|
||||||
#
|
#
|
||||||
# Transitional support - add commands from the NuttX export archive.
|
# Transitional support - add commands from the NuttX export archive.
|
||||||
|
|||||||
@@ -166,19 +166,19 @@ protected:
|
|||||||
double lat, lon; /**< lat, lon radians */
|
double lat, lon; /**< lat, lon radians */
|
||||||
float alt; /**< altitude, meters */
|
float alt; /**< altitude, meters */
|
||||||
// parameters
|
// parameters
|
||||||
control::BlockParam<float> _vGyro; /**< gyro process noise */
|
control::BlockParamFloat _vGyro; /**< gyro process noise */
|
||||||
control::BlockParam<float> _vAccel; /**< accelerometer process noise */
|
control::BlockParamFloat _vAccel; /**< accelerometer process noise */
|
||||||
control::BlockParam<float> _rMag; /**< magnetometer measurement noise */
|
control::BlockParamFloat _rMag; /**< magnetometer measurement noise */
|
||||||
control::BlockParam<float> _rGpsVel; /**< gps velocity measurement noise */
|
control::BlockParamFloat _rGpsVel; /**< gps velocity measurement noise */
|
||||||
control::BlockParam<float> _rGpsPos; /**< gps position measurement noise */
|
control::BlockParamFloat _rGpsPos; /**< gps position measurement noise */
|
||||||
control::BlockParam<float> _rGpsAlt; /**< gps altitude measurement noise */
|
control::BlockParamFloat _rGpsAlt; /**< gps altitude measurement noise */
|
||||||
control::BlockParam<float> _rPressAlt; /**< press altitude measurement noise */
|
control::BlockParamFloat _rPressAlt; /**< press altitude measurement noise */
|
||||||
control::BlockParam<float> _rAccel; /**< accelerometer measurement noise */
|
control::BlockParamFloat _rAccel; /**< accelerometer measurement noise */
|
||||||
control::BlockParam<float> _magDip; /**< magnetic inclination with level */
|
control::BlockParamFloat _magDip; /**< magnetic inclination with level */
|
||||||
control::BlockParam<float> _magDec; /**< magnetic declination, clockwise rotation */
|
control::BlockParamFloat _magDec; /**< magnetic declination, clockwise rotation */
|
||||||
control::BlockParam<float> _g; /**< gravitational constant */
|
control::BlockParamFloat _g; /**< gravitational constant */
|
||||||
control::BlockParam<float> _faultPos; /**< fault detection threshold for position */
|
control::BlockParamFloat _faultPos; /**< fault detection threshold for position */
|
||||||
control::BlockParam<float> _faultAtt; /**< fault detection threshold for attitude */
|
control::BlockParamFloat _faultAtt; /**< fault detection threshold for attitude */
|
||||||
// status
|
// status
|
||||||
bool _attitudeInitialized;
|
bool _attitudeInitialized;
|
||||||
bool _positionInitialized;
|
bool _positionInitialized;
|
||||||
|
|||||||
@@ -69,22 +69,39 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* Parameters that are tied to blocks for updating and nameing.
|
* Parameters that are tied to blocks for updating and nameing.
|
||||||
*/
|
*/
|
||||||
template<class T>
|
|
||||||
class __EXPORT BlockParam : public BlockParamBase
|
class __EXPORT BlockParamFloat : public BlockParamBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockParam(Block *block, const char *name, bool parent_prefix=true) :
|
BlockParamFloat(Block *block, const char *name, bool parent_prefix=true) :
|
||||||
BlockParamBase(block, name, parent_prefix),
|
BlockParamBase(block, name, parent_prefix),
|
||||||
_val() {
|
_val() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
T get() { return _val; }
|
float get() { return _val; }
|
||||||
void set(T val) { _val = val; }
|
void set(float val) { _val = val; }
|
||||||
void update() {
|
void update() {
|
||||||
if (_handle != PARAM_INVALID) param_get(_handle, &_val);
|
if (_handle != PARAM_INVALID) param_get(_handle, &_val);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
T _val;
|
float _val;
|
||||||
|
};
|
||||||
|
|
||||||
|
class __EXPORT BlockParamInt : public BlockParamBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BlockParamInt(Block *block, const char *name, bool parent_prefix=true) :
|
||||||
|
BlockParamBase(block, name, parent_prefix),
|
||||||
|
_val() {
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
int get() { return _val; }
|
||||||
|
void set(int val) { _val = val; }
|
||||||
|
void update() {
|
||||||
|
if (_handle != PARAM_INVALID) param_get(_handle, &_val);
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
int _val;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace control
|
} // namespace control
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ public:
|
|||||||
float getMax() { return _max.get(); }
|
float getMax() { return _max.get(); }
|
||||||
protected:
|
protected:
|
||||||
// attributes
|
// attributes
|
||||||
BlockParam<float> _min;
|
control::BlockParamFloat _min;
|
||||||
BlockParam<float> _max;
|
control::BlockParamFloat _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockLimitTest();
|
int __EXPORT blockLimitTest();
|
||||||
@@ -99,7 +99,7 @@ public:
|
|||||||
float getMax() { return _max.get(); }
|
float getMax() { return _max.get(); }
|
||||||
protected:
|
protected:
|
||||||
// attributes
|
// attributes
|
||||||
BlockParam<float> _max;
|
control::BlockParamFloat _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockLimitSymTest();
|
int __EXPORT blockLimitSymTest();
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
// attributes
|
// attributes
|
||||||
float _state;
|
float _state;
|
||||||
BlockParam<float> _fCut;
|
control::BlockParamFloat _fCut;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockLowPassTest();
|
int __EXPORT blockLowPassTest();
|
||||||
@@ -157,7 +157,7 @@ protected:
|
|||||||
// attributes
|
// attributes
|
||||||
float _u; /**< previous input */
|
float _u; /**< previous input */
|
||||||
float _y; /**< previous output */
|
float _y; /**< previous output */
|
||||||
BlockParam<float> _fCut; /**< cut-off frequency, Hz */
|
control::BlockParamFloat _fCut; /**< cut-off frequency, Hz */
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockHighPassTest();
|
int __EXPORT blockHighPassTest();
|
||||||
@@ -273,7 +273,7 @@ public:
|
|||||||
// accessors
|
// accessors
|
||||||
float getKP() { return _kP.get(); }
|
float getKP() { return _kP.get(); }
|
||||||
protected:
|
protected:
|
||||||
BlockParam<float> _kP;
|
control::BlockParamFloat _kP;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockPTest();
|
int __EXPORT blockPTest();
|
||||||
@@ -303,8 +303,8 @@ public:
|
|||||||
BlockIntegral &getIntegral() { return _integral; }
|
BlockIntegral &getIntegral() { return _integral; }
|
||||||
private:
|
private:
|
||||||
BlockIntegral _integral;
|
BlockIntegral _integral;
|
||||||
BlockParam<float> _kP;
|
control::BlockParamFloat _kP;
|
||||||
BlockParam<float> _kI;
|
control::BlockParamFloat _kI;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockPITest();
|
int __EXPORT blockPITest();
|
||||||
@@ -334,8 +334,8 @@ public:
|
|||||||
BlockDerivative &getDerivative() { return _derivative; }
|
BlockDerivative &getDerivative() { return _derivative; }
|
||||||
private:
|
private:
|
||||||
BlockDerivative _derivative;
|
BlockDerivative _derivative;
|
||||||
BlockParam<float> _kP;
|
control::BlockParamFloat _kP;
|
||||||
BlockParam<float> _kD;
|
control::BlockParamFloat _kD;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockPDTest();
|
int __EXPORT blockPDTest();
|
||||||
@@ -372,9 +372,9 @@ private:
|
|||||||
// attributes
|
// attributes
|
||||||
BlockIntegral _integral;
|
BlockIntegral _integral;
|
||||||
BlockDerivative _derivative;
|
BlockDerivative _derivative;
|
||||||
BlockParam<float> _kP;
|
control::BlockParamFloat _kP;
|
||||||
BlockParam<float> _kI;
|
control::BlockParamFloat _kI;
|
||||||
BlockParam<float> _kD;
|
control::BlockParamFloat _kD;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockPIDTest();
|
int __EXPORT blockPIDTest();
|
||||||
@@ -404,7 +404,7 @@ public:
|
|||||||
float get() { return _val; }
|
float get() { return _val; }
|
||||||
private:
|
private:
|
||||||
// attributes
|
// attributes
|
||||||
BlockParam<float> _trim;
|
control::BlockParamFloat _trim;
|
||||||
BlockLimit _limit;
|
BlockLimit _limit;
|
||||||
float _val;
|
float _val;
|
||||||
};
|
};
|
||||||
@@ -439,8 +439,8 @@ public:
|
|||||||
float getMax() { return _max.get(); }
|
float getMax() { return _max.get(); }
|
||||||
private:
|
private:
|
||||||
// attributes
|
// attributes
|
||||||
BlockParam<float> _min;
|
control::BlockParamFloat _min;
|
||||||
BlockParam<float> _max;
|
control::BlockParamFloat _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockRandUniformTest();
|
int __EXPORT blockRandUniformTest();
|
||||||
@@ -486,8 +486,8 @@ public:
|
|||||||
float getStdDev() { return _stdDev.get(); }
|
float getStdDev() { return _stdDev.get(); }
|
||||||
private:
|
private:
|
||||||
// attributes
|
// attributes
|
||||||
BlockParam<float> _mean;
|
control::BlockParamFloat _mean;
|
||||||
BlockParam<float> _stdDev;
|
control::BlockParamFloat _stdDev;
|
||||||
};
|
};
|
||||||
|
|
||||||
int __EXPORT blockRandGaussTest();
|
int __EXPORT blockRandGaussTest();
|
||||||
|
|||||||
Reference in New Issue
Block a user