double promotion warning fix or ignore per module

This commit is contained in:
Daniel Agar
2018-01-07 21:43:17 -05:00
committed by Lorenz Meier
parent 11d348ec4f
commit cf74166801
41 changed files with 93 additions and 75 deletions
+8 -8
View File
@@ -386,8 +386,8 @@ int commander_main(int argc, char *argv[])
struct vehicle_command_s cmd = {
.timestamp = hrt_absolute_time(),
.param5 = NAN,
.param6 = NAN,
.param5 = (double)NAN,
.param6 = (double)NAN,
/* minimum pitch */
.param1 = NAN,
.param2 = NAN,
@@ -417,8 +417,8 @@ int commander_main(int argc, char *argv[])
struct vehicle_command_s cmd = {
.timestamp = 0,
.param5 = NAN,
.param6 = NAN,
.param5 = (double)NAN,
.param6 = (double)NAN,
/* minimum pitch */
.param1 = NAN,
.param2 = NAN,
@@ -440,8 +440,8 @@ int commander_main(int argc, char *argv[])
struct vehicle_command_s cmd = {
.timestamp = 0,
.param5 = NAN,
.param6 = NAN,
.param5 = (double)NAN,
.param6 = (double)NAN,
/* transition to the other mode */
.param1 = (float)((status.is_rotary_wing) ? vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW : vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC),
.param2 = NAN,
@@ -511,8 +511,8 @@ int commander_main(int argc, char *argv[])
struct vehicle_command_s cmd = {
.timestamp = 0,
.param5 = 0.0f,
.param6 = 0.0f,
.param5 = 0.0,
.param6 = 0.0,
/* if the comparison matches for off (== 0) set 0.0f, 2.0f (on) else */
.param1 = strcmp(argv[2], "off") ? 2.0f : 0.0f, /* lockdown */
.param2 = 0.0f,
+1 -1
View File
@@ -1031,7 +1031,7 @@ _ram_flash_flush()
return;
}
const size_t len = (dm_operations_data.ram_flash.data_end - dm_operations_data.ram_flash.data) + 1;
const ssize_t len = (dm_operations_data.ram_flash.data_end - dm_operations_data.ram_flash.data) + 1;
ret = up_progmem_write(k_dataman_flash_sector->address, dm_operations_data.ram_flash.data, len);
if (ret < len) {
+2 -2
View File
@@ -263,8 +263,8 @@ int SendEvent::custom_command(int argc, char *argv[])
struct vehicle_command_s cmd = {
.timestamp = 0,
.param5 = (float)((accel_calib || calib_all) ? vehicle_command_s::PREFLIGHT_CALIBRATION_TEMPERATURE_CALIBRATION : NAN),
.param6 = NAN,
.param5 = ((accel_calib || calib_all) ? vehicle_command_s::PREFLIGHT_CALIBRATION_TEMPERATURE_CALIBRATION : (double)NAN),
.param6 = (double)NAN,
.param1 = (float)((gyro_calib || calib_all) ? vehicle_command_s::PREFLIGHT_CALIBRATION_TEMPERATURE_CALIBRATION : NAN),
.param2 = NAN,
.param3 = NAN,
@@ -158,7 +158,7 @@ int TemperatureCalibrationAccel::update_sensor_instance(PerSensorData &data, int
}
//update linear fit matrices
double relative_temperature = data.sensor_sample_filt[3] - data.ref_temp;
double relative_temperature = (double)data.sensor_sample_filt[3] - (double)data.ref_temp;
data.P[0].update(relative_temperature, (double)data.sensor_sample_filt[0]);
data.P[1].update(relative_temperature, (double)data.sensor_sample_filt[1]);
data.P[2].update(relative_temperature, (double)data.sensor_sample_filt[2]);
@@ -145,7 +145,7 @@ int TemperatureCalibrationBaro::update_sensor_instance(PerSensorData &data, int
}
//update linear fit matrices
double relative_temperature = data.sensor_sample_filt[1] - data.ref_temp;
double relative_temperature = (double)data.sensor_sample_filt[1] - (double)data.ref_temp;
data.P[0].update(relative_temperature, (double)data.sensor_sample_filt[0]);
return 1;
@@ -145,7 +145,7 @@ int TemperatureCalibrationGyro::update_sensor_instance(PerSensorData &data, int
}
//update linear fit matrices
double relative_temperature = data.sensor_sample_filt[3] - data.ref_temp;
double relative_temperature = (double)data.sensor_sample_filt[3] - (double)data.ref_temp;
data.P[0].update(relative_temperature, (double)data.sensor_sample_filt[0]);
data.P[1].update(relative_temperature, (double)data.sensor_sample_filt[1]);
data.P[2].update(relative_temperature, (double)data.sensor_sample_filt[2]);
@@ -172,7 +172,7 @@ private:
void update_VTV(double x)
{
double temp = 1.0f;
double temp = 1.0;
int8_t z;
for (unsigned i = 0; i < _forder; i++) {
@@ -510,7 +510,7 @@ FixedwingPositionControl::calculate_gndspeed_undershoot(const Vector2f &curr_pos
delta_altitude = pos_sp_curr.alt - pos_sp_prev.alt;
} else {
distance = get_distance_to_next_waypoint(curr_pos(0), curr_pos(1), pos_sp_curr.lat, pos_sp_curr.lon);
distance = get_distance_to_next_waypoint((double)curr_pos(0), (double)curr_pos(1), pos_sp_curr.lat, pos_sp_curr.lon);
delta_altitude = pos_sp_curr.alt - _global_pos.alt;
}
@@ -1314,17 +1314,20 @@ FixedwingPositionControl::control_landing(const Vector2f &curr_pos, const Vector
_fw_pos_ctrl_status.abort_landing = false;
}
const float bearing_airplane_currwp = get_bearing_to_next_waypoint(curr_pos(0), curr_pos(1), curr_wp(0), curr_wp(1));
const float bearing_airplane_currwp = get_bearing_to_next_waypoint((double)curr_pos(0), (double)curr_pos(1),
(double)curr_wp(0), (double)curr_wp(1));
float bearing_lastwp_currwp = bearing_airplane_currwp;
if (pos_sp_prev.valid) {
bearing_lastwp_currwp = get_bearing_to_next_waypoint(prev_wp(0), prev_wp(1), curr_wp(0), curr_wp(1));
bearing_lastwp_currwp = get_bearing_to_next_waypoint((double)prev_wp(0), (double)prev_wp(1), (double)curr_wp(0),
(double)curr_wp(1));
}
/* Horizontal landing control */
/* switch to heading hold for the last meters, continue heading hold after */
float wp_distance = get_distance_to_next_waypoint(curr_pos(0), curr_pos(1), curr_wp(0), curr_wp(1));
float wp_distance = get_distance_to_next_waypoint((double)curr_pos(0), (double)curr_pos(1), (double)curr_wp(0),
(double)curr_wp(1));
/* calculate a waypoint distance value which is 0 when the aircraft is behind the waypoint */
float wp_distance_save = wp_distance;
@@ -1755,7 +1758,8 @@ FixedwingPositionControl::run()
Vector2f curr_wp((float)_pos_sp_triplet.current.lat, (float)_pos_sp_triplet.current.lon);
_fw_pos_ctrl_status.wp_dist = get_distance_to_next_waypoint(curr_pos(0), curr_pos(1), curr_wp(0), curr_wp(1));
_fw_pos_ctrl_status.wp_dist = get_distance_to_next_waypoint((double)curr_pos(0), (double)curr_pos(1),
(double)curr_wp(0), (double)curr_wp(1));
fw_pos_ctrl_status_publish();
}
@@ -461,8 +461,8 @@ GroundRoverPositionControl::task_main()
_gnd_pos_ctrl_status.xtrack_error = _gnd_control.crosstrack_error();
matrix::Vector2f curr_wp((float)_pos_sp_triplet.current.lat, (float)_pos_sp_triplet.current.lon);
_gnd_pos_ctrl_status.wp_dist = get_distance_to_next_waypoint(current_position(0), current_position(1), curr_wp(0),
curr_wp(1));
_gnd_pos_ctrl_status.wp_dist = get_distance_to_next_waypoint((double)current_position(0), (double)current_position(1),
(double)curr_wp(0), (double)curr_wp(1));
gnd_pos_ctrl_status_publish();
}
@@ -336,8 +336,8 @@ void BlockLocalPositionEstimator::update()
// if we have no lat, lon initialize projection to LPE_LAT, LPE_LON parameters
if (!_map_ref.init_done && (_estimatorInitialized & EST_XY) && _fake_origin.get()) {
map_projection_init(&_map_ref,
_init_origin_lat.get(),
_init_origin_lon.get());
(double)_init_origin_lat.get(),
(double)_init_origin_lon.get());
// set timestamp when origin was set to current time
_time_origin = _timeStamp;
@@ -35,6 +35,7 @@ px4_add_module(
MAIN local_position_estimator
COMPILE_FLAGS
-Wno-sign-compare # TODO: fix all sign-compare
-Wno-double-promotion # TODO: fix in Matrix library Vector::pow()
STACK_MAIN 5700
STACK_MAX 13000
SRCS
@@ -95,9 +95,9 @@ int BlockLocalPositionEstimator::gpsMeasure(Vector<double, n_y_gps> &y)
y(0) = _sub_gps.get().lat * 1e-7;
y(1) = _sub_gps.get().lon * 1e-7;
y(2) = _sub_gps.get().alt * 1e-3;
y(3) = _sub_gps.get().vel_n_m_s;
y(4) = _sub_gps.get().vel_e_m_s;
y(5) = _sub_gps.get().vel_d_m_s;
y(3) = (double)_sub_gps.get().vel_n_m_s;
y(4) = (double)_sub_gps.get().vel_e_m_s;
y(5) = (double)_sub_gps.get().vel_d_m_s;
// increament sums for mean
_gpsStats.update(y);
+2 -2
View File
@@ -1561,8 +1561,8 @@ protected:
struct vehicle_command_s cmd = {
.timestamp = 0,
.param5 = NAN,
.param6 = NAN,
.param5 = (double)NAN,
.param6 = (double)NAN,
.param1 = 0.0f, // all cameras
.param2 = 0.0f, // duration 0 because only taking one picture
.param3 = 1.0f, // only take one
+2 -2
View File
@@ -487,8 +487,8 @@ MavlinkReceiver::handle_message_command_long(mavlink_message_t *msg)
struct vehicle_command_s vcmd = {
.timestamp = hrt_absolute_time(),
.param5 = cmd_mavlink.param5,
.param6 = cmd_mavlink.param6,
.param5 = (double)cmd_mavlink.param5,
.param6 = (double)cmd_mavlink.param6,
/* Copy the content of mavlink_command_long_t cmd_mavlink into command_t cmd */
.param1 = cmd_mavlink.param1,
.param2 = cmd_mavlink.param2,
+4 -4
View File
@@ -107,10 +107,10 @@ MavlinkTimesync::handle_message(const mavlink_message_t *msg)
// Filter gain scheduling
if (!sync_converged()) {
// Interpolate with a sigmoid function
float progress = ((float)_sequence) / CONVERGENCE_WINDOW;
float p = 1.0f - expf(0.5f * (1.0f - 1.0f / (1.0f - progress)));
_filter_alpha = p * (float)ALPHA_GAIN_FINAL + (1.0f - p) * (float)ALPHA_GAIN_INITIAL;
_filter_beta = p * (float)BETA_GAIN_FINAL + (1.0f - p) * (float)BETA_GAIN_INITIAL;
double progress = _sequence / CONVERGENCE_WINDOW;
double p = 1.0 - exp(0.5 * (1.0 - 1.0 / (1.0 - progress)));
_filter_alpha = p * ALPHA_GAIN_FINAL + (1.0 - p) * ALPHA_GAIN_INITIAL;
_filter_beta = p * BETA_GAIN_FINAL + (1.0 - p) * BETA_GAIN_INITIAL;
} else {
_filter_alpha = ALPHA_GAIN_FINAL;
+1 -1
View File
@@ -229,7 +229,7 @@ bool Geofence::checkAll(double lat, double lon, float altitude)
const double home_lat = _navigator->get_home_position()->lat;
const double home_lon = _navigator->get_home_position()->lon;
const double home_alt = _navigator->get_home_position()->alt;
const float home_alt = _navigator->get_home_position()->alt;
float dist_xy = -1.0f;
float dist_z = -1.0f;
+4 -4
View File
@@ -452,8 +452,8 @@ MissionBlock::issue_command(const mission_item_s &item)
vcmd.param2 = item.params[1];
vcmd.param3 = item.params[2];
vcmd.param4 = item.params[3];
vcmd.param5 = item.params[4];
vcmd.param6 = item.params[5];
vcmd.param5 = (double)item.params[4];
vcmd.param6 = (double)item.params[5];
if (item.nav_cmd == NAV_CMD_DO_SET_ROI_LOCATION && item.altitude_is_relative) {
vcmd.param7 = item.params[6] + _navigator->get_home_position()->alt;
@@ -644,8 +644,8 @@ MissionBlock::set_land_item(struct mission_item_s *item, bool at_current_locatio
/* use current position */
if (at_current_location) {
item->lat = NAN; //descend at current position
item->lon = NAN; //descend at current position
item->lat = (double)NAN; //descend at current position
item->lon = (double)NAN; //descend at current position
item->yaw = _navigator->get_local_position()->yaw;
} else {
@@ -522,8 +522,8 @@ MissionFeasibilityChecker::checkDistancesBetweenWaypoints(const mission_s &missi
return true;
}
double last_lat = NAN;
double last_lon = NAN;
double last_lat = (double)NAN;
double last_lon = (double)NAN;
/* Go through all waypoints */
for (size_t i = 0; i < mission.count; i++) {
+2 -2
View File
@@ -407,8 +407,8 @@ Navigator::run()
} else {
// If one of them is non-finite, reset both
rep->current.lat = NAN;
rep->current.lon = NAN;
rep->current.lat = (double)NAN;
rep->current.lon = (double)NAN;
}
rep->current.alt = cmd.param7;
+1
View File
@@ -59,6 +59,7 @@ px4_add_module(
MODULE modules__simulator
MAIN simulator
COMPILE_FLAGS
-Wno-double-promotion
INCLUDES
${PX4_SOURCE_DIR}/mavlink/include/mavlink
SRCS
@@ -34,6 +34,8 @@
px4_add_module(
MODULE drivers__accelsim
MAIN accelsim
COMPILE_FLAGS
-Wno-double-promotion
SRCS
accelsim.cpp
DEPENDS
@@ -35,6 +35,7 @@ px4_add_module(
MODULE drivers__airspeedsim
MAIN measairspeedsim
COMPILE_FLAGS
-Wno-double-promotion
SRCS
airspeedsim.cpp
meas_airspeed_sim.cpp
@@ -35,6 +35,7 @@ px4_add_module(
MODULE drivers__barosim
MAIN barosim
COMPILE_FLAGS
-Wno-double-promotion
SRCS
baro.cpp
DEPENDS
@@ -35,6 +35,7 @@ px4_add_module(
MODULE drivers__gpssim
MAIN gpssim
COMPILE_FLAGS
-Wno-double-promotion
SRCS
gpssim.cpp
DEPENDS
@@ -34,6 +34,8 @@
px4_add_module(
MODULE drivers__gyrosim
MAIN gyrosim
COMPILE_FLAGS
-Wno-double-promotion
STACK_MAIN 1200
SRCS
gyrosim.cpp
+1 -1
View File
@@ -138,7 +138,7 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state)
clear_line,
th_cnt);
for (int j = 0; j < th_cnt; j++) {
for (unsigned j = 0; j < th_cnt; j++) {
thread_info_count = THREAD_INFO_MAX;
kr = thread_info(thread_list[j], THREAD_BASIC_INFO,
(thread_info_t)th_info_data, &thread_info_count);