Commit 677662e8 authored by Maximilien Naveau's avatar Maximilien Naveau
Browse files

[format][gepetto-linters]

parent 69f72072
Pipeline #16999 failed with stage
in 15 minutes
...@@ -81,14 +81,14 @@ public: ...@@ -81,14 +81,14 @@ public:
FeaturePoint6dRelative(const std::string &name); FeaturePoint6dRelative(const std::string &name);
virtual ~FeaturePoint6dRelative(void) {} virtual ~FeaturePoint6dRelative(void) {}
virtual dynamicgraph::Vector &computeError(dynamicgraph::Vector &res, virtual dynamicgraph::Vector &computeError(dynamicgraph::Vector & res,
int time); int time);
virtual dynamicgraph::Vector &computeErrorDot(dynamicgraph::Vector &res, virtual dynamicgraph::Vector &computeErrorDot(dynamicgraph::Vector & res,
int time); int time);
virtual dynamicgraph::Matrix &computeJacobian(dynamicgraph::Matrix &res, virtual dynamicgraph::Matrix &computeJacobian(dynamicgraph::Matrix & res,
int time); int time);
virtual void display(std::ostream &os) const; virtual void display(std::ostream & os) const;
void initCommands(void); void initCommands(void);
void initSdes(const std::string &featureDesiredName); void initSdes(const std::string &featureDesiredName);
......
...@@ -89,11 +89,11 @@ public: ...@@ -89,11 +89,11 @@ public:
virtual unsigned int &getDimension(unsigned int &dim, int time); virtual unsigned int &getDimension(unsigned int &dim, int time);
virtual dynamicgraph::Vector &computeError(dynamicgraph::Vector &res, virtual dynamicgraph::Vector &computeError(dynamicgraph::Vector & res,
int time); int time);
virtual dynamicgraph::Vector &computeErrordot(dynamicgraph::Vector &res, virtual dynamicgraph::Vector &computeErrordot(dynamicgraph::Vector & res,
int time); int time);
virtual dynamicgraph::Matrix &computeJacobian(dynamicgraph::Matrix &res, virtual dynamicgraph::Matrix &computeJacobian(dynamicgraph::Matrix & res,
int time); int time);
/** Static Feature selection. */ /** Static Feature selection. */
...@@ -107,7 +107,7 @@ public: ...@@ -107,7 +107,7 @@ public:
inline static Flags selectTranslation(void) { return Flags("111000"); } inline static Flags selectTranslation(void) { return Flags("111000"); }
inline static Flags selectRotation(void) { return Flags("000111"); } inline static Flags selectRotation(void) { return Flags("000111"); }
virtual void display(std::ostream &os) const; virtual void display(std::ostream & os) const;
public: public:
void servoCurrentPosition(void); void servoCurrentPosition(void);
......
...@@ -18,6 +18,6 @@ class Device; ...@@ -18,6 +18,6 @@ class Device;
class AbstractSotExternalInterface; class AbstractSotExternalInterface;
} // namespace sot } // namespace sot
}// namespace dynamicgraph } // namespace dynamicgraph
#endif // SOT_CORE_FWD_HH #endif // SOT_CORE_FWD_HH
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
// ref https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/ // ref https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define SOT_CORE_DISABLE_WARNING_PUSH __pragma(warning( push )) #define SOT_CORE_DISABLE_WARNING_PUSH __pragma(warning(push))
#define SOT_CORE_DISABLE_WARNING_POP __pragma(warning( pop )) #define SOT_CORE_DISABLE_WARNING_POP __pragma(warning(pop))
#define SOT_CORE_DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber )) #define SOT_CORE_DISABLE_WARNING(warningNumber) \
__pragma(warning(disable : warningNumber))
#define SOT_CORE_DISABLE_WARNING_DEPRECATED SOT_CORE_DISABLE_WARNING(4996) #define SOT_CORE_DISABLE_WARNING_DEPRECATED SOT_CORE_DISABLE_WARNING(4996)
#define SOT_CORE_DISABLE_WARNING_FALLTHROUGH #define SOT_CORE_DISABLE_WARNING_FALLTHROUGH
...@@ -15,9 +16,12 @@ ...@@ -15,9 +16,12 @@
#define SOT_CORE_DO_PRAGMA(X) _Pragma(#X) #define SOT_CORE_DO_PRAGMA(X) _Pragma(#X)
#define SOT_CORE_DISABLE_WARNING_PUSH SOT_CORE_DO_PRAGMA(GCC diagnostic push) #define SOT_CORE_DISABLE_WARNING_PUSH SOT_CORE_DO_PRAGMA(GCC diagnostic push)
#define SOT_CORE_DISABLE_WARNING_POP SOT_CORE_DO_PRAGMA(GCC diagnostic pop) #define SOT_CORE_DISABLE_WARNING_POP SOT_CORE_DO_PRAGMA(GCC diagnostic pop)
#define SOT_CORE_DISABLE_WARNING(warningName) SOT_CORE_DO_PRAGMA(GCC diagnostic ignored #warningName) #define SOT_CORE_DISABLE_WARNING(warningName) \
#define SOT_CORE_DISABLE_WARNING_DEPRECATED SOT_CORE_DISABLE_WARNING(-Wdeprecated-declarations) SOT_CORE_DO_PRAGMA(GCC diagnostic ignored #warningName)
#define SOT_CORE_DISABLE_WARNING_FALLTHROUGH SOT_CORE_DISABLE_WARNING(-Wimplicit-fallthrough) #define SOT_CORE_DISABLE_WARNING_DEPRECATED \
SOT_CORE_DISABLE_WARNING(-Wdeprecated - declarations)
#define SOT_CORE_DISABLE_WARNING_FALLTHROUGH \
SOT_CORE_DISABLE_WARNING(-Wimplicit - fallthrough)
#else #else
......
...@@ -106,8 +106,7 @@ public: ...@@ -106,8 +106,7 @@ public:
std::string &out, std::string &err); std::string &out, std::string &err);
/// \brief Run a python script inside the embeded python interpreter. /// \brief Run a python script inside the embeded python interpreter.
inline void runPythonFile(std::string ifilename, inline void runPythonFile(std::string ifilename, std::string &err) {
std::string &err) {
embeded_python_interpreter_.runPythonFile(ifilename, err); embeded_python_interpreter_.runPythonFile(ifilename, err);
} }
......
...@@ -117,8 +117,8 @@ void FeaturePosture::selectDof(unsigned dofId, bool control) { ...@@ -117,8 +117,8 @@ void FeaturePosture::selectDof(unsigned dofId, bool control) {
// Check that selected dof id is valid // Check that selected dof id is valid
if (dofId >= dim) { if (dofId >= dim) {
std::ostringstream oss; std::ostringstream oss;
oss << "dof id should less than state dimension: " oss << "dof id should less than state dimension: " << dim << ". Received "
<< dim << ". Received " << dofId << "."; << dofId << ".";
throw ExceptionAbstract(ExceptionAbstract::TOOLS, oss.str()); throw ExceptionAbstract(ExceptionAbstract::TOOLS, oss.str());
} }
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
#include "sot/core/device.hh" #include "sot/core/device.hh"
#include <iostream> #include <iostream>
#include <sot/core/macros.hh>
#include <sot/core/debug.hh> #include <sot/core/debug.hh>
#include <sot/core/macros.hh>
using namespace std; using namespace std;
#include <Eigen/Geometry> #include <Eigen/Geometry>
...@@ -230,32 +230,30 @@ void Device::setVelocitySize(const unsigned int &size) { ...@@ -230,32 +230,30 @@ void Device::setVelocitySize(const unsigned int &size) {
void Device::setState(const Vector &st) { void Device::setState(const Vector &st) {
if (sanityCheck_) { if (sanityCheck_) {
const Vector::Index &s = st.size(); const Vector::Index &s = st.size();
SOT_CORE_DISABLE_WARNING_PUSH SOT_CORE_DISABLE_WARNING_PUSH
SOT_CORE_DISABLE_WARNING_FALLTHROUGH SOT_CORE_DISABLE_WARNING_FALLTHROUGH
switch (controlInputType_) { switch (controlInputType_) {
case CONTROL_INPUT_TWO_INTEGRATION: case CONTROL_INPUT_TWO_INTEGRATION:
dgRTLOG() dgRTLOG()
<< "Sanity check for this control is not well supported. " << "Sanity check for this control is not well supported. "
"In order to make it work, use pinocchio and the contact forces " "In order to make it work, use pinocchio and the contact forces "
"to estimate the joint torques for the given acceleration.\n"; "to estimate the joint torques for the given acceleration.\n";
if (s != lowerTorque_.size() || s != upperTorque_.size()) if (s != lowerTorque_.size() || s != upperTorque_.size()) {
{
std::ostringstream os; std::ostringstream os;
os << "dynamicgraph::sot::Device::setState: upper and/or lower torque" os << "dynamicgraph::sot::Device::setState: upper and/or lower torque"
"bounds do not match state size. Input State size = " << st.size() "bounds do not match state size. Input State size = "
<< ", lowerTorque_.size() = " << lowerTorque_.size() << st.size() << ", lowerTorque_.size() = " << lowerTorque_.size()
<< ", upperTorque_.size() = " << upperTorque_.size() << ", upperTorque_.size() = " << upperTorque_.size()
<< ". Set them first with setTorqueBounds."; << ". Set them first with setTorqueBounds.";
throw std::invalid_argument(os.str().c_str()); throw std::invalid_argument(os.str().c_str());
// fall through // fall through
} }
case CONTROL_INPUT_ONE_INTEGRATION: case CONTROL_INPUT_ONE_INTEGRATION:
if (s != lowerVelocity_.size() || s != upperVelocity_.size()) if (s != lowerVelocity_.size() || s != upperVelocity_.size()) {
{
std::ostringstream os; std::ostringstream os;
os << "dynamicgraph::sot::Device::setState: upper and/or lower velocity" os << "dynamicgraph::sot::Device::setState: upper and/or lower velocity"
" bounds do not match state size. Input State size = " << st.size() " bounds do not match state size. Input State size = "
<< ", lowerVelocity_.size() = " << lowerVelocity_.size() << st.size() << ", lowerVelocity_.size() = " << lowerVelocity_.size()
<< ", upperVelocity_.size() = " << upperVelocity_.size() << ", upperVelocity_.size() = " << upperVelocity_.size()
<< ". Set them first with setVelocityBounds."; << ". Set them first with setVelocityBounds.";
throw std::invalid_argument(os.str().c_str()); throw std::invalid_argument(os.str().c_str());
...@@ -266,7 +264,7 @@ SOT_CORE_DISABLE_WARNING_FALLTHROUGH ...@@ -266,7 +264,7 @@ SOT_CORE_DISABLE_WARNING_FALLTHROUGH
default: default:
throw std::invalid_argument("Invalid control mode type."); throw std::invalid_argument("Invalid control mode type.");
} }
SOT_CORE_DISABLE_WARNING_POP SOT_CORE_DISABLE_WARNING_POP
} }
state_ = st; state_ = st;
stateSOUT.setConstant(state_); stateSOUT.setConstant(state_);
...@@ -319,8 +317,8 @@ void Device::setControlInputType(const std::string &cit) { ...@@ -319,8 +317,8 @@ void Device::setControlInputType(const std::string &cit) {
void Device::setSanityCheck(const bool &enableCheck) { void Device::setSanityCheck(const bool &enableCheck) {
if (enableCheck) { if (enableCheck) {
const Vector::Index &s = state_.size(); const Vector::Index &s = state_.size();
SOT_CORE_DISABLE_WARNING_PUSH SOT_CORE_DISABLE_WARNING_PUSH
SOT_CORE_DISABLE_WARNING_FALLTHROUGH SOT_CORE_DISABLE_WARNING_FALLTHROUGH
switch (controlInputType_) { switch (controlInputType_) {
case CONTROL_INPUT_TWO_INTEGRATION: case CONTROL_INPUT_TWO_INTEGRATION:
dgRTLOG() dgRTLOG()
...@@ -347,7 +345,7 @@ SOT_CORE_DISABLE_WARNING_FALLTHROUGH ...@@ -347,7 +345,7 @@ SOT_CORE_DISABLE_WARNING_FALLTHROUGH
default: default:
throw std::invalid_argument("Invalid control mode type."); throw std::invalid_argument("Invalid control mode type.");
} }
SOT_CORE_DISABLE_WARNING_POP SOT_CORE_DISABLE_WARNING_POP
} }
sanityCheck_ = enableCheck; sanityCheck_ = enableCheck;
} }
......
...@@ -128,8 +128,7 @@ bool SotLoader::initialization() { ...@@ -128,8 +128,7 @@ bool SotLoader::initialization() {
void SotLoader::cleanUp() { void SotLoader::cleanUp() {
// Unregister the device first if it exists to avoid a double destruction from // Unregister the device first if it exists to avoid a double destruction from
// the pool of entity and the class that handle the Device pointer. // the pool of entity and the class that handle the Device pointer.
if(device_name_ != "") if (device_name_ != "") {
{
PoolStorage::getInstance()->deregisterEntity(device_name_); PoolStorage::getInstance()->deregisterEntity(device_name_);
} }
...@@ -192,8 +191,8 @@ void SotLoader::loadDeviceInPython(const std::string &device_name) { ...@@ -192,8 +191,8 @@ void SotLoader::loadDeviceInPython(const std::string &device_name) {
err); err);
// Get the existing C++ entity pointer in the Python interpreter. // Get the existing C++ entity pointer in the Python interpreter.
runPythonCommand("loaded_device_name = \"" + device_name + "\"", result, runPythonCommand("loaded_device_name = \"" + device_name + "\"", result, out,
out, err); err);
runPythonCommand("device_cpp_object = Device(loaded_device_name)", result, runPythonCommand("device_cpp_object = Device(loaded_device_name)", result,
out, err); out, err);
......
...@@ -24,7 +24,7 @@ void DummySotExternalInterface::setupSetSensors( ...@@ -24,7 +24,7 @@ void DummySotExternalInterface::setupSetSensors(
} }
void DummySotExternalInterface::nominalSetSensors( void DummySotExternalInterface::nominalSetSensors(
std::map<std::string, dynamicgraph::sot::SensorValues> &/*sensorsIn*/) { std::map<std::string, dynamicgraph::sot::SensorValues> & /*sensorsIn*/) {
return; return;
} }
......
Markdown is supported
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