AC_PrecLand: added BUS parameter for precision landing

allow selection of i2c bus for irlock
This commit is contained in:
Andrew Tridgell 2017-04-12 10:19:21 +10:00
parent 2eb363a950
commit 5d4400f1b7
5 changed files with 13 additions and 2 deletions

View File

@ -83,6 +83,13 @@ const AP_Param::GroupInfo AC_PrecLand::var_info[] = {
// @User: Advanced
AP_GROUPINFO("CAM_POS", 7, AC_PrecLand, _cam_offset, 0.0f),
// @Param: BUS
// @DisplayName: Sensor Bus
// @Description: Precland sensor bus for I2C sensors.
// @Values: -1:DefaultBus,0:InternalI2C,1:ExternalI2C
// @User: Advanced
AP_GROUPINFO("BUS", 8, AC_PrecLand, _bus, -1),
AP_GROUPEND
};

View File

@ -107,6 +107,7 @@ private:
// parameters
AP_Int8 _enabled; // enabled/disabled and behaviour
AP_Int8 _type; // precision landing sensor type
AP_Int8 _bus; // which sensor bus
AP_Int8 _estimator_type; // precision landing estimator type
AP_Float _yaw_align; // Yaw angle from body x-axis to sensor x-axis.
AP_Float _land_ofs_cm_x; // Desired landing position of the camera forward of the target in vehicle body frame

View File

@ -39,6 +39,9 @@ public:
// parses a mavlink message from the companion computer
virtual void handle_msg(mavlink_message_t* msg) {};
// get bus parameter
int8_t get_bus(void) const { return _frontend._bus.get(); }
protected:
const AC_PrecLand& _frontend; // reference to precision landing front end
AC_PrecLand::precland_state &_state; // reference to this instances state

View File

@ -15,7 +15,7 @@ AC_PrecLand_IRLock::AC_PrecLand_IRLock(const AC_PrecLand& frontend, AC_PrecLand:
// init - perform initialisation of this backend
void AC_PrecLand_IRLock::init()
{
irlock.init();
irlock.init(get_bus());
}
// update - give chance to driver to get updates from sensor

View File

@ -15,7 +15,7 @@ AC_PrecLand_SITL_Gazebo::AC_PrecLand_SITL_Gazebo(const AC_PrecLand& frontend, AC
// init - perform initialisation of this backend
void AC_PrecLand_SITL_Gazebo::init()
{
irlock.init();
irlock.init(get_bus());
}
// update - give chance to driver to get updates from sensor