Skip to content

Commit

Permalink
fixed loading of detailed model params
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Nov 1, 2023
1 parent 010e42a commit 42970dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/mrs_uav_managers/control_manager/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ bool validateUavState(const mrs_msgs::UavState& msg, const std::string& node_nam
bool validateVelocityReference(const mrs_msgs::VelocityReference& msg, const std::string& node_name, const std::string& var_name);
bool validateReference(const mrs_msgs::Reference& msg, const std::string& node_name, const std::string& var_name);

std::optional<DetailedModelParams_t> loadDetailedUavModelParams(ros::NodeHandle& nh, const std::string& node_name);
std::optional<DetailedModelParams_t> loadDetailedUavModelParams(ros::NodeHandle& nh, const std::string& node_name, const std::string& platform_config,
const std::string& custom_config);

// translates the channel values to desired range
double RCChannelToRange(double rc_value, double range, double deadband);
Expand Down
11 changes: 10 additions & 1 deletion src/control_manager/common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,19 @@ double RCChannelToRange(double rc_value, double range, double deadband) {

/* loadDetailedUavModelParams() //{ */

std::optional<DetailedModelParams_t> loadDetailedUavModelParams(ros::NodeHandle& nh, const std::string& node_name) {
std::optional<DetailedModelParams_t> loadDetailedUavModelParams(ros::NodeHandle& nh, const std::string& node_name, const std::string& platform_config,
const std::string& custom_config) {

mrs_lib::ParamLoader param_loader(nh, node_name);

if (custom_config != "") {
param_loader.addYamlFile(custom_config);
}

if (platform_config != "") {
param_loader.addYamlFile(platform_config);
}

double arm_length;
double body_height;
double force_constant;
Expand Down
2 changes: 1 addition & 1 deletion src/control_manager/control_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ void ControlManager::initialize(void) {

common_handlers_->getMass = boost::bind(&ControlManager::getMass, this);

common_handlers_->detailed_model_params = loadDetailedUavModelParams(nh_, "ControlManager");
common_handlers_->detailed_model_params = loadDetailedUavModelParams(nh_, "ControlManager", _platform_config_, _custom_config_);

common_handlers_->control_output_modalities = _hw_api_inputs_;

Expand Down

0 comments on commit 42970dd

Please sign in to comment.