mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 13:03:34 +08:00
Port PX4 to BeagleBone Blue Board using library librobotcontrol instead of a submodule
This commit is contained in:
@@ -145,6 +145,7 @@ void initialize_parameter_handles(ParameterHandles ¶meter_handles)
|
||||
parameter_handles.battery_v_div = param_find("BAT_V_DIV");
|
||||
parameter_handles.battery_a_per_v = param_find("BAT_A_PER_V");
|
||||
parameter_handles.battery_source = param_find("BAT_SOURCE");
|
||||
parameter_handles.battery_adc_channel = param_find("BAT_ADC_CHANNEL");
|
||||
|
||||
/* rotations */
|
||||
parameter_handles.board_rotation = param_find("SENS_BOARD_ROT");
|
||||
@@ -423,7 +424,8 @@ int update_parameters(const ParameterHandles ¶meter_handles, Parameters &par
|
||||
param_set_no_notification(parameter_handles.battery_a_per_v, ¶meters.battery_a_per_v);
|
||||
}
|
||||
|
||||
param_get(parameter_handles.battery_source, &(parameters.battery_source));
|
||||
param_get(parameter_handles.battery_source, &(parameters.battery_source));
|
||||
param_get(parameter_handles.battery_adc_channel, &(parameters.battery_adc_channel));
|
||||
|
||||
param_get(parameter_handles.board_rotation, &(parameters.board_rotation));
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ struct Parameters {
|
||||
float battery_v_div;
|
||||
float battery_a_per_v;
|
||||
int32_t battery_source;
|
||||
int32_t battery_adc_channel;
|
||||
|
||||
float baro_qnh;
|
||||
|
||||
@@ -223,6 +224,7 @@ struct ParameterHandles {
|
||||
param_t battery_v_div;
|
||||
param_t battery_a_per_v;
|
||||
param_t battery_source;
|
||||
param_t battery_adc_channel;
|
||||
|
||||
param_t board_rotation;
|
||||
|
||||
|
||||
@@ -98,10 +98,20 @@ PARAM_DEFINE_FLOAT(BAT_A_PER_V, -1.0);
|
||||
* means that measurements are expected to come from a power module. If the value is set to
|
||||
* 'External' then the system expects to receive mavlink battery status messages.
|
||||
*
|
||||
* @min 0
|
||||
* @min -1
|
||||
* @max 1
|
||||
* @value 0 Power Module
|
||||
* @value 1 External
|
||||
* @group Battery Calibration
|
||||
*/
|
||||
PARAM_DEFINE_INT32(BAT_SOURCE, 0);
|
||||
|
||||
/**
|
||||
* Battery ADC Channel
|
||||
*
|
||||
* This parameter specifies the ADC channel used to monitor voltage of main power battery.
|
||||
* A value of -1 means to use the board default.
|
||||
*
|
||||
* @group Battery Calibration
|
||||
*/
|
||||
PARAM_DEFINE_INT32(BAT_ADC_CHANNEL, -1);
|
||||
|
||||
@@ -443,6 +443,10 @@ Sensors::adc_poll()
|
||||
int bat_voltage_v_chan[BOARD_NUMBER_BRICKS] = BOARD_BATT_V_LIST;
|
||||
int bat_voltage_i_chan[BOARD_NUMBER_BRICKS] = BOARD_BATT_I_LIST;
|
||||
|
||||
if (_parameters.battery_adc_channel >= 0) { // overwrite default
|
||||
bat_voltage_v_chan[0] = _parameters.battery_adc_channel;
|
||||
}
|
||||
|
||||
/* The valid signals (HW dependent) are associated with each brick */
|
||||
bool valid_chan[BOARD_NUMBER_BRICKS] = BOARD_BRICK_VALID_LIST;
|
||||
|
||||
|
||||
@@ -626,6 +626,7 @@ void VotedSensorsUpdate::accel_poll(struct sensor_combined_s &raw)
|
||||
|
||||
// write the best sensor data to the output variables
|
||||
if (best_index >= 0) {
|
||||
raw.timestamp = _last_sensor_data[best_index].timestamp;
|
||||
raw.accelerometer_integral_dt = _last_sensor_data[best_index].accelerometer_integral_dt;
|
||||
memcpy(&raw.accelerometer_m_s2, &_last_sensor_data[best_index].accelerometer_m_s2, sizeof(raw.accelerometer_m_s2));
|
||||
|
||||
@@ -1022,7 +1023,7 @@ void VotedSensorsUpdate::print_status()
|
||||
bool
|
||||
VotedSensorsUpdate::apply_gyro_calibration(DevHandle &h, const struct gyro_calibration_s *gcal, const int device_id)
|
||||
{
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP) && !defined(__PX4_POSIX_BBBLUE)
|
||||
|
||||
/* On most systems, we can just use the IOCTL call to set the calibration params. */
|
||||
return !h.ioctl(GYROIOCSSCALE, (long unsigned int)gcal);
|
||||
@@ -1036,7 +1037,7 @@ VotedSensorsUpdate::apply_gyro_calibration(DevHandle &h, const struct gyro_calib
|
||||
bool
|
||||
VotedSensorsUpdate::apply_accel_calibration(DevHandle &h, const struct accel_calibration_s *acal, const int device_id)
|
||||
{
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP) && !defined(__PX4_POSIX_BBBLUE)
|
||||
|
||||
/* On most systems, we can just use the IOCTL call to set the calibration params. */
|
||||
return !h.ioctl(ACCELIOCSSCALE, (long unsigned int)acal);
|
||||
|
||||
Reference in New Issue
Block a user