Go to the documentation of this file.
35 #ifndef KHI_ROBOT_DRIVER_H
36 #define KHI_ROBOT_DRIVER_H
39 #include <khi_robot_msgs/KhiRobotCmd.h>
43 #define KHI_MAX_CONTROLLER 8
45 #define KHI_MAX_JOINT 18
46 #define KHI_MAX_SIG_SIZE 512
48 struct KhiRobotArmData
67 struct KhiRobotControllerInfo
147 std::string name =
"";
158 bool setState(
const int& cont_no,
const int& state )
201 return state_trigger;
238 void infoPrint(
const char* format, ... )
240 char msg[512] = { 0 };
243 va_start( ap, format );
244 vsnprintf(
msg,
sizeof(
msg), format, ap );
249 void warnPrint(
const char* format, ... )
251 char msg[512] = { 0 };
254 va_start( ap, format );
255 vsnprintf( msg,
sizeof(msg), format, ap );
262 char msg[512] = { 0 };
265 va_start( ap, format );
266 vsnprintf( msg,
sizeof(msg), format, ap );
273 char msg[512] = { 0 };
274 char jt_val[16] = { 0 };
277 snprintf(
msg,
sizeof(
msg),
"[%s]\t", name.c_str() );
280 if ( name == std::string(
"write") ) { value =
data.arm[ano].cmd; }
281 else { value =
data.arm[ano].pos; }
282 for (
int jt = 0; jt <
data.arm[ano].jt_num; jt++ )
284 snprintf( jt_val,
sizeof(jt_val),
"%.3lf\t", value[jt] );
285 strcat( msg, jt_val );
293 virtual bool open(
const int& cont_no,
const std::string& ip_address,
KhiRobotData& data ) = 0;
294 virtual bool close(
const int& cont_no ) = 0;
301 virtual bool getPeriodDiff(
const int& cont_no,
double& diff ) = 0;
302 virtual bool commandHandler( khi_robot_msgs::KhiRobotCmd::Request& req, khi_robot_msgs::KhiRobotCmd::Response& res ) = 0;
314 #endif // KHI_ROBOT_DRIVER_H
virtual bool open(const int &cont_no, const std::string &ip_address, KhiRobotData &data)=0
virtual bool initialize(const int &cont_no, const double &period, KhiRobotData &data, const bool in_simulation=false)=0
double cmd[KHI_MAX_JOINT]
virtual bool activate(const int &cont_no, KhiRobotData &data)=0
virtual bool close(const int &cont_no)=0
bool contLimitCheck(const int &cont_no, const int &limit)
const static std::string KhiRobotStateTriggerName[TRIGGER_MAX]
bool isTransitionState(const int &cont_no)
virtual bool hold(const int &cont_no, const KhiRobotData &data)=0
void jointPrint(std::string name, const KhiRobotData &data)
bool setState(const int &cont_no, const int &state)
virtual bool commandHandler(khi_robot_msgs::KhiRobotCmd::Request &req, khi_robot_msgs::KhiRobotCmd::Response &res)=0
virtual bool writeData(const int &cont_no, const KhiRobotData &data)=0
virtual ~KhiRobotDriver()
virtual bool deactivate(const int &cont_no, const KhiRobotData &data)=0
void warnPrint(const char *format,...)
double home[KHI_MAX_JOINT]
double pos[KHI_MAX_JOINT]
virtual bool getPeriodDiff(const int &cont_no, double &diff)=0
KhiRobotArmData arm[KHI_MAX_ARM]
int getStateTrigger(const int &cont_no)
std::string getStateName(const int &cont_no)
void infoPrint(const char *format,...)
double eff[KHI_MAX_JOINT]
KhiRobotControllerInfo cont_info[KHI_MAX_CONTROLLER]
bool setStateTrigger(const int &cont_no, const int &state_trigger)
void errorPrint(const char *format,...)
const static std::string KhiRobotStateName[STATE_MAX]
#define KHI_MAX_CONTROLLER
std::string name[KHI_MAX_JOINT]
virtual bool readData(const int &cont_no, KhiRobotData &data)=0
double vel[KHI_MAX_JOINT]
int getState(const int &cont_no)
virtual bool updateState(const int &cont_no, const KhiRobotData &data)=0