The DS301Node class Is the base class representation of canOpen devices. It is the access point to the most relevant functionalities of the DS301 protocol (canOpen) More...
#include <DS301Node.h>
Classes | |
struct | PDOMapEntry |
Unique index to find a mapped Object dictionary item in a PDO. More... | |
Public Types | |
typedef boost::shared_ptr < const DS301Node > | ConstPtr |
Shared pointer to a const DS301Node. | |
enum | ePDO_TYPE { RECEIVE_PDO, TRANSMIT_PDO } |
Type of a PDO. RECEIVE_PDOs carry data from the host to the device, TRANSMIT_PDOs from the device to the host. More... | |
typedef boost::shared_ptr < DS301Node > | Ptr |
Shared pointer to a DS301Node. | |
Public Member Functions | |
virtual void | appendPDOMappingSingle (const PDO::MappingConfigurationList &config, const uint16_t pdo_nr, const PDO::eTransmissionType &transmission_type, const ePDO_TYPE &pdo_type, const bool dummy_mapping=false, const uint8_t cyclic_timeout_cycles=0) |
Appends one or more mapping parameters to the existing mapping. Note that the PDO will be disabled while appending another mapping. | |
void | downloadPDOs () |
Downloads all Receive-PDOs of this node to the device. | |
DS301Node (const uint8_t node_id, const CanDevPtr &can_device, HeartBeatMonitor::Ptr heartbeat_monitor) | |
uint8_t | getNodeId () const |
template<typename T > | |
T | getRPDOValue (const std::string &identifier) |
template<typename T > | |
T | getTPDOValue (const std::string &identifier) |
Get the value of a PDO which is mapped to a given identifier. | |
virtual void | initNode () |
Initializes the node. | |
virtual void | initPDOMappingSingle (const PDO::MappingConfigurationList &config, const uint16_t pdo_nr, const PDO::eTransmissionType &transmission_type, const ePDO_TYPE &pdo_type, const bool dummy_mapping=false, const uint8_t cyclic_timeout_cycles=0) |
Init PDO mapping with a given mapping configuration for a given pdo nr. | |
void | printPDOMapping () |
Will query the PDO mapping from the device and print that to the output. | |
void | registerPDONotifyCallback (const std::string &identifier, const boost::function< void()> &f) |
This function maps a callback to a specific mapped PDO entry. This callback will be called by the PDO upload function, whenever a PDO with the specified data will arrive. Please note, that the callback function will only be notified of new data, but the data must be queried from the PDO separately. A PDO entry can call multiple callbacks, currently callbacks can't be unregistered. | |
virtual void | registerWSBroadcaster (boost::shared_ptr< icl_comm::websocket::WsBroadcaster > broadcaster) |
registerWSBroadcaster Adds a debug interface | |
template<typename T > | |
bool | setRPDOValue (const std::string &identifier, const T value) |
Set the value of a PDO which is mapped to a given identifier. | |
template<typename T > | |
bool | setTPDOValue (const std::string &identifier, const T value) |
Set the value of a PDO which is mapped to a given identifier. | |
virtual void | startHeartbeat () |
Initializes the heartbeat for the node. Throws ProtocolException it heartbeat cannot be initialized. | |
virtual void | stopNode () |
Puts the node into nmt state preo_operational. | |
void | uploadPDOs () |
Uploads all Transmit-PDOs of this node from the device. | |
Public Attributes | |
EMCY::Ptr | m_emcy |
EMCY object to handle spontaneous callbacks with emergency messages. | |
NMT | m_nmt |
Object to handle NMT calls and status. | |
RPDO::PtrList | m_rpdos |
RPDOS of this node (up to 4 in standard config) | |
SDO | m_sdo |
SDO object for specific calls. | |
TPDO::PtrList | m_tpdos |
TPDOS of this node (up to 4 in standard config) | |
Protected Attributes | |
CanDevPtr | m_can_dev |
Device handle for transmission of messages. | |
uint16_t | m_heartbeat_cycle_time_ms |
HeartBeatMonitor::Ptr | m_heartbeat_monitor |
uint8_t | m_node_id |
CANOPEN ID of the node. | |
boost::unordered_map < std::string, PDOMapEntry > | m_rpdo_mapping |
This map holds a mapping between an identifier string and a mapped position in a RPDO. | |
boost::unordered_map < std::string, PDOMapEntry > | m_tpdo_mapping |
This map holds a mapping between an identifier string and a mapped position in a TPDO. | |
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_. |
The DS301Node class Is the base class representation of canOpen devices. It is the access point to the most relevant functionalities of the DS301 protocol (canOpen)
Each Node is a representation of a physical (or in the terms of canOpen also a logical) device. It holds information about the actual devices such as its NMT state, the last EMCY message received from it or management information such as the ID of the device. The DS301 Node implements the basic structure of canOpen nodes but is meant as a base class for derived classes implementing a specific protocol such as the DS402 motor protocol.
Definition at line 67 of file DS301Node.h.
typedef boost::shared_ptr<const DS301Node> icl_hardware::canopen_schunk::DS301Node::ConstPtr |
Shared pointer to a const DS301Node.
Reimplemented in icl_hardware::canopen_schunk::SchunkPowerBallNode, and icl_hardware::canopen_schunk::DS402Node.
Definition at line 97 of file DS301Node.h.
typedef boost::shared_ptr<DS301Node> icl_hardware::canopen_schunk::DS301Node::Ptr |
Shared pointer to a DS301Node.
Reimplemented in icl_hardware::canopen_schunk::SchunkPowerBallNode, and icl_hardware::canopen_schunk::DS402Node.
Definition at line 95 of file DS301Node.h.
Type of a PDO. RECEIVE_PDOs carry data from the host to the device, TRANSMIT_PDOs from the device to the host.
Definition at line 88 of file DS301Node.h.
icl_hardware::canopen_schunk::DS301Node::DS301Node | ( | const uint8_t | node_id, |
const CanDevPtr & | can_device, | ||
HeartBeatMonitor::Ptr | heartbeat_monitor | ||
) |
Definition at line 31 of file DS301Node.cpp.
void icl_hardware::canopen_schunk::DS301Node::appendPDOMappingSingle | ( | const PDO::MappingConfigurationList & | config, |
const uint16_t | pdo_nr, | ||
const PDO::eTransmissionType & | transmission_type, | ||
const ePDO_TYPE & | pdo_type, | ||
const bool | dummy_mapping = false , |
||
const uint8_t | cyclic_timeout_cycles = 0 |
||
) | [virtual] |
Appends one or more mapping parameters to the existing mapping. Note that the PDO will be disabled while appending another mapping.
config | List of MappingConfigurations that should be appended. |
pdo_nr | Index of the PDO this mapping should be done. |
transmission_type | Transmission type of this PDO |
pdo_type | Is it a receive PDO or a transmit PDO? |
dummy_mapping | if set to True, no download to the device will be performed, but the mapping will be done on host side. This is especially useful if a device has preconfigured PDOs which you like to use. |
cyclic_timeout_cycles | In case of transmission type SYNCHRONOUS_CYCLIC this parameter defines the PDO's frequency by defining the number of cycles between two send attempts. For example, a parameter value of 4 means, that the PDO is sent every 5th cycle. |
Definition at line 116 of file DS301Node.cpp.
Downloads all Receive-PDOs of this node to the device.
Definition at line 162 of file DS301Node.cpp.
uint8_t icl_hardware::canopen_schunk::DS301Node::getNodeId | ( | ) | const [inline] |
Definition at line 101 of file DS301Node.h.
T icl_hardware::canopen_schunk::DS301Node::getRPDOValue | ( | const std::string & | identifier | ) | [inline] |
Definition at line 165 of file DS301Node.h.
T icl_hardware::canopen_schunk::DS301Node::getTPDOValue | ( | const std::string & | identifier | ) | [inline] |
Get the value of a PDO which is mapped to a given identifier.
identifier | String identifier for the PDO |
PDOException | when no PDO is found under the given identifier. |
Definition at line 190 of file DS301Node.h.
void icl_hardware::canopen_schunk::DS301Node::initNode | ( | ) | [virtual] |
Initializes the node.
Reimplemented in icl_hardware::canopen_schunk::DS402Node, and icl_hardware::canopen_schunk::SchunkPowerBallNode.
Definition at line 47 of file DS301Node.cpp.
void icl_hardware::canopen_schunk::DS301Node::initPDOMappingSingle | ( | const PDO::MappingConfigurationList & | config, |
const uint16_t | pdo_nr, | ||
const PDO::eTransmissionType & | transmission_type, | ||
const ePDO_TYPE & | pdo_type, | ||
const bool | dummy_mapping = false , |
||
const uint8_t | cyclic_timeout_cycles = 0 |
||
) | [virtual] |
Init PDO mapping with a given mapping configuration for a given pdo nr.
config | List of MappingConfigurations that should be mapped |
pdo_nr | Index of the PDO this mapping should be done. |
transmission_type | Transmission type of this PDO |
pdo_type | Is it a receive PDO or a transmit PDO? |
dummy_mapping | if set to True, no download to the device will be performed, but the mapping will be done on host side. This is especially useful if a device has preconfigured PDOs which you like to use. |
cyclic_timeout_cycles | If the transmission type SYNCHRONOUS_CYCLIC is used, this parameter defines the PDO's frequency by defining the number of cycles between two send attempts. For example, a parameter value of 4 means, that the PDO is sent every 5th cycle. |
PDOException | when something goes wrong. |
Definition at line 66 of file DS301Node.cpp.
Will query the PDO mapping from the device and print that to the output.
Definition at line 170 of file DS301Node.cpp.
void icl_hardware::canopen_schunk::DS301Node::registerPDONotifyCallback | ( | const std::string & | identifier, |
const boost::function< void()> & | f | ||
) |
This function maps a callback to a specific mapped PDO entry. This callback will be called by the PDO upload function, whenever a PDO with the specified data will arrive. Please note, that the callback function will only be notified of new data, but the data must be queried from the PDO separately. A PDO entry can call multiple callbacks, currently callbacks can't be unregistered.
Throws a PDOException, when no PDO entry with the given identifier can be found.
identifier | string identifier of the mapped PDO entry |
f | notification callback function |
Definition at line 239 of file DS301Node.cpp.
void icl_hardware::canopen_schunk::DS301Node::registerWSBroadcaster | ( | boost::shared_ptr< icl_comm::websocket::WsBroadcaster > | broadcaster | ) | [virtual] |
registerWSBroadcaster Adds a debug interface
Definition at line 53 of file DS301Node.cpp.
bool icl_hardware::canopen_schunk::DS301Node::setRPDOValue | ( | const std::string & | identifier, |
const T | value | ||
) | [inline] |
Set the value of a PDO which is mapped to a given identifier.
identifier | String identifier for the PDO |
PDOException | when no PDO is found under the given identifier. |
Definition at line 215 of file DS301Node.h.
bool icl_hardware::canopen_schunk::DS301Node::setTPDOValue | ( | const std::string & | identifier, |
const T | value | ||
) | [inline] |
Set the value of a PDO which is mapped to a given identifier.
identifier | String identifier for the PDO |
PDOException | when no PDO is found under the given identifier. |
Definition at line 246 of file DS301Node.h.
void icl_hardware::canopen_schunk::DS301Node::startHeartbeat | ( | ) | [virtual] |
Initializes the heartbeat for the node. Throws ProtocolException it heartbeat cannot be initialized.
Definition at line 58 of file DS301Node.cpp.
void icl_hardware::canopen_schunk::DS301Node::stopNode | ( | ) | [virtual] |
Puts the node into nmt state preo_operational.
Reimplemented in icl_hardware::canopen_schunk::DS402Node.
Definition at line 260 of file DS301Node.cpp.
Uploads all Transmit-PDOs of this node from the device.
Definition at line 154 of file DS301Node.cpp.
Device handle for transmission of messages.
Definition at line 318 of file DS301Node.h.
EMCY object to handle spontaneous callbacks with emergency messages.
Definition at line 311 of file DS301Node.h.
Definition at line 328 of file DS301Node.h.
Definition at line 326 of file DS301Node.h.
Object to handle NMT calls and status.
Definition at line 303 of file DS301Node.h.
CANOPEN ID of the node.
Definition at line 315 of file DS301Node.h.
boost::unordered_map<std::string, PDOMapEntry> icl_hardware::canopen_schunk::DS301Node::m_rpdo_mapping [protected] |
This map holds a mapping between an identifier string and a mapped position in a RPDO.
Definition at line 321 of file DS301Node.h.
RPDOS of this node (up to 4 in standard config)
Definition at line 307 of file DS301Node.h.
SDO object for specific calls.
Definition at line 305 of file DS301Node.h.
boost::unordered_map<std::string, PDOMapEntry> icl_hardware::canopen_schunk::DS301Node::m_tpdo_mapping [protected] |
This map holds a mapping between an identifier string and a mapped position in a TPDO.
Definition at line 324 of file DS301Node.h.
TPDOS of this node (up to 4 in standard config)
Definition at line 309 of file DS301Node.h.
boost::shared_ptr<icl_comm::websocket::WsBroadcaster> icl_hardware::canopen_schunk::DS301Node::m_ws_broadcaster [protected] |
Interface to send out diagnostics data. Only available if compiled with _IC_BUILDER_ICL_COMM_WEBSOCKET_.
Definition at line 331 of file DS301Node.h.