00001 #include "kinton_arm.h" 00002 00003 using namespace std; 00004 00005 KintonArmDriver::KintonArmDriver(void) 00006 { 00007 //setDriverId(driver string id); 00008 } 00009 00010 bool KintonArmDriver::openDriver(void) 00011 { 00012 //setDriverId(driver string id); 00013 // Set Arduino port known with >> dmesg// 00014 const char *portname = "/dev/ttyUSB0"; 00015 int baudrate = B9600; // default 00016 this->kinton_arm_driver_.open_driver(portname, baudrate); 00017 return true; 00018 } 00019 00020 bool KintonArmDriver::closeDriver(void) 00021 { 00022 00023 return true; 00024 } 00025 00026 bool KintonArmDriver::startDriver(void) 00027 { 00028 00029 return true; 00030 } 00031 00032 bool KintonArmDriver::stopDriver(void) 00033 { 00034 return true; 00035 } 00036 00037 void KintonArmDriver::set_init_position() 00038 { 00039 this->kinton_arm_driver_.set_init_position(); 00040 } 00041 00042 00043 void KintonArmDriver::set_new_positions(const vector<int>& new_pos) 00044 { 00045 this->kinton_arm_driver_.set_new_positions(new_pos); 00046 } 00047 00048 00049 00050 void KintonArmDriver::config_update(Config& new_cfg, uint32_t level) 00051 { 00052 this->lock(); 00053 00054 // depending on current state 00055 // update driver with new_cfg data 00056 switch(this->getState()) 00057 { 00058 case KintonArmDriver::CLOSED: 00059 break; 00060 00061 case KintonArmDriver::OPENED: 00062 break; 00063 00064 case KintonArmDriver::RUNNING: 00065 break; 00066 } 00067 00068 this->config_=new_cfg; 00069 00070 this->unlock(); 00071 } 00072 00073 KintonArmDriver::~KintonArmDriver(void) 00074 { 00075 00076 }