52 sprintf(nbuf,
"RC%d_MIN", i + 1);
56 sprintf(nbuf,
"RC%d_TRIM", i + 1);
60 sprintf(nbuf,
"RC%d_MAX", i + 1);
64 sprintf(nbuf,
"RC%d_REV", i + 1);
68 sprintf(nbuf,
"RC%d_DZ", i + 1);
107 for (
int i = 0; i < rc_parameter_map_s::RC_PARAM_MAP_NCHAN; i++) {
108 char name[rc_parameter_map_s::PARAM_ID_LEN];
109 snprintf(name, rc_parameter_map_s::PARAM_ID_LEN,
"RC_MAP_PARAM%d",
144 bool rc_valid =
true;
145 float tmpScaleFactor = 0.0f;
146 float tmpRevFactor = 0.0f;
158 tmpScaleFactor = (1.0f / ((parameters.
max[i] - parameters.
min[i]) / 2.0
f) * parameters.
rev[i]);
159 tmpRevFactor = tmpScaleFactor * parameters.
rev[i];
162 if (!PX4_ISFINITE(tmpScaleFactor) ||
163 (tmpRevFactor < 0.000001f) ||
164 (tmpRevFactor > 0.2
f)) {
165 PX4_WARN(
"RC chan %u not sane, scaling: %8.6f, rev: %d", i, (
double)tmpScaleFactor, (
int)(parameters.
rev[i]));
177 PX4_ERR(
"WARNING WARNING WARNING\n\nRC CALIBRATION NOT SANE!\n\n");
180 const char *paramerr =
"FAIL PARM LOAD";
184 PX4_WARN(
"%s", paramerr);
188 PX4_WARN(
"%s", paramerr);
192 PX4_WARN(
"%s", paramerr);
196 PX4_WARN(
"%s", paramerr);
200 PX4_WARN(
"%s", paramerr);
204 PX4_WARN(
"%s", paramerr);
208 PX4_WARN(
"%s", paramerr);
212 PX4_WARN(
"%s", paramerr);
216 PX4_WARN(
"%s", paramerr);
220 PX4_WARN(
"%s", paramerr);
224 PX4_WARN(
"%s", paramerr);
228 PX4_WARN(
"%s", paramerr);
232 PX4_WARN(
"%s", paramerr);
236 PX4_WARN(
"%s", paramerr);
240 PX4_WARN(
"%s", paramerr);
244 PX4_WARN(
"%s", paramerr);
248 PX4_WARN(
"%s", paramerr);
252 PX4_WARN(
"%s", paramerr);
256 PX4_WARN(
"%s", paramerr);
266 for (
int i = 0; i < rc_parameter_map_s::RC_PARAM_MAP_NCHAN; i++) {
static constexpr unsigned RC_MAX_CHAN_COUNT
maximum number of r/c channels we handle
float max[RC_MAX_CHAN_COUNT]
float min[RC_MAX_CHAN_COUNT]
param_t dz[RC_MAX_CHAN_COUNT]
param_t max[RC_MAX_CHAN_COUNT]
float dz[RC_MAX_CHAN_COUNT]
int param_get(param_t param, void *val)
Copy the value of a parameter.
float trim[RC_MAX_CHAN_COUNT]
int32_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]
param_t rev[RC_MAX_CHAN_COUNT]
int32_t rc_map_rattitude_sw
int update_parameters(const ParameterHandles ¶meter_handles, Parameters ¶meters)
Read out the parameters using the handles into the parameters struct.
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
param_t param_find(const char *name)
Look up a parameter by name.
float rev[RC_MAX_CHAN_COUNT]
param_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]
int32_t rc_map_flightmode
int32_t rc_map_offboard_sw
constexpr _Tp min(_Tp a, _Tp b)
param_t rc_map_rattitude_sw
void initialize_parameter_handles(ParameterHandles ¶meter_handles)
initialize ParameterHandles struct
param_t trim[RC_MAX_CHAN_COUNT]
constexpr _Tp max(_Tp a, _Tp b)
param_t rc_map_offboard_sw
float scaling_factor[RC_MAX_CHAN_COUNT]
param_t rc_map_flightmode
param_t min[RC_MAX_CHAN_COUNT]