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

[pre-commit.ci] pre-commit autoupdate #31

Merged
merged 2 commits into from
Mar 14, 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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v18.1.1
hooks:
- id: clang-format
'types_or': [c++, c]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ void ContactsManager<ContactT>::init(const mc_control::MCController & ctl,
OnAddedContact onAddedContact)
{
std::visit([this, &ctl, &robotName, onAddedContact](const auto & c)
{ init_manager(ctl, robotName, c, onAddedContact); },
conf);
{ init_manager(ctl, robotName, c, onAddedContact); }, conf);
}

template<typename ContactT>
Expand Down
14 changes: 5 additions & 9 deletions src/AttitudeObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,8 @@ void AttitudeObserver::addToLogger(const mc_control::MCController &,
mc_rtc::Logger & logger,
const std::string & category)
{
logger.addLogEntry(category + "_orientation",
[this]() -> sva::PTransformd {
return sva::PTransformd{m_orientation.transpose(), Eigen::Vector3d::Zero()};
});
logger.addLogEntry(category + "_orientation", [this]() -> sva::PTransformd
{ return sva::PTransformd{m_orientation.transpose(), Eigen::Vector3d::Zero()}; });
if(log_kf_) { config_.addToLogger(logger, category); }
}

Expand All @@ -181,11 +179,9 @@ void AttitudeObserver::addToGUI(const mc_control::MCController & ctl,
mc_rtc::log::info("[{}] Manual reset triggerred", name());
reset(ctl);
}),
mc_rtc::gui::ArrayLabel("Result", {"r [deg]", "p [deg]", "y [deg]"},
[this]() -> Eigen::Vector3d {
return mc_rbdyn::rpyFromMat(m_orientation.transpose()) * 180.
/ mc_rtc::constants::PI;
}));
mc_rtc::gui::ArrayLabel(
"Result", {"r [deg]", "p [deg]", "y [deg]"}, [this]() -> Eigen::Vector3d
{ return mc_rbdyn::rpyFromMat(m_orientation.transpose()) * 180. / mc_rtc::constants::PI; }));
}

void AttitudeObserver::KalmanFilterConfig::addToLogger(mc_rtc::Logger & logger, const std::string & category)
Expand Down
56 changes: 27 additions & 29 deletions src/SLAMObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,33 +309,32 @@ void SLAMObserver::addToGUI(const mc_control::MCController & ctl,
mc_rtc::gui::StateBuilder & gui,
const std::vector<std::string> & category)
{
gui.addElement(category, mc_rtc::gui::Transform("X_S_Ground", [this]() { return X_Slam_Ground_; }),
mc_rtc::gui::Button("Initialize",
[this, &ctl]()
{
if(!isInitialized_)
{
isInitialized_ = true;
const auto & real_robot = ctl.realRobot(robot_);
const auto & X_0_Camera = real_robot.bodyPosW(camera_);
X_0_Slam_ = X_Slam_Estimated_Camera_.inv() * X_0_Camera;
filter_->reset();
}
}),
mc_rtc::gui::Transform("X_0_Slam", [this]() { return X_0_Slam_; }),
mc_rtc::gui::ArrayLabel("X_Slam_Camera", {"r", "p", "y", "x", "y", "z"},
[this]()
{
Eigen::VectorXd ret(6);
sva::PTransformd X_Slam_Camera = X_0_Estimated_camera_ * X_0_Slam_.inv();
ret << mc_rbdyn::rpyFromMat(X_Slam_Camera.rotation()),
X_Slam_Camera.translation();
return ret;
}),
mc_rtc::gui::Label("Is Observer initialized?", [this]() { return (isInitialized_ ? "Yes" : "No"); }),
mc_rtc::gui::Button("Delete initialization", [this]() { isInitialized_ = false; }),
mc_rtc::gui::Checkbox(
"Enable plots", [this]() { return plotsEnabled_; }, [this, &gui]() { togglePlots(gui); }));
gui.addElement(
category, mc_rtc::gui::Transform("X_S_Ground", [this]() { return X_Slam_Ground_; }),
mc_rtc::gui::Button("Initialize",
[this, &ctl]()
{
if(!isInitialized_)
{
isInitialized_ = true;
const auto & real_robot = ctl.realRobot(robot_);
const auto & X_0_Camera = real_robot.bodyPosW(camera_);
X_0_Slam_ = X_Slam_Estimated_Camera_.inv() * X_0_Camera;
filter_->reset();
}
}),
mc_rtc::gui::Transform("X_0_Slam", [this]() { return X_0_Slam_; }),
mc_rtc::gui::ArrayLabel("X_Slam_Camera", {"r", "p", "y", "x", "y", "z"},
[this]()
{
Eigen::VectorXd ret(6);
sva::PTransformd X_Slam_Camera = X_0_Estimated_camera_ * X_0_Slam_.inv();
ret << mc_rbdyn::rpyFromMat(X_Slam_Camera.rotation()), X_Slam_Camera.translation();
return ret;
}),
mc_rtc::gui::Label("Is Observer initialized?", [this]() { return (isInitialized_ ? "Yes" : "No"); }),
mc_rtc::gui::Button("Delete initialization", [this]() { isInitialized_ = false; }),
mc_rtc::gui::Checkbox("Enable plots", [this]() { return plotsEnabled_; }, [this, &gui]() { togglePlots(gui); }));

std::vector<std::string> categoryFilter = category;
categoryFilter.push_back("Filter");
Expand All @@ -348,8 +347,7 @@ void SLAMObserver::addToGUI(const mc_control::MCController & ctl,
}),
mc_rtc::gui::Label("Apply filter:", [this]() { return (isFiltered_ ? "yes" : "no"); }),
mc_rtc::gui::ArrayInput(
"Filter config", {"m", "d", "n"},
[this]()
"Filter config", {"m", "d", "n"}, [this]()
{ return Eigen::Vector3d(filter_->config().m, filter_->config().s, filter_->config().n); },
[this](const Eigen::Vector3d & v)
{
Expand Down
Loading