Commit c09cd0f6 authored by pre-commit-ci[bot]'s avatar pre-commit-ci[bot]
Browse files

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
parent b5c25b66
Pipeline #20076 passed with stage
in 12 minutes and 49 seconds
......@@ -46,10 +46,8 @@ class IntegratedActionModelLPFTpl : public ActionModelAbstractTpl<_Scalar> {
boost::shared_ptr<DifferentialActionModelAbstract> model,
std::vector<std::string> lpf_joint_names = {},
const Scalar& time_step = Scalar(1e-3),
const bool& with_cost_residual = true,
const Scalar& fc = 0,
const bool& tau_plus_integration = true,
const int& filter = 0);
const bool& with_cost_residual = true, const Scalar& fc = 0,
const bool& tau_plus_integration = true, const int& filter = 0);
virtual ~IntegratedActionModelLPFTpl();
virtual void calc(const boost::shared_ptr<ActionDataAbstract>& data,
......@@ -148,13 +146,19 @@ class IntegratedActionModelLPFTpl : public ActionModelAbstractTpl<_Scalar> {
boost::shared_ptr<PinocchioModel> pin_model_; //!< for reg cost
bool is_terminal_; //!< is it a terminal model or not ? (deactivate cost on w
//!< if true)
std::vector<std::string> lpf_joint_names_; //!< Vector of joint names that are low-pass filtered
std::vector<int> lpf_joint_ids_; //!< Vector of joint ids that are low-pass filtered
std::vector<int> lpf_torque_ids_; //!< Vector of torque ids that are low-passs filtered
// std::vector<std::string> non_lpf_joint_names_; //!< Vector of joint names that are NOT low-pass filtered
std::vector<int> non_lpf_joint_ids_; //!< Vector of joint ids that are NOT low-pass filtered
std::vector<int> non_lpf_torque_ids_; //!< Vector of torque ids that are NOT low-passs filtered
std::vector<std::string>
lpf_joint_names_; //!< Vector of joint names that are low-pass filtered
std::vector<int>
lpf_joint_ids_; //!< Vector of joint ids that are low-pass filtered
std::vector<int>
lpf_torque_ids_; //!< Vector of torque ids that are low-passs filtered
// std::vector<std::string> non_lpf_joint_names_; //!< Vector of joint
// names that are NOT low-pass filtered
std::vector<int> non_lpf_joint_ids_; //!< Vector of joint ids that are NOT
//!< low-pass filtered
std::vector<int> non_lpf_torque_ids_; //!< Vector of torque ids that are NOT
//!< low-passs filtered
};
template <typename _Scalar>
......
......@@ -138,7 +138,8 @@ void exposeIntegratedActionLPF() {
"non_lpf_torque_ids",
bp::make_function(&IntegratedActionModelLPF::get_non_lpf_torque_ids,
bp::return_value_policy<bp::return_by_value>()),
"ids in the torque vector of dimensions that are NOT low-pass filtered (perfect actuators)")
"ids in the torque vector of dimensions that are NOT low-pass "
"filtered (perfect actuators)")
.def("set_control_reg_cost",
&IntegratedActionModelLPF::set_control_reg_cost,
......
......@@ -55,7 +55,7 @@ ActionModelLPFFactory::create(ActionModelLPFTypes::Type iam_type,
case ActionModelLPFTypes::IntegratedActionModelLPF_ALL: {
double time_step = 1e-3;
bool with_cost_residual = true;
double fc = 1 + (double) (rand()) /( (double)(RAND_MAX/(50-1)));
double fc = 1 + (double)(rand()) / ((double)(RAND_MAX / (50 - 1)));
bool tau_plus_integration = false;
int filter = 1;
// Select LPF joints
......@@ -67,17 +67,14 @@ ActionModelLPFFactory::create(ActionModelLPFTypes::Type iam_type,
std::vector<std::string> lpf_joint_names =
LPFJointListFactory().create_names(model, LPFJointMaskType::ALL);
iam = boost::make_shared<sobec::IntegratedActionModelLPF>(
dam,
lpf_joint_names,
time_step,
with_cost_residual,
fc,
tau_plus_integration,
filter);
dam, lpf_joint_names, time_step, with_cost_residual, fc,
tau_plus_integration, filter);
// set hard-coded costs on unfiltered torque
double tauReg_weight = 1e-6 + (double) (rand()) /( (double)(RAND_MAX/(1e-1-1e-3)));
double tauReg_weight =
1e-6 + (double)(rand()) / ((double)(RAND_MAX / (1e-1 - 1e-3)));
Eigen::VectorXd tauReg_ref = Eigen::VectorXd::Zero(iam->get_ntau());
double tauLim_weight = 1e-6 + (double) (rand()) /( (double)(RAND_MAX/(1e-1-1e-3)));
double tauLim_weight =
1e-6 + (double)(rand()) / ((double)(RAND_MAX / (1e-1 - 1e-3)));
iam->set_control_reg_cost(tauReg_weight, tauReg_ref);
iam->set_control_lim_cost(tauLim_weight);
break;
......@@ -86,8 +83,9 @@ ActionModelLPFFactory::create(ActionModelLPFTypes::Type iam_type,
case ActionModelLPFTypes::IntegratedActionModelLPF_RAND: {
double time_step = 1e-3;
bool with_cost_residual = true;
// double r3 = 1 + static_cast <double> (rand()) /( static_cast <double> (RAND_MAX/(50-1)));
double fc = 1 + (double) (rand()) /( (double)(RAND_MAX/(50-1)));
// double r3 = 1 + static_cast <double> (rand()) /( static_cast <double>
// (RAND_MAX/(50-1)));
double fc = 1 + (double)(rand()) / ((double)(RAND_MAX / (50 - 1)));
bool tau_plus_integration = false;
int filter = 1;
// Select LPF joints
......@@ -99,17 +97,14 @@ ActionModelLPFFactory::create(ActionModelLPFTypes::Type iam_type,
std::vector<std::string> lpf_joint_names =
LPFJointListFactory().create_names(model, LPFJointMaskType::RAND);
iam = boost::make_shared<sobec::IntegratedActionModelLPF>(
dam,
lpf_joint_names,
time_step,
with_cost_residual,
fc,
tau_plus_integration,
filter);
dam, lpf_joint_names, time_step, with_cost_residual, fc,
tau_plus_integration, filter);
// set hard-coded costs on unfiltered torque
double tauReg_weight = 1e-6 + (double) (rand()) /( (double)(RAND_MAX/(1e-1-1e-3)));
double tauReg_weight =
1e-6 + (double)(rand()) / ((double)(RAND_MAX / (1e-1 - 1e-3)));
Eigen::VectorXd tauReg_ref = Eigen::VectorXd::Zero(iam->get_ntau());
double tauLim_weight = 1e-6 + (double) (rand()) /( (double)(RAND_MAX/(1e-1-1e-3)));
double tauLim_weight =
1e-6 + (double)(rand()) / ((double)(RAND_MAX / (1e-1 - 1e-3)));
iam->set_control_reg_cost(tauReg_weight, tauReg_ref);
iam->set_control_lim_cost(tauLim_weight);
break;
......@@ -130,21 +125,18 @@ ActionModelLPFFactory::create(ActionModelLPFTypes::Type iam_type,
std::vector<std::string> lpf_joint_names =
LPFJointListFactory().create_names(model, LPFJointMaskType::NONE);
iam = boost::make_shared<sobec::IntegratedActionModelLPF>(
dam,
lpf_joint_names,
time_step,
with_cost_residual,
fc,
tau_plus_integration,
filter);
double tauReg_weight = 1e-6 + (double) (rand()) /( (double)(RAND_MAX/(1e-1-1e-3)));
dam, lpf_joint_names, time_step, with_cost_residual, fc,
tau_plus_integration, filter);
double tauReg_weight =
1e-6 + (double)(rand()) / ((double)(RAND_MAX / (1e-1 - 1e-3)));
Eigen::VectorXd tauReg_ref = Eigen::VectorXd::Zero(iam->get_ntau());
double tauLim_weight = 1e-6 + (double) (rand()) /( (double)(RAND_MAX/(1e-1-1e-3)));
double tauLim_weight =
1e-6 + (double)(rand()) / ((double)(RAND_MAX / (1e-1 - 1e-3)));
iam->set_control_reg_cost(tauReg_weight, tauReg_ref);
iam->set_control_lim_cost(tauLim_weight);
break;
}
case ActionModelLPFTypes::IntegratedActionModelLPF_alpha0: {
double time_step = 1e-3;
bool with_cost_residual = true;
......@@ -160,13 +152,8 @@ ActionModelLPFFactory::create(ActionModelLPFTypes::Type iam_type,
std::vector<std::string> lpf_joint_names =
LPFJointListFactory().create_names(model, LPFJointMaskType::ALL);
iam = boost::make_shared<sobec::IntegratedActionModelLPF>(
dam,
lpf_joint_names,
time_step,
with_cost_residual,
fc,
tau_plus_integration,
filter);
dam, lpf_joint_names, time_step, with_cost_residual, fc,
tau_plus_integration, filter);
// set hard-coded costs on unfiltered torque
iam->set_alpha(0.);
break;
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment