Classes | Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
icl_hardware::canopen_schunk::DS301Node Class Reference

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>

Inheritance diagram for icl_hardware::canopen_schunk::DS301Node:
Inheritance graph
[legend]

Classes

struct  PDOMapEntry
 Unique index to find a mapped Object dictionary item in a PDO. More...
 

Public Types

typedef boost::shared_ptr< const DS301NodeConstPtr
 Shared pointer to a const DS301Node. More...
 
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< DS301NodePtr
 Shared pointer to a DS301Node. More...
 

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. More...
 
void downloadPDOs ()
 Downloads all Receive-PDOs of this node to the device. More...
 
 DS301Node (const uint8_t node_id, const CanDevPtr &can_device, HeartBeatMonitor::Ptr heartbeat_monitor)
 
uint8_t getNodeId () const
 
template<typename T >
getRPDOValue (const std::string &identifier)
 
template<typename T >
getTPDOValue (const std::string &identifier)
 Get the value of a PDO which is mapped to a given identifier. More...
 
virtual void initNode ()
 Initializes the node. More...
 
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. More...
 
void printPDOMapping ()
 Will query the PDO mapping from the device and print that to the output. More...
 
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. More...
 
virtual void registerWSBroadcaster (boost::shared_ptr< icl_comm::websocket::WsBroadcaster > broadcaster)
 registerWSBroadcaster Adds a debug interface More...
 
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. More...
 
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. More...
 
virtual void startHeartbeat ()
 Initializes the heartbeat for the node. Throws ProtocolException it heartbeat cannot be initialized. More...
 
virtual void stopNode ()
 Puts the node into nmt state preo_operational. More...
 
void uploadPDOs ()
 Uploads all Transmit-PDOs of this node from the device. More...
 

Public Attributes

EMCY::Ptr m_emcy
 EMCY object to handle spontaneous callbacks with emergency messages. More...
 
NMT m_nmt
 Object to handle NMT calls and status. More...
 
RPDO::PtrList m_rpdos
 RPDOS of this node (up to 4 in standard config) More...
 
SDO m_sdo
 SDO object for specific calls. More...
 
TPDO::PtrList m_tpdos
 TPDOS of this node (up to 4 in standard config) More...
 

Protected Attributes

CanDevPtr m_can_dev
 Device handle for transmission of messages. More...
 
uint16_t m_heartbeat_cycle_time_ms
 
HeartBeatMonitor::Ptr m_heartbeat_monitor
 
uint8_t m_node_id
 CANOPEN ID of the node. More...
 
boost::unordered_map< std::string, PDOMapEntrym_rpdo_mapping
 This map holds a mapping between an identifier string and a mapped position in a RPDO. More...
 
boost::unordered_map< std::string, PDOMapEntrym_tpdo_mapping
 This map holds a mapping between an identifier string and a mapped position in a TPDO. More...
 
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...
 

Detailed Description

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.

Member Typedef Documentation

Shared pointer to a const DS301Node.

Definition at line 97 of file DS301Node.h.

Shared pointer to a DS301Node.

Definition at line 95 of file DS301Node.h.

Member Enumeration Documentation

Type of a PDO. RECEIVE_PDOs carry data from the host to the device, TRANSMIT_PDOs from the device to the host.

Enumerator
RECEIVE_PDO 
TRANSMIT_PDO 

Definition at line 88 of file DS301Node.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Parameters
configList of MappingConfigurations that should be appended.
pdo_nrIndex of the PDO this mapping should be done.
transmission_typeTransmission type of this PDO
pdo_typeIs it a receive PDO or a transmit PDO?
dummy_mappingif 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_cyclesIn 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.

void icl_hardware::canopen_schunk::DS301Node::downloadPDOs ( )

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.

template<typename T >
T icl_hardware::canopen_schunk::DS301Node::getRPDOValue ( const std::string &  identifier)
inline

Definition at line 165 of file DS301Node.h.

template<typename T >
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.

Parameters
identifierString identifier for the PDO
Exceptions
PDOExceptionwhen no PDO is found under the given identifier.
Returns
value of the PDO entry

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.

Parameters
configList of MappingConfigurations that should be mapped
pdo_nrIndex of the PDO this mapping should be done.
transmission_typeTransmission type of this PDO
pdo_typeIs it a receive PDO or a transmit PDO?
dummy_mappingif 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_cyclesIf 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.
Exceptions
PDOExceptionwhen something goes wrong.

Definition at line 66 of file DS301Node.cpp.

void icl_hardware::canopen_schunk::DS301Node::printPDOMapping ( )

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.

Parameters
identifierstring identifier of the mapped PDO entry
fnotification 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.

template<typename T >
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.

Parameters
identifierString identifier for the PDO
Exceptions
PDOExceptionwhen no PDO is found under the given identifier.
Returns
True on success.

Definition at line 215 of file DS301Node.h.

template<typename T >
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.

Note
The value set here will be overwritten by the next PDO
Parameters
identifierString identifier for the PDO
Exceptions
PDOExceptionwhen no PDO is found under the given identifier.
Returns
True on success.

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.

void icl_hardware::canopen_schunk::DS301Node::uploadPDOs ( )

Uploads all Transmit-PDOs of this node from the device.

Definition at line 154 of file DS301Node.cpp.

Member Data Documentation

CanDevPtr icl_hardware::canopen_schunk::DS301Node::m_can_dev
protected

Device handle for transmission of messages.

Definition at line 318 of file DS301Node.h.

EMCY::Ptr icl_hardware::canopen_schunk::DS301Node::m_emcy

EMCY object to handle spontaneous callbacks with emergency messages.

Definition at line 311 of file DS301Node.h.

uint16_t icl_hardware::canopen_schunk::DS301Node::m_heartbeat_cycle_time_ms
protected

Definition at line 328 of file DS301Node.h.

HeartBeatMonitor::Ptr icl_hardware::canopen_schunk::DS301Node::m_heartbeat_monitor
protected

Definition at line 326 of file DS301Node.h.

NMT icl_hardware::canopen_schunk::DS301Node::m_nmt

Object to handle NMT calls and status.

Definition at line 303 of file DS301Node.h.

uint8_t icl_hardware::canopen_schunk::DS301Node::m_node_id
protected

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.

RPDO::PtrList icl_hardware::canopen_schunk::DS301Node::m_rpdos

RPDOS of this node (up to 4 in standard config)

Definition at line 307 of file DS301Node.h.

SDO icl_hardware::canopen_schunk::DS301Node::m_sdo

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.

TPDO::PtrList icl_hardware::canopen_schunk::DS301Node::m_tpdos

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.


The documentation for this class was generated from the following files:


schunk_canopen_driver
Author(s): Felix Mauch , Georg Heppner
autogenerated on Mon Jun 10 2019 15:07:49