32 namespace canopen_schunk {
103 bool download(
const bool normal_transfer,
106 const std::vector<uint8_t>& usrdata);
123 template <
typename T>
130 return download(normal_transfer, index, subindex, data_vector);
148 bool upload(
const bool normal_transfer,
151 std::vector<uint8_t>& uploaded_data);
153 template <
typename T>
173 std::vector<uint8_t> buffer;
174 bool ret =
upload (
false, index, subindex, buffer);
176 if (!ret || buffer.size() == 0)
181 uploaded_data = convertFromCharVector<T>(buffer);
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_3BYTE
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_1BYTE
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_2BYTE
static unsigned char const SDO_SEG_REQ_UPLOAD1
SDO(const uint8_t &node_id, const CanDevPtr &can_device)
static unsigned char const SDO_SEG_REQ_INIT_UPLOAD
Basic CanOpen exception that contains the Object dictionary index and subindex.
boost::shared_ptr< SDO > Ptr
std::vector< uint8_t > convertToCharVector(const T value)
This little helper transforms any datatype that has a size of at most 4 Bytes into a vector of uint8_...
boost::shared_ptr< const SDO > ConstPtr
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_xBYTE
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).
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_4BYTE
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).
uint32_t m_response_wait_time_ms
static std::string lookupErrorString(const uint32_t error_code)
bool m_data_update_received
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)
boost::mutex m_data_buffer_mutex
void update(const CanMsg &msg)
update updates the SDO data with newly received messages
std::vector< uint8_t > m_data_buffer
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_2BYTE
boost::condition_variable m_data_buffer_updated_cond
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).
The SDO class represents Service Data Objects (SDO) that are used for slow access of the canOpen obje...
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 erro...
static std::map< uint32_t, std::string > m_error_map
static unsigned char const SDO_SEG_ABORT_TRANSFER
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_3BYTE
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_nBYTE
uint32_t getResponseWaitTime() const
Get the current SDO transfer response wait time.
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_4BYTE
static uint16_t const SDOTX_ID
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...
static unsigned char const SDO_SEG_RES_INIT_DOWNLOAD
static unsigned char const SDO_SEG_REQ_INIT_DOWNLOAD_xBYTE
static unsigned char const SDO_SEG_RES_INIT_UPLOAD_1BYTE
static unsigned char const SDO_SEG_REQ_UPLOAD0
static uint16_t const SDORX_ID