Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes
icl_hardware::canopen_schunk::SDO Class Reference

The SDO class represents Service Data Objects (SDO) that are used for slow access of the canOpen object dictionary. It uses the COB-ID which identifies entry with a 16bit index and 8 bit sub index and allows read and write operations. The SDO is mainly used to set up the system before the actual cyclic operation starts. This class holds the generic data, provides the up- and download functionality and parses incoming SDOs to ensure that they are correct. More...

#include <SDO.h>

List of all members.

Public Types

typedef boost::shared_ptr
< const SDO
ConstPtr
typedef boost::shared_ptr< SDOPtr

Public Member Functions

bool download (const bool normal_transfer, const uint16_t index, const uint8_t subindex, const std::vector< uint8_t > &usrdata)
 Downloads SDO data from the master to the slave (From PC to node).
template<typename T >
bool download (const bool normal_transfer, const uint16_t index, const uint8_t subindex, const T &usrdata)
 Downloads SDO data from the master to the slave (From PC to node)
uint32_t getResponseWaitTime () const
 Get the current SDO transfer response wait time.
 SDO (const uint8_t &node_id, const CanDevPtr &can_device)
void setResponseWaitTime (const uint32_t wait_time_ms)
 Set the time in milliseconds that should be waited for an SDO response when performing a transfer.
void update (const CanMsg &msg)
 update updates the SDO data with newly received messages
bool upload (const bool normal_transfer, const uint16_t index, const uint8_t subindex, std::vector< uint8_t > &uploaded_data)
 Uploads data from a slave (node) to a master (PC).
template<typename T >
bool upload (const bool normal_transfer, const uint16_t index, const uint8_t subindex, T &uploaded_data)
 Uploads data from a slave (node) to a master (PC).

Static Public Member Functions

static void addErrorMapFromFile (const std::string &filename)
 Adds an error map from an INI file to all SDOs. This should be called once to get human readable errors.

Static Public Attributes

static unsigned char const SDO_SEG_ABORT_TRANSFER = 0x80
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_1BYTE = 0x2F
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_2BYTE = 0x2B
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_3BYTE = 0x27
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_4BYTE = 0x23
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_xBYTE = 0x22
static unsigned char const SDO_SEG_REQ_INIT_UPLOAD = 0x40
static unsigned char const SDO_SEG_REQ_UPLOAD0 = 0x60
static unsigned char const SDO_SEG_REQ_UPLOAD1 = 0x70
static unsigned char const SDO_SEG_RES_INIT_DOWNLOAD = 0x60
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_1BYTE = 0x4F
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_2BYTE = 0x4B
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_3BYTE = 0x47
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_4BYTE = 0x43
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_nBYTE = 0x41
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_xBYTE = 0x42
static uint16_t const SDORX_ID = 0x600
static uint16_t const SDOTX_ID = 0x580

Static Private Member Functions

static std::string lookupErrorString (const uint32_t error_code)

Private Attributes

CanDevPtr m_can_device
std::vector< uint8_tm_data_buffer
boost::mutex m_data_buffer_mutex
boost::condition_variable m_data_buffer_updated_cond
bool m_data_update_received
uint8_t m_node_id
uint32_t m_response_wait_time_ms

Static Private Attributes

static std::map< uint32_t,
std::string > 
m_error_map

Detailed Description

The SDO class represents Service Data Objects (SDO) that are used for slow access of the canOpen object dictionary. It uses the COB-ID which identifies entry with a 16bit index and 8 bit sub index and allows read and write operations. The SDO is mainly used to set up the system before the actual cyclic operation starts. This class holds the generic data, provides the up- and download functionality and parses incoming SDOs to ensure that they are correct.

Definition at line 40 of file SDO.h.


Member Typedef Documentation

typedef boost::shared_ptr<const SDO> icl_hardware::canopen_schunk::SDO::ConstPtr

Definition at line 44 of file SDO.h.

typedef boost::shared_ptr<SDO> icl_hardware::canopen_schunk::SDO::Ptr

Definition at line 43 of file SDO.h.


Constructor & Destructor Documentation

icl_hardware::canopen_schunk::SDO::SDO ( const uint8_t node_id,
const CanDevPtr can_device 
)

Definition at line 38 of file SDO.cpp.


Member Function Documentation

void icl_hardware::canopen_schunk::SDO::addErrorMapFromFile ( const std::string &  filename) [static]

Adds an error map from an INI file to all SDOs. This should be called once to get human readable errors.

Parameters:
filenamefilename of the ini file

Definition at line 339 of file SDO.cpp.

bool icl_hardware::canopen_schunk::SDO::download ( const bool  normal_transfer,
const uint16_t  index,
const uint8_t  subindex,
const std::vector< uint8_t > &  usrdata 
)

Downloads SDO data from the master to the slave (From PC to node).

There exist expedited and normal (segmented) downloads in the DS301 standard. Currently, only expedited downloads are supported, which send data of up to 4 bytes directly with the download request.

Parameters:
normal_transferexpedited (false) or segmented (true) downloads
indexIndex to where the data should be written (in the node)
subindexSubindex to where the data should be written (in the node)
usrdataData that would be downloaded to the node.
Note:
: There also exists an interface that accepts arbitrary datatypes that have a maximum size of 4 bytes.
Exceptions:
ProtocolExceptionor any exception inherited from that on errors
Returns:
True if download succeeds, false otherwise

