Skip to content
Snippets Groups Projects
Commit cbe4ddbc authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Modified the read and write functions to handle desynchronization events.

Added a new exception to be able to detect desynchronization events.
parent 9704dfe2
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -10,6 +10,8 @@
#include <string>
#include <vector>
const int NUM_RETRIES=10;
/**
* \brief
*
......
......@@ -5,6 +5,7 @@
const std::string dynamixel_error_message="Dynamixel error - ";
const std::string dynamixel_server_error_message="Dynamixel server error - ";
const std::string dynamixel_sync_error="Dynamixel synchronization event";
CDynamixelException::CDynamixelException(const std::string& where,const std::string &error_msg,int dev_id):CException(where,dynamixel_error_message)
{
......@@ -33,6 +34,11 @@ unsigned char CDynamixelAlarmException::get_alarm(void)
return this->alarm;
}
CDynamixelSyncException::CDynamixelSyncException(const std::string &error_msg):CException("",dynamixel_sync_error)
{
this->error_msg+=error_msg;
}
CDynamixelServerException::CDynamixelServerException(const std::string& where,const std::string &error_msg):CException(where,dynamixel_server_error_message)
{
this->error_msg+=error_msg;
......
......@@ -86,6 +86,32 @@ class CDynamixelAlarmException : public CException
unsigned char get_alarm(void);
};
/**
* \brief Dynamixel Synchronization exception
*
* This class is used to report synchronization errors in the communication with the
* dynamixel devices. This exception is thrown when there is some data loss in a
* read or write operation, and it is impossible to reset the communication after
* a given number of retries.
*
*/
class CDynamixelSyncException : public CException
{
public:
/**
* \brief Class constructor
*
* This constructor generates only a standard error message which is
* "Dynamixel Synchronization error - ". The base
* class constructor is called, so the same prefix is appended at the
* beginning to label the message as an exception.
*
* \param error_msg a null terminated string with the details of the error.
*/
CDynamixelSyncException(const std::string &error_msg);
};
/**
* \brief Dynamixel server exception
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment