Go to the documentation of this file.
26 #include <dynamic-graph/factory.h>
30 #include <Eigen/Geometry>
31 #include <pinocchio/multibody/liegroup/special-euclidean.hpp>
36 const std::string Device::CLASS_NAME =
"Device";
41 const double &upper) {
43 assert(lower <= upper);
57 #define CHECK_BOUNDS(val, lower, upper, what, eps) \
58 for (size_type i = 0; i < val.size(); ++i) { \
59 double old = val(i); \
60 if (saturateBounds(val(i), lower(i), upper(i)) > eps) { \
61 std::ostringstream oss; \
62 oss << "Robot " what " bound violation at DoF " << i << ": requested " \
63 << old << " but set " << val(i) << '\n'; \
64 SEND_ERROR_STREAM_MSG(oss.str()); \
73 for (std::size_t
i = 0;
i < 4; ++
i) {
78 Device::Device(
const std::string &
n)
83 controlSIN(NULL,
"Device(" +
n +
")::input(double)::control"),
84 attitudeSIN(NULL,
"Device(" +
n +
")::input(vector3)::attitudeIN"),
85 zmpSIN(NULL,
"Device(" +
n +
")::input(vector3)::zmp"),
86 stateSOUT(
"Device(" +
n +
")::output(vector)::state")
89 velocitySOUT(
"Device(" +
n +
")::output(vector)::velocity"),
90 attitudeSOUT(
"Device(" +
n +
")::output(matrixRot)::attitude"),
91 motorcontrolSOUT(
"Device(" +
n +
")::output(vector)::motorcontrol"),
92 previousControlSOUT(
"Device(" +
n +
")::output(vector)::previousControl"),
93 ZMPPreviousControllerSOUT(
"Device(" +
n +
94 ")::output(vector)::zmppreviouscontroller"),
95 robotState_(
"Device(" +
n +
")::output(vector)::robotState"),
96 robotVelocity_(
"Device(" +
n +
")::output(vector)::robotVelocity"),
97 pseudoTorqueSOUT(
"Device(" +
n +
")::output(vector)::ptorque")
100 lastTimeControlWasRead_(0),
109 "Device(" +
n +
")::output(vector6)::forceRLEG");
111 "Device(" +
n +
")::output(vector6)::forceLLEG");
113 "Device(" +
n +
")::output(vector6)::forceRARM");
115 "Device(" +
n +
")::output(vector6)::forceLARM");
132 std::string docstring;
136 " Set size of state vector\n"
142 " Set state vector value\n"
149 " Set velocity vector value\n"
156 "matrix homogeneous");
163 " Set the position calculous starting from \n"
164 " acceleration measure instead of velocity \n"
174 " Display information on device \n"
182 " Set the type of control input which can be \n"
183 " acceleration, velocity, or position\n"
192 " Enable/Disable sanity checks\n"
202 "vector: lower bounds",
203 "vector: upper bounds")));
209 "vector: lower bounds",
210 "vector: upper bounds")));
216 "vector: lower bounds",
217 "vector: upper bounds")));
227 const double &period) {
229 std::vector<double> control;
234 control.resize(dgControl.size());
239 for (
size_type i = 0;
i < dgControl.size(); ++
i) control[
i] = dgControl[
i];
240 controlOut[
"control"].setValues(control);
277 Eigen::Matrix4d _matrix4d(root);
285 q = worldMwaist.translation();
286 for (std::size_t
i = 0;
i < 3; ++
i)
q(
i + 3) =
r(
i);
298 std::ostringstream oss;
300 oss <<
"Lower bound size should be " <<
controlSize_ <<
", got "
302 throw std::invalid_argument(oss.str());
305 oss <<
"Upper bound size should be " <<
controlSize_ <<
", got "
307 throw std::invalid_argument(oss.str());
314 std::ostringstream oss;
316 oss <<
"Lower bound size should be " <<
controlSize_ <<
", got "
318 throw std::invalid_argument(oss.str());
321 oss <<
"Upper bound size should be " <<
controlSize_ <<
", got "
323 throw std::invalid_argument(oss.str());
331 std::ostringstream oss;
333 oss <<
"Lower bound size should be " <<
controlSize_ <<
", got "
335 throw std::invalid_argument(oss.str());
338 oss <<
"Lower bound size should be " <<
controlSize_ <<
", got "
340 throw std::invalid_argument(oss.str());
virtual void setRoot(const dynamicgraph::Matrix &root)
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > controlSIN
virtual void cmdDisplay()
dynamicgraph::Vector forceZero6
dynamicgraph::Vector state_
void setPositionBounds(const Vector &lower, const Vector &upper)
void setControlSize(const size_type &size)
void getControl(std::map< std::string, ControlValues > &anglesOut, const double &period)
virtual void setControlInputType(const std::string &cit)
virtual void display(std::ostream &os) const
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > * forcesSOUT[4]
The force torque sensors.
virtual void setSecondOrderIntegration()
void setSanityCheck(const bool &enableCheck)
void setTorqueBounds(const Vector &lower, const Vector &upper)
CommandVoid0< E > * makeCommandVoid0(E &entity, boost::function< void(E *)> function, const std::string &docString)
DirectGetter< E, T > * makeDirectGetter(E &entity, T *ptr, const std::string &docString)
sigtime_t lastTimeControlWasRead_
virtual void setVelocity(const dynamicgraph::Vector &vel)
Eigen::Vector3d SOT_CORE_EXPORT VectorRollPitchYaw
#define sotDEBUGOUT(level)
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > zmpSIN
std::string docCommandVoid1(const std::string &doc, const std::string &type)
void setVelocityBounds(const Vector &lower, const Vector &upper)
double saturateBounds(double &val, const double &lower, const double &upper)
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > pseudoTorqueSOUT
#define sotDEBUGIN(level)
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > motorcontrolSOUT
The current state of the robot from the command viewpoint.
size_type getControlSize() const
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > previousControlSOUT
virtual void setNoIntegration()
virtual void setConstant(const T &t)
CommandVoid2< E, T1, T2 > * makeCommandVoid2(E &entity, boost::function< void(const T1 &, const T2 &)> function, const std::string &docString)
std::string docCommandVoid2(const std::string &doc, const std::string &type1, const std::string &type2)
void setVelocitySize(const size_type &size)
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > attitudeSIN
dynamicgraph::Vector velocity_
std::string docDirectGetter(const std::string &name, const std::string &type)
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > velocitySOUT
ControlInput controlInputType_
#define CHECK_BOUNDS(val, lower, upper, what, eps)
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > robotState_
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > ZMPPreviousControllerSOUT
The ZMP reference send by the previous controller.
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > robotVelocity_
Motor velocities.
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t > stateSOUT
void addCommand(const std::string &name, command::Command *command)
dynamicgraph::Signal< MatrixRotation, sigtime_t > attitudeSOUT
virtual void setState(const dynamicgraph::Vector &st)
virtual void setStateSize(const size_type &size)
void signalRegistration(const SignalArray< sigtime_t > &signals)
CommandVoid1< E, T > * makeCommandVoid1(E &entity, boost::function< void(const T &)> function, const std::string &docString)
sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31