Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main merge from develop for v10.1.0 minor update #324

Merged
merged 7 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/src_user/Library/SignalProcess/spike_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ C2A_MATH_ERROR SPIKE_FILTER_calc_output_uint32(SpikeFilter* filter, uint32_t* ou

C2A_MATH_ERROR SPIKE_FILTER_calc_output_double(SpikeFilter* filter, double* output, const double input)
{
// NAN確認
C2A_MATH_ERROR ret = C2A_MATH_check_nan_inf_double(input);
if (ret != C2A_MATH_ERROR_OK)
{
*output = filter->last_accept_val_;
return C2A_MATH_ERROR_NAN;
}

C2A_MATH_ERROR judgement_result = C2A_MATH_ERROR_OK;

double diff = input - filter->last_accept_val_;
Expand Down
11 changes: 10 additions & 1 deletion src/src_user/Library/SignalProcess/z_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <math.h>
#include <src_user/Library/math_constants.h>

#include <src_core/System/EventManager/event_logger.h>

//!< bilinear transformation
static C2A_MATH_ERROR Z_FILTER_bilinear_trans_(ZFilter* filter,
Expand Down Expand Up @@ -157,6 +157,15 @@ float Z_FILTER_calc_output(ZFilter* filter, const float input)

double Z_FILTER_calc_output_double(ZFilter* filter, const double input)
{
// NAN確認
C2A_MATH_ERROR ret = C2A_MATH_check_nan_inf_double(input);
if (ret != C2A_MATH_ERROR_OK)
{
// TODO: IDは現状テキトウな値なので、修正する(今はアプリIDと被らない大きな値にしている。)
EL_record_event(EL_GROUP_CALCULATION_ERROR, 201, EL_ERROR_LEVEL_LOW, (uint32_t)ret);
return filter->output_previous[0];
}

double output_d = input;

switch (filter->order)
Expand Down
12 changes: 12 additions & 0 deletions src/src_user/Library/pid_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <math.h>

#include <src_core/System/TimeManager/time_manager.h>
#include <src_core/System/EventManager/event_logger.h>

#include "math_constants.h"

Expand Down Expand Up @@ -76,6 +77,17 @@ void PID_CONTROL_calc_output(PidControl* pid_control, const float error)
pid_control->gains.d_gain * pid_control->d_error;
pid_control->pre_error = pid_control->error;

// NAN確認
C2A_MATH_ERROR ret = C2A_MATH_check_nan_inf(pid_control->control_output);
if (ret != C2A_MATH_ERROR_OK)
{
pid_control->control_output = 0.0f;
PID_CONTROL_reset_integral_error(pid_control);
pid_control->pre_error = 0.0f;
// TODO: IDは現状テキトウな値なので、修正する(今はアプリIDと被らない大きな値にしている。)
EL_record_event(EL_GROUP_CALCULATION_ERROR, 200, EL_ERROR_LEVEL_LOW, (uint32_t)ret);
}

return;
}

Expand Down
Loading