75 throw std::runtime_error(
"Please use YouBotGripperParameter");
81 throw std::runtime_error(
"Please use YouBotGripperParameter");
92 unsigned int retry = 0;
108 throw std::runtime_error(
"Unable to get firmware version of the gripper");
112 char versionString[8] = {0};
123 int controllerType = 0;
124 float firmwareVersion = 0;
125 sscanf(versionString,
"%dV%f", &controllerType, &firmwareVersion);
128 parameter.
setParameter(controllerType, firmwareVersion);
154 bool doCalibration =
true;
155 if (parameter.
value ==
false) {
161 doCalibration =
false;
166 LOG(
info) <<
"Calibrate Gripper";
170 unsigned int maxenc = 0;
172 bar1->getConfigurationParameter(maxencoder);
187 bool targetReachedBar1 =
false;
188 bool targetReachedBar2 =
false;
190 for (
int i = 0; i < 40; i++) {
192 bar1->getConfigurationParameter(bar1TargetReched);
194 bar2->getConfigurationParameter(bar2TargetReched);
196 if (targetReachedBar1 && targetReachedBar2){
211 targetReachedBar1 =
false;
212 targetReachedBar2 =
false;
214 for (
int i = 0; i < 40; i++) {
216 bar1->getConfigurationParameter(bar1TargetReched);
218 bar2->getConfigurationParameter(bar2TargetReched);
220 if (targetReachedBar1 && targetReachedBar2)
238 bar1->setConfigurationParameter(actualPose);
239 bar2->setConfigurationParameter(actualPose);
290 bar1->setData(setpointBar1);
291 bar2->setData(setpointBar2);
300 bar1->getData(bar1Position);
301 bar2->getData(bar2Position);
312 unsigned int bar1MaxEncoderValue = 0;
313 unsigned int bar2MaxEncoderValue = 0;
315 bar1->getConfigurationParameter(maxEnc);
317 bar2->getConfigurationParameter(maxEnc);
322 setpointBar1.
barEncoder = bar1MaxEncoderValue;
323 setpointBar2.
barEncoder = bar2MaxEncoderValue;
325 bar1->setData(setpointBar1);
326 bar2->setData(setpointBar2);
338 bar1->setData(setpointBar1);
339 bar2->setData(setpointBar2);
346 throw std::runtime_error(
"gripper bar 1 is missing");
355 throw std::runtime_error(
"gripper bar 2 is missing");
363 std::stringstream errorMessageStream;
364 errorMessageStream <<
"Joint " << this->
jointNumber <<
": ";
365 std::string errorMessage;
366 errorMessage = errorMessageStream.str();
377 LOG(
error) << errorMessage <<
"Parameter name: " << mailboxMsg.
parameterName <<
" has a wrong type!";
385 LOG(
error) << errorMessage <<
"Parameter name: " << mailboxMsg.
parameterName <<
" Configuration EEPROM locked";
402 mailboxMsgBuffer = mailboxMsg;
404 unsigned int retry = 0;
446 unsigned int retry = 0;
Indicates that the actual position equals the target position.
unsigned int timeTillNextMailboxUpdate
quantity< si::length > barPosition
The encoder value when the gripper has reached it's maximum bar spacing position. ...
abstract gripper parameter
YouBotGripper(const unsigned int jointNo, const std::string &configFilePath="../config/")
virtual void setMailboxMsgBuffer(const YouBotSlaveMailboxMsg &msgBuffer, const unsigned int jointNumber)=0
void parseMailboxStatusFlags(const YouBotSlaveMailboxMsg &mailboxMsg) const
Actual position of one gripper bar.
bool retrieveValueFromMotorContoller(YouBotSlaveMailboxMsg &message) const
void setParameter(const int parameter)
mailboxInputBuffer stctInput
void setParameter(const int controllerType, const double firmwareVersion)
The sensed bar spacing for a one DOF gripper.
The encoder setpoint for one bar.
mailboxOutputBuffer stctOutput
virtual void setData(const GripperData &data)
YouBotGripperBar & getGripperBar1()
Setpoint length of the bar spacing for a one DOF gripper.
virtual void setConfigurationParameter(const GripperParameter ¶meter)
boost::scoped_ptr< YouBotGripperBar > bar2
EthercatMasterInterface * ethercatMaster
Joint parameter exception.
unsigned int mailboxMsgRetries
void getParameter(unsigned int ¶meter) const
YouBotGripperBar & getGripperBar2()
EtherCAT mailbox message of the youBot slaves.
One bar of the youBot gripper.
#define SLEEP_MILLISEC(millisec)
boost::scoped_ptr< YouBotGripperBar > bar1
the firmware version of the gripper
void getParameter(bool ¶meter) const
abstract class of gripper data
quantity< si::length > barSpacing
void getYouBotMailboxMsg(YouBotSlaveMailboxMsg &message) const
quantity< si::length > barSpacing
std::string parameterName
#define USER_VARIABLE_BANK
The bar position for a one gripper bar.
quantity< si::length > barPosition
static EthercatMasterInterface & getInstance(const std::string configFile="youbot-ethercat.cfg", const std::string configFilePath="../config/", const bool ethercatMasterWithThread=true)
abstract class of data for gripper with one degree of freedom
The sensed bar position for a one gripper bar.
virtual void getConfigurationParameter(GripperParameter ¶meter) const
virtual void getData(const GripperData &data) const
virtual bool getMailboxMsgBuffer(YouBotSlaveMailboxMsg &mailboxMsg, const unsigned int jointNumber)=0
bool setValueToMotorContoller(const YouBotSlaveMailboxMsg &mailboxMsg) const