mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 04:03:34 +08:00
FMU get initial values of parameters
This commit is contained in:
committed by
Lorenz Meier
parent
0158f1d506
commit
6b2f5970eb
+41
-33
@@ -271,6 +271,7 @@ private:
|
|||||||
void publish_pwm_outputs(uint16_t *values, size_t numvalues);
|
void publish_pwm_outputs(uint16_t *values, size_t numvalues);
|
||||||
void update_pwm_out_state(bool on);
|
void update_pwm_out_state(bool on);
|
||||||
void pwm_output_set(unsigned i, unsigned value);
|
void pwm_output_set(unsigned i, unsigned value);
|
||||||
|
void update_params();
|
||||||
|
|
||||||
struct GPIOConfig {
|
struct GPIOConfig {
|
||||||
uint32_t input;
|
uint32_t input;
|
||||||
@@ -1081,8 +1082,9 @@ PX4FMU::cycle()
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
param_find("MOT_SLEW_MAX");
|
|
||||||
param_find("THR_MDL_FAC");
|
// Getting initial parameter values
|
||||||
|
this->update_params();
|
||||||
|
|
||||||
for (unsigned i = 0; i < _max_actuators; i++) {
|
for (unsigned i = 0; i < _max_actuators; i++) {
|
||||||
char pname[16];
|
char pname[16];
|
||||||
@@ -1425,37 +1427,7 @@ PX4FMU::cycle()
|
|||||||
orb_check(_param_sub, &updated);
|
orb_check(_param_sub, &updated);
|
||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
parameter_update_s pupdate;
|
this->update_params();
|
||||||
orb_copy(ORB_ID(parameter_update), _param_sub, &pupdate);
|
|
||||||
|
|
||||||
update_pwm_rev_mask();
|
|
||||||
update_pwm_trims();
|
|
||||||
|
|
||||||
int32_t dsm_bind_val;
|
|
||||||
param_t param_handle;
|
|
||||||
|
|
||||||
/* see if bind parameter has been set, and reset it to -1 */
|
|
||||||
param_get(param_handle = param_find("RC_DSM_BIND"), &dsm_bind_val);
|
|
||||||
|
|
||||||
if (dsm_bind_val > -1) {
|
|
||||||
dsm_bind_ioctl(dsm_bind_val);
|
|
||||||
dsm_bind_val = -1;
|
|
||||||
param_set(param_handle, &dsm_bind_val);
|
|
||||||
}
|
|
||||||
|
|
||||||
// maximum motor slew rate parameter
|
|
||||||
param_handle = param_find("MOT_SLEW_MAX");
|
|
||||||
|
|
||||||
if (param_handle != PARAM_INVALID) {
|
|
||||||
param_get(param_handle, &_mot_t_max);
|
|
||||||
}
|
|
||||||
|
|
||||||
// thrust to pwm modelling factor
|
|
||||||
param_handle = param_find("THR_MDL_FAC");
|
|
||||||
|
|
||||||
if (param_handle != PARAM_INVALID) {
|
|
||||||
param_get(param_handle, &_thr_mdl_fac);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update ADC sampling */
|
/* update ADC sampling */
|
||||||
@@ -1735,6 +1707,42 @@ PX4FMU::cycle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PX4FMU::update_params()
|
||||||
|
{
|
||||||
|
parameter_update_s pupdate;
|
||||||
|
orb_copy(ORB_ID(parameter_update), _param_sub, &pupdate);
|
||||||
|
|
||||||
|
update_pwm_rev_mask();
|
||||||
|
update_pwm_trims();
|
||||||
|
|
||||||
|
int32_t dsm_bind_val;
|
||||||
|
param_t param_handle;
|
||||||
|
|
||||||
|
/* see if bind parameter has been set, and reset it to -1 */
|
||||||
|
param_get(param_handle = param_find("RC_DSM_BIND"), &dsm_bind_val);
|
||||||
|
|
||||||
|
if (dsm_bind_val > -1) {
|
||||||
|
dsm_bind_ioctl(dsm_bind_val);
|
||||||
|
dsm_bind_val = -1;
|
||||||
|
param_set(param_handle, &dsm_bind_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
// maximum motor slew rate parameter
|
||||||
|
param_handle = param_find("MOT_SLEW_MAX");
|
||||||
|
|
||||||
|
if (param_handle != PARAM_INVALID) {
|
||||||
|
param_get(param_handle, &_mot_t_max);
|
||||||
|
}
|
||||||
|
|
||||||
|
// thrust to pwm modelling factor
|
||||||
|
param_handle = param_find("THR_MDL_FAC");
|
||||||
|
|
||||||
|
if (param_handle != PARAM_INVALID) {
|
||||||
|
param_get(param_handle, &_thr_mdl_fac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PX4FMU::stop()
|
void PX4FMU::stop()
|
||||||
{
|
{
|
||||||
/* Signal that we want to stop the task or work.
|
/* Signal that we want to stop the task or work.
|
||||||
|
|||||||
Reference in New Issue
Block a user