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

コンフィグファイルの再読込への対応 #26

Open
ShotaAk opened this issue Apr 25, 2022 · 1 comment
Open

コンフィグファイルの再読込への対応 #26

ShotaAk opened this issue Apr 25, 2022 · 1 comment
Labels
Type: Feature New Feature

Comments

@ShotaAk
Copy link
Contributor

ShotaAk commented Apr 25, 2022

現状の問題点

hardware.load_config_file("../config/crane-x7.yaml");でコンフィグファイルを読み込みますが、
一つのHardwareインスタンスに対して1回の読み込みにしか対応していません。

load_config_file()を2回実行するとエラーが発生します。

改善案

load_config_file()を複数回実行できるように実装を変更します。

load_config_file()内で使用しているhardware_joints::Jointsを初期化すれば再読込が可能です。

ただし、実機との通信中にjointsを初期化して問題ないか検証が必要です。

bool Hardware::load_config_file(const std::string& config_yaml) {
// コンフィグファイルの読み込み
if (config_file_parser::parse(config_yaml, joints_) == false) {
return false;
}

代替案

その他

@ShotaAk ShotaAk added the Type: Feature New Feature label Apr 25, 2022
@ShotaAk
Copy link
Contributor Author

ShotaAk commented Mar 4, 2024

config_file_parser::parse()内で、 parsed_joints = hardware_joints::Joints();を実行すれば、
コンフィグファイルの再読込に対応できます。

bool parse(const std::string& config_yaml, hardware_joints::Joints & parsed_joints) {
std::ifstream fs(config_yaml);
if (!fs.is_open()) {
std::cerr << "コンフィグファイル:" << config_yaml << "が存在しません." << std::endl;
return false;
}
YAML::Node config = YAML::LoadFile(config_yaml);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New Feature
Projects
None yet
Development

No branches or pull requests

1 participant