Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 8, 2023
1 parent 57a09e2 commit 7b1a36b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
5 changes: 2 additions & 3 deletions include/mc_state_observation/measurements/measurementsTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@ struct MapContacts
inline bool checkAlreadyExists(const std::string & forceSensorName)
{
if(listContacts_.find(forceSensorName) != listContacts_.end()) // the contact already exists
{ return true; }
else
{
return false;
return true;
}
else { return false; }
}

/// @brief Check if a contact already exists in the list. If it already exists, checks that the contact remained
Expand Down
11 changes: 8 additions & 3 deletions include/mc_state_observation/measurements/measurementsTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ void ContactsManager<ContactWithSensorT>::initDetection(const mc_control::MCCont
{
if(std::find(forceSensorsToOmit.begin(), forceSensorsToOmit.end(), forceSensor.name())
!= forceSensorsToOmit.end())
{ continue; }
{
continue;
}
const std::string & fsName = forceSensor.name();

mapContacts_.insertContact(fsName);
Expand All @@ -144,7 +146,8 @@ void ContactsManager<ContactWithSensorT>::addContactToGui(const mc_control::MCCo
name + " : " + (mapContacts_.contact(name).isSet_ ? "Contact is set" : "Contact is not set")
+ ": Use wrench sensor: ",
[this, name]() { return mapContacts_.contact(name).sensorEnabled_; },
[this, name]() {
[this, name]()
{
mapContacts_.contact(name).sensorEnabled_ = !mapContacts_.contact(name).sensorEnabled_;
std::cout << std::endl
<< "Enable / disable :" + name + " "
Expand Down Expand Up @@ -299,7 +302,9 @@ void ContactsManager<ContactWithSensorT>::updateContacts()
{
if(oldContacts_.find(foundContact)
!= oldContacts_.end()) // checks if the contact was already set on the last iteration
{ contact(foundContact).wasAlreadySet_ = true; }
{
contact(foundContact).wasAlreadySet_ = true;
}
else // the contact was not set on the last iteration
{
contact(foundContact).wasAlreadySet_ = false;
Expand Down
52 changes: 24 additions & 28 deletions src/odometry/leggedOdometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,28 @@ void LeggedOdometryManager::init(const mc_control::MCController & ctl,
ctl.gui()->addElement({odometryName_, "Odometry"},
mc_rtc::gui::ComboInput(
"Choose from list", {"6dOdometry", "Flat"},
[this]() -> std::string {
[this]() -> std::string
{
if(odometryType_ == measurements::OdometryType::Flat) { return "Flat"; }
else
{
return "6dOdometry";
}
else { return "6dOdometry"; }
},
[this](const std::string & typeOfOdometry) { changeOdometryType(typeOfOdometry); }));
logger.addLogEntry(odometryName_ + "_debug_OdometryType", [this]() -> std::string {
switch(odometryType_)
{
case measurements::OdometryType::Flat:
return "Flat";
break;
case measurements::OdometryType::Odometry6d:
return "6dOdometry";
break;
default:
break;
}
return "default";
});
logger.addLogEntry(odometryName_ + "_debug_OdometryType",
[this]() -> std::string
{
switch(odometryType_)
{
case measurements::OdometryType::Flat:
return "Flat";
break;
case measurements::OdometryType::Odometry6d:
return "6dOdometry";
break;
default:
break;
}
return "default";
});
}
}

Expand Down Expand Up @@ -434,10 +434,7 @@ void LeggedOdometryManager::updateOdometryRobot(const mc_control::MCController &

odometryRobot().accW(acc);
}
else
{
mc_rtc::log::error("The acceleration must be already updated upstream.");
}
else { mc_rtc::log::error("The acceleration must be already updated upstream."); }
}

if(updateVels)
Expand Down Expand Up @@ -846,13 +843,12 @@ void LeggedOdometryManager::changeOdometryType(const std::string & newOdometryTy
{
OdometryType prevOdometryType = odometryType_;
if(newOdometryType == "Flat") { odometryType_ = measurements::OdometryType::Flat; }
else if(newOdometryType == "6dOdometry")
{
odometryType_ = measurements::OdometryType::Odometry6d;
}
else if(newOdometryType == "6dOdometry") { odometryType_ = measurements::OdometryType::Odometry6d; }

if(odometryType_ != prevOdometryType)
{ mc_rtc::log::info("[{}]: Odometry mode changed to: {}", odometryType_, newOdometryType); }
{
mc_rtc::log::info("[{}]: Odometry mode changed to: {}", odometryType_, newOdometryType);
}
}

void LeggedOdometryManager::changeOdometryType(const OdometryType & newOdometryType)
Expand Down

0 comments on commit 7b1a36b

Please sign in to comment.