Definition at line 84 of file SDO.cpp.

template<typename T >
bool icl_hardware::canopen_schunk::SDO::download ( const bool  normal_transfer,
const uint16_t  index,
const uint8_t  subindex,
const T usrdata 
) [inline]

Downloads SDO data from the master to the slave (From PC to node)

This is just an overloaded interface to the vector interface. (see function definition without template). It accepts all kind of userdata types that can fit into 4 bytes of data. They will be automatically converted to a vector of bytes.

*

Parameters:
normal_transferexpedited (false) or segmented (true, not yet supported) downloads
indexIndex to where the data should be written (in the node)
subindexSubindex to where the data should be written (in the node)
usrdataData that should be downloaded to the node. This can be any basic datatype that fits into 4 bytes.
Exceptions:
ProtocolExceptionor any exception inherited from that on errors
Returns:
True if download succeeds, false otherwise

Definition at line 124 of file SDO.h.

Get the current SDO transfer response wait time.

Definition at line 204 of file SDO.h.

std::string icl_hardware::canopen_schunk::SDO::lookupErrorString ( const uint32_t  error_code) [static, private]

Definition at line 323 of file SDO.cpp.

Set the time in milliseconds that should be waited for an SDO response when performing a transfer.

Definition at line 199 of file SDO.h.

update updates the SDO data with newly received messages

Parameters:
msgcan message that was preciously identified as SDO message
Exceptions:
ProtocolExceptionon errors

Definition at line 46 of file SDO.cpp.

bool icl_hardware::canopen_schunk::SDO::upload ( const bool  normal_transfer,
const uint16_t  index,
const uint8_t  subindex,
std::vector< uint8_t > &  uploaded_data 
)

Uploads data from a slave (node) to a master (PC).

There exist expedited and normal (segmented) uploads in the DS301 standard. Currently, only expedited uploads are supported, which send data of up to 4 bytes directly with the first upload response.

Parameters:
[in]normal_transferexpedited (false) or segmented (true, not yet supported) uploads
[in]indexIndex to where the data should be read (in the node)
[in]subindexSubindex to where the data should be read (in the node)
[out]uploaded_datauploaded data will be in this vector, if upload succeeds.
Exceptions:
ProtocolExceptionor any exception inherited from that on errors
Returns:
True if upload succeeds, false otherwise.

Definition at line 209 of file SDO.cpp.

template<typename T >
bool icl_hardware::canopen_schunk::SDO::upload ( const bool  normal_transfer,
const uint16_t  index,
const uint8_t  subindex,
T uploaded_data 
) [inline]

Uploads data from a slave (node) to a master (PC).

There exist expedited and normal (segmented) uploads in the DS301 standard. Currently, only expedited uploads are supported, which send data of up to 4 bytes directly with the first upload response.

Parameters:
[in]normal_transferexpedited (false) or segmented (true, not yet supported) uploads
[in]indexIndex to where the data should be read (in the node)
[in]subindexSubindex to where the data should be read (in the node)
[out]uploaded_datauploaded data will be in here, if upload succeeds.
Exceptions:
ProtocolExceptionor any exception inherited from that on errors
Returns:
True if upload succeeds, false otherwise.

Definition at line 168 of file SDO.h.


Member Data Documentation

Definition at line 211 of file SDO.h.

Definition at line 217 of file SDO.h.

Definition at line 215 of file SDO.h.

Definition at line 216 of file SDO.h.

Definition at line 214 of file SDO.h.

Definition at line 219 of file SDO.h.

Definition at line 210 of file SDO.h.

Definition at line 212 of file SDO.h.

unsigned char const icl_hardware::canopen_schunk::SDO::SDO_SEG_ABORT_TRANSFER = 0x80 [static]

Definition at line 75 of file SDO.h.

Definition at line 59 of file SDO.h.

Definition at line 60 of file SDO.h.

Definition at line 61 of file SDO.h.

Definition at line 62 of file SDO.h.

Definition at line 58 of file SDO.h.

Definition at line 65 of file SDO.h.

unsigned char const icl_hardware::canopen_schunk::SDO::SDO_SEG_REQ_UPLOAD0 = 0x60 [static]

Definition at line 72 of file SDO.h.

unsigned char const icl_hardware::canopen_schunk::SDO::SDO_SEG_REQ_UPLOAD1 = 0x70 [static]

Definition at line 73 of file SDO.h.

Definition at line 63 of file SDO.h.

Definition at line 68 of file SDO.h.

Definition at line 69 of file SDO.h.

Definition at line 70 of file SDO.h.

Definition at line 71 of file SDO.h.

Definition at line 66 of file SDO.h.

Definition at line 67 of file SDO.h.

Definition at line 55 of file SDO.h.

Standard base CAN IDs of SDO for transmit and receive:

Transmit/receive is as seen by the SCHUNK module (as usual for CANopen). => Transmit is Module to PC => Receive is PC to Module

Definition at line 54 of file SDO.h.


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


schunk_canopen_driver
Author(s): Felix Mauch , Georg Heppner
autogenerated on Sun May 22 2016 03:30:57