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