29 #define SOT_FULL_TO_REDUCED(sotName) \ 30 sotName##FullSizeSIN(NULL, "GripperControl(" + name + \ 31 ")::input(vector)::" + #sotName + "FullIN"), \ 32 sotName##ReduceSOUT( \ 33 SOT_INIT_SIGNAL_2(GripperControlPlugin::selector, \ 34 sotName##FullSizeSIN, dynamicgraph::Vector, \ 35 selectionSIN, Flags), \ 36 "GripperControl(" + name + ")::input(vector)::" + #sotName + \ 42 const double DT = 0.005;
49 calibrationStarted(false),
51 "GripperControl(" + name +
")::input(vector)::position"),
53 NULL,
"GripperControl(" + name +
")::input(vector)::positionDes"),
54 torqueSIN(NULL,
"GripperControl(" + name +
")::input(vector)::torque"),
56 NULL,
"GripperControl(" + name +
")::input(vector)::torqueLimit"),
57 selectionSIN(NULL,
"GripperControl(" + name +
")::input(vector)::selec")
69 "GripperControl(" + name +
")::output(vector)::reference") {
88 std::string docstring =
"Control of gripper.";
103 if (
factor.size() != SIZE) {
109 if (torques.size() == 0) {
110 dgRTLOG() <<
"torque is not provided " << std::endl;
114 for (
int i = 0;
i < SIZE; ++
i) {
117 if ((torques(
i) > torqueLimits(
i)) && (currentNormVel(
i) > 0)) {
119 }
else if ((torques(
i) < -torqueLimits(
i)) && (currentNormVel(
i) < 0)) {
146 sotDEBUG(25) <<
" velocity " << velocity << std::endl;
151 weightedVel = velocity *
factor;
152 sotDEBUG(25) <<
" weightedVel " << weightedVel << std::endl;
155 referencePos.resize(SIZE);
156 referencePos = currentPos + weightedVel *
DT;
164 for (
int i = 0;
i < fullsize.size(); ++
i) {
165 if (selec(
i)) size++;
170 for (
int i = 0;
i < fullsize.size(); ++
i) {
171 if (selec(
i)) desPos(curs++) = fullsize(
i);
181 namespace dc = ::dynamicgraph::command;
184 "set the offset (should be in )0, 1( )."));
188 if ((value > 0) && (value < 1))
191 throw std::invalid_argument(
"The offset should be in )0, 1(.");
GripperControlPlugin(const std::string &name)
static const double OFFSET_DEFAULT
dynamicgraph::SignalPtr< Flags, int > selectionSIN
dynamicgraph::Vector factor
The multiplication.
virtual std::string getDocString() const
void signalRegistration(const SignalArray< int > &signals)
#define sotDEBUGOUT(level)
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > positionReduceSOUT
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(FeaturePosture, "FeaturePosture")
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > torqueLimitSIN
#define sotDEBUGIN(level)
#define SOT_FULL_TO_REDUCED(sotName)
void computeIncrement(const dynamicgraph::Vector &torques, const dynamicgraph::Vector &torqueLimits, const dynamicgraph::Vector ¤tNormVel)
Computes the.
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > torqueReduceSOUT
dynamicgraph::Vector & computeDesiredPosition(const dynamicgraph::Vector ¤tPos, const dynamicgraph::Vector &desiredPos, const dynamicgraph::Vector &torques, const dynamicgraph::Vector &torqueLimits, dynamicgraph::Vector &referencePos)
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > torqueLimitReduceSOUT
#define SOT_MEMBER_SIGNAL_4(sotFunction, sotArg1, sotArg1Type, sotArg2, sotArg2Type, sotArg3, sotArg3Type, sotArg4, sotArg4Type)
virtual void plug(SignalBase< Time > *ref)
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > desiredPositionSOUT
static dynamicgraph::Vector & selector(const dynamicgraph::Vector &fullsize, const Flags &selec, dynamicgraph::Vector &desPos)
select only some of the values of the vector fullsize, based on the Flags vector. ...
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > positionFullSizeSIN
The goal of this entity is to ensure that the maximal torque will not be exceeded during a grasping t...
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > torqueSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > torqueLimitFullSizeSIN
virtual ~GripperControlPlugin(void)
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > torqueFullSizeSIN
void addCommand(const std::string &name, command::Command *command)
void setOffset(const double &value)
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > positionDesSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > positionSIN