Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
sot-core
Commits
677662e8
Commit
677662e8
authored
Nov 29, 2021
by
Maximilien Naveau
Browse files
[format][gepetto-linters]
parent
69f72072
Pipeline
#16999
failed with stage
in 15 minutes
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/sot/core/feature-point6d-relative.hh
View file @
677662e8
...
...
@@ -81,14 +81,14 @@ public:
FeaturePoint6dRelative
(
const
std
::
string
&
name
);
virtual
~
FeaturePoint6dRelative
(
void
)
{}
virtual
dynamicgraph
::
Vector
&
computeError
(
dynamicgraph
::
Vector
&
res
,
virtual
dynamicgraph
::
Vector
&
computeError
(
dynamicgraph
::
Vector
&
res
,
int
time
);
virtual
dynamicgraph
::
Vector
&
computeErrorDot
(
dynamicgraph
::
Vector
&
res
,
virtual
dynamicgraph
::
Vector
&
computeErrorDot
(
dynamicgraph
::
Vector
&
res
,
int
time
);
virtual
dynamicgraph
::
Matrix
&
computeJacobian
(
dynamicgraph
::
Matrix
&
res
,
virtual
dynamicgraph
::
Matrix
&
computeJacobian
(
dynamicgraph
::
Matrix
&
res
,
int
time
);
virtual
void
display
(
std
::
ostream
&
os
)
const
;
virtual
void
display
(
std
::
ostream
&
os
)
const
;
void
initCommands
(
void
);
void
initSdes
(
const
std
::
string
&
featureDesiredName
);
...
...
include/sot/core/feature-point6d.hh
View file @
677662e8
...
...
@@ -89,11 +89,11 @@ public:
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
);
virtual
dynamicgraph
::
Vector
&
computeErrordot
(
dynamicgraph
::
Vector
&
res
,
virtual
dynamicgraph
::
Vector
&
computeErrordot
(
dynamicgraph
::
Vector
&
res
,
int
time
);
virtual
dynamicgraph
::
Matrix
&
computeJacobian
(
dynamicgraph
::
Matrix
&
res
,
virtual
dynamicgraph
::
Matrix
&
computeJacobian
(
dynamicgraph
::
Matrix
&
res
,
int
time
);
/** Static Feature selection. */
...
...
@@ -107,7 +107,7 @@ public:
inline
static
Flags
selectTranslation
(
void
)
{
return
Flags
(
"111000"
);
}
inline
static
Flags
selectRotation
(
void
)
{
return
Flags
(
"000111"
);
}
virtual
void
display
(
std
::
ostream
&
os
)
const
;
virtual
void
display
(
std
::
ostream
&
os
)
const
;
public:
void
servoCurrentPosition
(
void
);
...
...
include/sot/core/fwd.hh
View file @
677662e8
...
...
@@ -16,8 +16,8 @@ namespace sot {
class
Device
;
class
AbstractSotExternalInterface
;
}
// namespace sot
}
// namespace dynamicgraph
}
// namespace dynamicgraph
#endif // SOT_CORE_FWD_HH
include/sot/core/macros.hh
View file @
677662e8
...
...
@@ -4,20 +4,24 @@
// ref https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/
#if defined(_MSC_VER)
#define SOT_CORE_DISABLE_WARNING_PUSH __pragma(warning( push ))
#define SOT_CORE_DISABLE_WARNING_POP __pragma(warning( pop ))
#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_PUSH __pragma(warning(push))
#define SOT_CORE_DISABLE_WARNING_POP __pragma(warning(pop))
#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_FALLTHROUGH
#elif defined(__GNUC__) || defined(__clang__)
#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_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_DEPRECATED SOT_CORE_DISABLE_WARNING(-Wdeprecated-declarations)
#define SOT_CORE_DISABLE_WARNING_FALLTHROUGH SOT_CORE_DISABLE_WARNING(-Wimplicit-fallthrough)
#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(warningName) \
SOT_CORE_DO_PRAGMA(GCC diagnostic ignored #warningName)
#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
...
...
include/sot/core/sot-loader.hh
View file @
677662e8
...
...
@@ -106,8 +106,7 @@ public:
std
::
string
&
out
,
std
::
string
&
err
);
/// \brief Run a python script inside the embeded python interpreter.
inline
void
runPythonFile
(
std
::
string
ifilename
,
std
::
string
&
err
)
{
inline
void
runPythonFile
(
std
::
string
ifilename
,
std
::
string
&
err
)
{
embeded_python_interpreter_
.
runPythonFile
(
ifilename
,
err
);
}
...
...
src/feature/feature-posture.cpp
View file @
677662e8
...
...
@@ -117,8 +117,8 @@ void FeaturePosture::selectDof(unsigned dofId, bool control) {
// Check that selected dof id is valid
if
(
dofId
>=
dim
)
{
std
::
ostringstream
oss
;
oss
<<
"dof id should less than state dimension: "
<<
dim
<<
". Received "
<<
dofId
<<
"."
;
oss
<<
"dof id should less than state dimension: "
<<
dim
<<
". Received "
<<
dofId
<<
"."
;
throw
ExceptionAbstract
(
ExceptionAbstract
::
TOOLS
,
oss
.
str
());
}
...
...
src/tools/device.cpp
View file @
677662e8
...
...
@@ -15,8 +15,8 @@
#include
"sot/core/device.hh"
#include
<iostream>
#include
<sot/core/macros.hh>
#include
<sot/core/debug.hh>
#include
<sot/core/macros.hh>
using
namespace
std
;
#include
<Eigen/Geometry>
...
...
@@ -230,35 +230,33 @@ void Device::setVelocitySize(const unsigned int &size) {
void
Device
::
setState
(
const
Vector
&
st
)
{
if
(
sanityCheck_
)
{
const
Vector
::
Index
&
s
=
st
.
size
();
SOT_CORE_DISABLE_WARNING_PUSH
SOT_CORE_DISABLE_WARNING_FALLTHROUGH
SOT_CORE_DISABLE_WARNING_PUSH
SOT_CORE_DISABLE_WARNING_FALLTHROUGH
switch
(
controlInputType_
)
{
case
CONTROL_INPUT_TWO_INTEGRATION
:
dgRTLOG
()
<<
"Sanity check for this control is not well supported. "
"In order to make it work, use pinocchio and the contact forces "
"to estimate the joint torques for the given acceleration.
\n
"
;
if
(
s
!=
lowerTorque_
.
size
()
||
s
!=
upperTorque_
.
size
())
{
std
::
ostringstream
os
;
os
<<
"dynamicgraph::sot::Device::setState: upper and/or lower torque"
"bounds do not match state size. Input State size = "
<<
st
.
size
()
<<
", lowerTorque_.size() = "
<<
lowerTorque_
.
size
()
<<
", upperTorque_.size() = "
<<
upperTorque_
.
size
()
<<
". Set them first with setTorqueBounds."
;
throw
std
::
invalid_argument
(
os
.
str
().
c_str
());
// fall through
if
(
s
!=
lowerTorque_
.
size
()
||
s
!=
upperTorque_
.
size
())
{
std
::
ostringstream
os
;
os
<<
"dynamicgraph::sot::Device::setState: upper and/or lower torque"
"bounds do not match state size. Input State size = "
<<
st
.
size
()
<<
", lowerTorque_.size() = "
<<
lowerTorque_
.
size
()
<<
", upperTorque_.size() = "
<<
upperTorque_
.
size
()
<<
". Set them first with setTorqueBounds."
;
throw
std
::
invalid_argument
(
os
.
str
().
c_str
());
// fall through
}
case
CONTROL_INPUT_ONE_INTEGRATION
:
if
(
s
!=
lowerVelocity_
.
size
()
||
s
!=
upperVelocity_
.
size
())
{
std
::
ostringstream
os
;
os
<<
"dynamicgraph::sot::Device::setState: upper and/or lower velocity"
" bounds do not match state size. Input State size = "
<<
st
.
size
()
<<
", lowerVelocity_.size() = "
<<
lowerVelocity_
.
size
()
<<
", upperVelocity_.size() = "
<<
upperVelocity_
.
size
()
<<
". Set them first with setVelocityBounds."
;
throw
std
::
invalid_argument
(
os
.
str
().
c_str
());
if
(
s
!=
lowerVelocity_
.
size
()
||
s
!=
upperVelocity_
.
size
())
{
std
::
ostringstream
os
;
os
<<
"dynamicgraph::sot::Device::setState: upper and/or lower velocity"
" bounds do not match state size. Input State size = "
<<
st
.
size
()
<<
", lowerVelocity_.size() = "
<<
lowerVelocity_
.
size
()
<<
", upperVelocity_.size() = "
<<
upperVelocity_
.
size
()
<<
". Set them first with setVelocityBounds."
;
throw
std
::
invalid_argument
(
os
.
str
().
c_str
());
}
// fall through
case
CONTROL_INPUT_NO_INTEGRATION
:
...
...
@@ -266,7 +264,7 @@ SOT_CORE_DISABLE_WARNING_FALLTHROUGH
default:
throw
std
::
invalid_argument
(
"Invalid control mode type."
);
}
SOT_CORE_DISABLE_WARNING_POP
SOT_CORE_DISABLE_WARNING_POP
}
state_
=
st
;
stateSOUT
.
setConstant
(
state_
);
...
...
@@ -319,8 +317,8 @@ void Device::setControlInputType(const std::string &cit) {
void
Device
::
setSanityCheck
(
const
bool
&
enableCheck
)
{
if
(
enableCheck
)
{
const
Vector
::
Index
&
s
=
state_
.
size
();
SOT_CORE_DISABLE_WARNING_PUSH
SOT_CORE_DISABLE_WARNING_FALLTHROUGH
SOT_CORE_DISABLE_WARNING_PUSH
SOT_CORE_DISABLE_WARNING_FALLTHROUGH
switch
(
controlInputType_
)
{
case
CONTROL_INPUT_TWO_INTEGRATION
:
dgRTLOG
()
...
...
@@ -347,7 +345,7 @@ SOT_CORE_DISABLE_WARNING_FALLTHROUGH
default:
throw
std
::
invalid_argument
(
"Invalid control mode type."
);
}
SOT_CORE_DISABLE_WARNING_POP
SOT_CORE_DISABLE_WARNING_POP
}
sanityCheck_
=
enableCheck
;
}
...
...
@@ -356,12 +354,12 @@ void Device::setPositionBounds(const Vector &lower, const Vector &upper) {
std
::
ostringstream
oss
;
if
(
lower
.
size
()
!=
state_
.
size
())
{
oss
<<
"Lower bound size should be "
<<
state_
.
size
()
<<
", got "
<<
lower
.
size
();
<<
lower
.
size
();
throw
std
::
invalid_argument
(
oss
.
str
());
}
if
(
upper
.
size
()
!=
state_
.
size
())
{
oss
<<
"Upper bound size should be "
<<
state_
.
size
()
<<
", got "
<<
upper
.
size
();
<<
upper
.
size
();
throw
std
::
invalid_argument
(
oss
.
str
());
}
lowerPosition_
=
lower
;
...
...
@@ -372,12 +370,12 @@ void Device::setVelocityBounds(const Vector &lower, const Vector &upper) {
std
::
ostringstream
oss
;
if
(
lower
.
size
()
!=
velocity_
.
size
())
{
oss
<<
"Lower bound size should be "
<<
velocity_
.
size
()
<<
", got "
<<
lower
.
size
();
<<
lower
.
size
();
throw
std
::
invalid_argument
(
oss
.
str
());
}
if
(
upper
.
size
()
!=
velocity_
.
size
())
{
oss
<<
"Upper bound size should be "
<<
velocity_
.
size
()
<<
", got "
<<
upper
.
size
();
<<
upper
.
size
();
throw
std
::
invalid_argument
(
oss
.
str
());
}
lowerVelocity_
=
lower
;
...
...
@@ -389,12 +387,12 @@ void Device::setTorqueBounds(const Vector &lower, const Vector &upper) {
std
::
ostringstream
oss
;
if
(
lower
.
size
()
!=
state_
.
size
())
{
oss
<<
"Lower bound size should be "
<<
state_
.
size
()
<<
", got "
<<
lower
.
size
();
<<
lower
.
size
();
throw
std
::
invalid_argument
(
oss
.
str
());
}
if
(
upper
.
size
()
!=
state_
.
size
())
{
oss
<<
"Lower bound size should be "
<<
state_
.
size
()
<<
", got "
<<
upper
.
size
();
<<
upper
.
size
();
throw
std
::
invalid_argument
(
oss
.
str
());
}
lowerTorque_
=
lower
;
...
...
src/tools/sot-loader.cpp
View file @
677662e8
...
...
@@ -128,8 +128,7 @@ bool SotLoader::initialization() {
void
SotLoader
::
cleanUp
()
{
// 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.
if
(
device_name_
!=
""
)
{
if
(
device_name_
!=
""
)
{
PoolStorage
::
getInstance
()
->
deregisterEntity
(
device_name_
);
}
...
...
@@ -192,8 +191,8 @@ void SotLoader::loadDeviceInPython(const std::string &device_name) {
err
);
// Get the existing C++ entity pointer in the Python interpreter.
runPythonCommand
(
"loaded_device_name =
\"
"
+
device_name
+
"
\"
"
,
result
,
out
,
err
);
runPythonCommand
(
"loaded_device_name =
\"
"
+
device_name
+
"
\"
"
,
result
,
out
,
err
);
runPythonCommand
(
"device_cpp_object = Device(loaded_device_name)"
,
result
,
out
,
err
);
...
...
tests/tools/bad_python_script.py
View file @
677662e8
a
=
1
+
1
print
(
b
)
\ No newline at end of file
print
(
b
)
tests/tools/dummy-sot-external-interface.cc
View file @
677662e8
...
...
@@ -24,7 +24,7 @@ void DummySotExternalInterface::setupSetSensors(
}
void
DummySotExternalInterface
::
nominalSetSensors
(
std
::
map
<
std
::
string
,
dynamicgraph
::
sot
::
SensorValues
>
&
/*sensorsIn*/
)
{
std
::
map
<
std
::
string
,
dynamicgraph
::
sot
::
SensorValues
>
&
/*sensorsIn*/
)
{
return
;
}
...
...
tests/tools/good_python_script.py
View file @
677662e8
a
=
1
+
1
b
=
a
print
(
b
)
\ No newline at end of file
print
(
b
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment