The DS402Group class is the base class for canOpen devices implementing the DS402 device protocol (motors) More...
#include <DS402Group.h>
Public Types | |
typedef boost::shared_ptr< const DS402Group > | ConstPtr |
Shared pointer to a const DS402Group. More... | |
typedef boost::shared_ptr< DS402Group > | Ptr |
Shared pointer to a DS402Group. More... | |
Public Types inherited from icl_hardware::canopen_schunk::DS301Group | |
typedef boost::shared_ptr< const DS301Group > | ConstPtr |
Shared pointer to a const DS301Group. More... | |
typedef boost::shared_ptr< DS301Group > | Ptr |
Shared pointer to a DS301Group. More... | |
Public Member Functions | |
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 download RPDOs before and after. More... | |
virtual void | closeBrakes (const int16_t node_id=-1) |
When the device is in OperationEnabled mode, this function disables the drive motion. More... | |
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) More... | |
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 switch and the slow speed is used when searching for the index. More... | |
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. More... | |
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. More... | |
DS402Group (const std::string &name="") | |
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 is InterpolatedPositionMode, interpolation will be started automatically. More... | |
virtual void | getModeOfOperation (std::vector< ds402::eModeOfOperation > &modes) |
Gets a vector of the Mode of operation of all nodes within this group. More... | |
virtual void | getTargetFeedback (std::vector< double > &feedback) |
Depending on the mode of operation, this will return the current position, velocity or torque. More... | |
virtual void | home (const int16_t node_id=-1) |
Perform homing for nodes. More... | |
virtual void | initNodes (const int16_t node_id=-1) |
Initializes the node. Tries to query all required data from the device. More... | |
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. More... | |
virtual bool | isTargetReached (std::vector< bool > &reached_single) |
Returns whether the device has reached it's recent target. More... | |
virtual void | openBrakes (const int16_t node_id=-1) |
When the device is in OperationEnabled mode, this function enables the drive motion. More... | |
virtual void | printStatus (const int16_t node_id=-1) |
Prints a stringified version of the statusword to the logging system. More... | |
virtual void | quickStop (const int16_t node_id=-1) |
This sends the controlword for performing a quick_stop. More... | |
virtual bool | resetFault (const int16_t node_id=-1) |
This function is used to recover from a fault state. More... | |
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 available mappings. See the implementation for further details about the mappings. More... | |
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 requested mode. So if you request a mode that the device does not support, it just returns false and does nothing. More... | |
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. The value will be clamped into the range value that is defined by the CanOpen specification. More... | |
virtual bool | setTarget (const float target, const uint8_t node_id) |
Sets the target for the motor. What that target is, depends on the selected mode of operation. The value will be clamped into the range value that is defined by the CanOpen specification. More... | |
virtual void | setupHomingMode (const ds402::HomingModeConfiguration &config, const int16_t node_id=-1) |
Configure the mandatory parameters for a homing mode. More... | |
virtual void | setupProfilePositionMode (const ds402::ProfilePositionModeConfiguration &config, const int16_t node_id=-1) |
Configure the mandatory parameters for a profile position mode. More... | |
virtual void | setupProfileTorqueMode (const ds402::ProfileTorqueModeConfiguration &config, const int16_t node_id=-1) |
Configure the mandatory parameters for a profile torque mode. More... | |
virtual void | setupProfileVelocityMode (const ds402::ProfileVelocityModeConfiguration &config, const int16_t node_id=-1) |
Configure the mandatory parameters for a profile velocity mode. More... | |
virtual void | startPPMovement (const int16_t node_id=-1) |
This sets the RPDO communication for enabling the movement after a target has been set. Note, that sync and pdo-download has to be called in between setting the target and enabling movement. Afterwards call acceptPPTarget() to enable setting following targets. More... | |
Public Member Functions inherited from icl_hardware::canopen_schunk::DS301Group | |
virtual void | appendPDOMappingSingle (const PDO::MappingConfigurationList &config, const uint16_t pdo_nr, const PDO::eTransmissionType &transmission_type, const DS301Node::ePDO_TYPE &pdo_type, const bool dummy_mapping=false, const uint8_t cyclic_timeout_cycles=0, const int16_t node_id=-1) |
Appends one or more mapping parameters to the existing mapping. Note that the PDO will be disabled while appending another mapping. More... | |
virtual bool | deleteNodeFromId (const uint8_t node_id) |
Deletes a node with a given node id from the node list, if it is present. If the node can't be found in this group, this function will return false;. More... | |
virtual void | deleteNodes (std::vector< uint8_t > &deleted_ids) |
Deletes all nodes assigned to the group. More... | |
void | downloadPDOs () |
DS301Group (const std::string &name="") | |
std::string | getName () const |
Returns the group's identifier string. More... | |
virtual std::vector< DS301Node::Ptr > | getNodes () const |
Returns the group's node vector. More... | |
virtual void | initPDOMappingSingle (const PDO::MappingConfigurationList &config, const uint16_t pdo_nr, const PDO::eTransmissionType &transmission_type, const DS301Node::ePDO_TYPE &pdo_type, const bool dummy_mapping=false, const uint8_t cyclic_timeout_cycles=0, const int16_t node_id=-1) |
Init PDO mapping with a given mapping configuration for a given pdo nr. More... | |
void | printPDOMapping (const uint8_t node_id=-1) |
Will query the PDO mapping from the device and print that to the output. More... | |
void | registerWSBroadcaster (boost::shared_ptr< icl_comm::websocket::WsBroadcaster > broadcaster) |
registerWSBroadcaster Adds a debug interface More... | |
void | uploadPDOs () |
Protected Member Functions | |
template<typename NodeT > | |
DS301Node::Ptr | addNode (const uint8_t node_id, const CanDevPtr can_device, HeartBeatMonitor::Ptr heartbeat_monitor) |
Creates a new node and adds it to the group. More... | |
Protected Member Functions inherited from icl_hardware::canopen_schunk::DS301Group | |
template<typename NodeT > | |
DS301Node::Ptr | addNode (const uint8_t node_id, const CanDevPtr can_device, HeartBeatMonitor::Ptr heartbeat_monitor) |
Creates a new DS301Node and adds it to the group-. More... | |
Protected Attributes | |
std::vector< DS402Node::Ptr > | m_ds402_nodes |
Protected Attributes inherited from icl_hardware::canopen_schunk::DS301Group | |
std::string | m_name |
std::vector< DS301Node::Ptr > | m_nodes |
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 More... | |
Friends | |
class | CanOpenController |
The DS402Group class is the base class for canOpen devices implementing the DS402 device protocol (motors)
The DS402Group provides interfaces to a group of canOpen defices implementing the DS402 device profile. This includes mainly the management of the internal statemachine by NMT protocoll but also interfaces for inclusion into custom software such as setTarget or getStatus which can be uses for cyclic commandation of target positions (or other values if so desired) The DS402Group is intentionally kept generic in its interface as it is supposed to control various DS402 devices. If a more specific interface is required for the devices it is intended that the developer inherits from this class and implements further interfaces. By building on the DS301Group the most common functionalities of the canOpen protocol should be inherited
Definition at line 45 of file DS402Group.h.
Shared pointer to a const DS402Group.
Definition at line 51 of file DS402Group.h.
Shared pointer to a DS402Group.
Definition at line 49 of file DS402Group.h.
icl_hardware::canopen_schunk::DS402Group::DS402Group | ( | const std::string & | name = "" | ) |
Definition at line 30 of file DS402Group.cpp.
|
virtual |
After enabling PP movement, this enables accepting new targets again. Remember to sync all nodes and download RPDOs before and after.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 120 of file DS402Group.cpp.
|
protected |
Creates a new node and adds it to the group.
node_id | ID of the new node |
can_device | Shared pointer to the can device |
Definition at line 31 of file DS402Group.hpp.
|
virtual |
When the device is in OperationEnabled mode, this function disables the drive motion.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 424 of file DS402Group.cpp.
|
virtual |
Set the device's homing method through an SDO (OD 0x6098)
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
homing_method | Homing method index that should be used |
Definition at line 347 of file DS402Group.cpp.
|
virtual |
Set the speeds for homing through SDO 6099. Typically, a high speed is used when searching for a home switch and the slow speed is used when searching for the index.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 333 of file DS402Group.cpp.
|
virtual |
Set the interpolation cycle time in milliseconds. If no time is given the default will be used.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
interpolation_cycle_time_ms | Interpolation cycle time in milliseconds |
Definition at line 319 of file DS402Group.cpp.
|
virtual |
Puts the device into STATE_SWITCHED_ON mode. If the device was in InterpolatedPositionMode, interpolation will be stopped here, as well.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 383 of file DS402Group.cpp.
|
virtual |
Switches on the device and enters Operation Enabled mode with the given mode. If the requested mode is InterpolatedPositionMode, interpolation will be started automatically.
operation_mode | DS402 Operation mode that should be used. If left blank, no mode will be set. However, then you should make sure to set it in advance (Which might be done in initialization already). |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 361 of file DS402Group.cpp.
|
virtual |
Gets a vector of the Mode of operation of all nodes within this group.
[out] | modes | Vector of all modes of operation in this group. |
Definition at line 176 of file DS402Group.cpp.
|
virtual |
Depending on the mode of operation, this will return the current position, velocity or torque.
[out] | feedback | Vector of target_feedback for all nodes in this group. |
Definition at line 134 of file DS402Group.cpp.
|
virtual |
Perform homing for nodes.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 162 of file DS402Group.cpp.
|
virtual |
Initializes the node. Tries to query all required data from the device.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 35 of file DS402Group.cpp.
|
virtual |
Tests whether a given mode of operation is supported by the device.
op_mode | Mode of operation that should be checked |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 207 of file DS402Group.cpp.
|
virtual |
Returns whether the device has reached it's recent target.
[out] | reached_single | Boolean vector that contains the taget-reached status for each node individually. |
Definition at line 444 of file DS402Group.cpp.
|
virtual |
When the device is in OperationEnabled mode, this function enables the drive motion.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 404 of file DS402Group.cpp.
|
virtual |
Prints a stringified version of the statusword to the logging system.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 50 of file DS402Group.cpp.
|
virtual |
This sends the controlword for performing a quick_stop.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 224 of file DS402Group.cpp.
|
virtual |
This function is used to recover from a fault state.
It clears the error register and performs state transition 15.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 302 of file DS402Group.cpp.
|
virtual |
Choose one of the predefined default mappings. Please see the enum eDefaultPDOMapping for a list of available mappings. See the implementation for further details about the mappings.
mapping | Mapping that should be set. |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 148 of file DS402Group.cpp.
|
virtual |
Sets and initializes a mode of operation. First it will check whether the device supports the requested mode. So if you request a mode that the device does not support, it just returns false and does nothing.
op_mode | Operation mode according to ds402::eModeOfOperation. |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 190 of file DS402Group.cpp.
|
virtual |
Sets the target for the motor. What that target is, depends on the selected mode of operation. The value will be clamped into the range value that is defined by the CanOpen specification.
It might be for example a position, a velocity or a torque. For transmission to the device PDOs are used. Make sure that those PDOs are configured correctly
targets | Vector of targets for all nodes value for current mode of operation |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 81 of file DS402Group.cpp.
|
virtual |
Sets the target for the motor. What that target is, depends on the selected mode of operation. The value will be clamped into the range value that is defined by the CanOpen specification.
It might be for example a position, a velocity or a torque. For transmission to the device PDOs are used. Make sure that those PDOs are configured correctly
target | Target value for current mode of operation |
node_id | Node-ID of the node this target should be applied to |
Definition at line 64 of file DS402Group.cpp.
|
virtual |
Configure the mandatory parameters for a homing mode.
config | Struct of mandatory parameters for a homing mode |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 260 of file DS402Group.cpp.
|
virtual |
Configure the mandatory parameters for a profile position mode.
config | Struct of parameters used for profile position mode |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 246 of file DS402Group.cpp.
|
virtual |
Configure the mandatory parameters for a profile torque mode.
config | Struct of mandatory parameters for a profile torque mode |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 288 of file DS402Group.cpp.
|
virtual |
Configure the mandatory parameters for a profile velocity mode.
config | Struct of mandatory parameters for a profile velocity mode |
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 274 of file DS402Group.cpp.
|
virtual |
This sets the RPDO communication for enabling the movement after a target has been set. Note, that sync and pdo-download has to be called in between setting the target and enabling movement. Afterwards call acceptPPTarget() to enable setting following targets.
node_id | If left out or given a negative value, the function will be called for all nodes in the group, otherwise it will only be used for the given node-id. |
Definition at line 106 of file DS402Group.cpp.
|
friend |
Definition at line 329 of file DS402Group.h.
|
protected |
Definition at line 326 of file DS402Group.h.