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

Called the function to set the serial port in the low latency mode.

parent 57cc9583
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#ifdef _HAVE_XSD #ifdef _HAVE_XSD
#include "xml/dyn_server_serial_cfg_file.hxx" #include "xml/dyn_server_serial_cfg_file.hxx"
#endif #endif
#include <iostream>
CDynamixelServerSerial *CDynamixelServerSerial::pinstance=NULL; CDynamixelServerSerial *CDynamixelServerSerial::pinstance=NULL;
...@@ -41,6 +42,7 @@ void CDynamixelServerSerial::config_bus(const std::string &device, int baudrate) ...@@ -41,6 +42,7 @@ void CDynamixelServerSerial::config_bus(const std::string &device, int baudrate)
{ {
TRS232_config serial_config; TRS232_config serial_config;
this->dynamixel_access.enter();
if(this->comm_dev!=NULL) if(this->comm_dev!=NULL)
{ {
delete this->comm_dev; delete this->comm_dev;
...@@ -54,6 +56,10 @@ void CDynamixelServerSerial::config_bus(const std::string &device, int baudrate) ...@@ -54,6 +56,10 @@ void CDynamixelServerSerial::config_bus(const std::string &device, int baudrate)
this->comm_dev=new CRS232(device); this->comm_dev=new CRS232(device);
this->comm_dev->open((void *)&device); this->comm_dev->open((void *)&device);
this->comm_dev->config(&serial_config); this->comm_dev->config(&serial_config);
try{
((CRS232 *)this->comm_dev)->set_low_latency();
}catch(CException &e){
}
this->bus_info.baud_rate=baudrate; this->bus_info.baud_rate=baudrate;
this->bus_info.device=device; this->bus_info.device=device;
}catch(CException &e){ }catch(CException &e){
...@@ -62,8 +68,10 @@ void CDynamixelServerSerial::config_bus(const std::string &device, int baudrate) ...@@ -62,8 +68,10 @@ void CDynamixelServerSerial::config_bus(const std::string &device, int baudrate)
delete this->comm_dev; delete this->comm_dev;
this->comm_dev=NULL; this->comm_dev=NULL;
} }
this->dynamixel_access.exit();
throw e; throw e;
} }
this->dynamixel_access.exit();
} }
#ifdef _HAVE_XSD #ifdef _HAVE_XSD
......
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