28 namespace canopen_schunk {
37 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
42 if (node->getNodeId() == node_id || node_id < 0)
52 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
57 if (node->getNodeId() == node_id || node_id < 0)
66 bool successful =
false;
67 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
72 if (node->getNodeId() == node_id)
74 successful = node->setTarget(target);
83 bool all_successful =
true;
87 LOGGING_ERROR (CanOpen,
"The given number of target points (" << targets.size() <<
88 ") does not match the " <<
89 "number of nodes registered to this group (" <<
m_ds402_nodes.size() <<
")." <<
endl 94 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
99 all_successful &= node->setTarget(targets[i]);
103 return all_successful;
108 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
113 if (node->getNodeId() == node_id || node_id < 0)
115 node->startPPMovement();
122 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
127 if (node->getNodeId() == node_id || node_id < 0)
129 node->acceptPPTargets();
138 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
143 feedback[i] = node->getTargetFeedback();
150 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
155 if (node->getNodeId() == node_id || node_id < 0)
157 node->setDefaultPDOMapping(mapping);
164 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
169 if (node->getNodeId() == node_id || node_id < 0)
180 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
185 modes[i] = node->getModeOfOperation();
192 bool all_successful =
true;
193 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
198 if (node->getNodeId() == node_id || node_id < 0)
200 all_successful &= node->setModeOfOperation(op_mode);
204 return all_successful;
209 bool supported_by_all =
true;
210 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
215 if (node->getNodeId() == node_id || node_id < 0)
217 supported_by_all &= node->isModeSupported(op_mode);
221 return supported_by_all;
226 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
231 if (node->getNodeId() == node_id || node_id < 0)
234 #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_ 239 #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_ 248 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
253 if (node->getNodeId() == node_id || node_id < 0)
255 node->setupProfilePositionMode(config);
262 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
267 if (node->getNodeId() == node_id || node_id < 0)
269 node->setupHomingMode(config);
276 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
281 if (node->getNodeId() == node_id || node_id < 0)
283 node->setupProfileVelocityMode(config);
290 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
295 if (node->getNodeId() == node_id || node_id < 0)
297 node->setupProfileTorqueMode(config);
304 bool all_successful =
true;
305 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
310 if (node->getNodeId() == node_id || node_id < 0)
312 all_successful &= node->resetFault();
316 return all_successful;
321 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
326 if (node->getNodeId() == node_id || node_id < 0)
328 node->configureInterpolationCycleTime(interpolation_cycle_time_ms);
335 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
340 if (node->getNodeId() == node_id || node_id < 0)
342 node->configureHomingSpeeds(low_speed, high_speed);
349 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
354 if (node->getNodeId() == node_id || node_id < 0)
356 node->configureHomingSpeeds(homing_method);
363 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
368 if (node->getNodeId() == node_id || node_id < 0)
370 node->enableNode(operation_mode);
372 #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_ 377 #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_ 385 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
390 if (node->getNodeId() == node_id || node_id < 0)
394 #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_ 399 #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_ 406 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
411 if (node->getNodeId() == node_id || node_id < 0)
414 #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_ 419 #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_ 426 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
431 if (node->getNodeId() == node_id || node_id < 0)
434 #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_ 439 #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_ 447 bool reached_all =
true;
449 for (std::vector<DS402Node::Ptr>::iterator it =
m_ds402_nodes.begin();
454 reached_single[i] = node->isTargetReached();
455 reached_all &= reached_single[i];
std::vector< DS402Node::Ptr > m_ds402_nodes
virtual void configureHomingSpeeds(const uint32_t low_speed, const uint32_t high_speed=0, const int16_t node_id=-1)
Set the speeds for homing through SDO 6099. Typically, a high speed is used when searching for a home...
virtual void setDefaultPDOMapping(const DS402Node::eDefaultPDOMapping mapping, const int16_t node_id=-1)
Choose one of the predefined default mappings. Please see the enum eDefaultPDOMapping for a list of a...
Configuration parameters for a Profile_Position_Mode according to CiA DSP-402 V1.1 section 12...
virtual void setupHomingMode(const ds402::HomingModeConfiguration &config, const int16_t node_id=-1)
Configure the mandatory parameters for a homing mode.
virtual void getTargetFeedback(std::vector< double > &feedback)
Depending on the mode of operation, this will return the current position, velocity or torque...
Configuration parameters for a Profile_Velocity_Mode according to CiA DSP-402 V1.1 section 16...
virtual bool setTarget(const std::vector< float > &targets)
Sets the target for the motor. What that target is, depends on the selected mode of operation...
virtual void getModeOfOperation(std::vector< ds402::eModeOfOperation > &modes)
Gets a vector of the Mode of operation of all nodes within this group.
The DS301Group class is the base Class for all canOpen device groups, providing basic interfaces to t...
virtual void openBrakes(const int16_t node_id=-1)
When the device is in OperationEnabled mode, this function enables the drive motion.
virtual bool isModeSupported(const ds402::eModeOfOperation op_mode, const int16_t node_id=-1)
Tests whether a given mode of operation is supported by the device.
#define LOGGING_ERROR(streamname, arg)
virtual void startPPMovement(const int16_t node_id=-1)
This sets the RPDO communication for enabling the movement after a target has been set...
virtual void printStatus(const int16_t node_id=-1)
Prints a stringified version of the statusword to the logging system.
virtual void enableNodes(const ds402::eModeOfOperation operation_mode=ds402::MOO_RESERVED_0, const int16_t node_id=-1)
Switches on the device and enters Operation Enabled mode with the given mode. If the requested mode i...
ThreadStream & endl(ThreadStream &stream)
virtual void setupProfilePositionMode(const ds402::ProfilePositionModeConfiguration &config, const int16_t node_id=-1)
Configure the mandatory parameters for a profile position mode.
virtual bool resetFault(const int16_t node_id=-1)
This function is used to recover from a fault state.
virtual void acceptPPTargets(const int16_t node_id=-1)
After enabling PP movement, this enables accepting new targets again. Remember to sync all nodes and ...
boost::shared_ptr< icl_comm::websocket::WsBroadcaster > m_ws_broadcaster
Interface to send out diagnostics data. Only available if compiled with IC_BUILDER_ICL_COMM_WEBSOCKET...
virtual void setupProfileVelocityMode(const ds402::ProfileVelocityModeConfiguration &config, const int16_t node_id=-1)
Configure the mandatory parameters for a profile velocity mode.
virtual void initNodes(const int16_t node_id=-1)
Initializes the node. Tries to query all required data from the device.
virtual void home(const int16_t node_id=-1)
Perform homing for nodes.
virtual bool isTargetReached(std::vector< bool > &reached_single)
Returns whether the device has reached it's recent target.
virtual bool setModeOfOperation(const ds402::eModeOfOperation op_mode, const int16_t node_id=-1)
Sets and initializes a mode of operation. First it will check whether the device supports the request...
Configuration parameters for a Profile_Torque_Mode according to CiA DSP-402 V1.1 section 17...
virtual void setupProfileTorqueMode(const ds402::ProfileTorqueModeConfiguration &config, const int16_t node_id=-1)
Configure the mandatory parameters for a profile torque mode.
virtual void closeBrakes(const int16_t node_id=-1)
When the device is in OperationEnabled mode, this function disables the drive motion.
virtual void quickStop(const int16_t node_id=-1)
This sends the controlword for performing a quick_stop.
virtual void configureInterpolationCycleTime(const int16_t node_id=-1, const uint8_t interpolation_cycle_time_ms=20)
Set the interpolation cycle time in milliseconds. If no time is given the default will be used...
virtual void configureHomingMethod(const int8_t homing_method, const int16_t node_id=-1)
Set the device's homing method through an SDO (OD 0x6098)
virtual void disableNodes(const int16_t node_id=-1)
Puts the device into STATE_SWITCHED_ON mode. If the device was in InterpolatedPositionMode, interpolation will be stopped here, as well.
DS402Group(const std::string &name="")
Configuration parameters for a Homing_Mode according to CiA DSP-402 V1.1 section 13.2.1.