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

Minor changes in the get_device() function to avoid multiple instances of a...

Minor changes in the get_device() function to avoid multiple instances of a single dynamixel device.
parent 2ff389b9
No related branches found
No related tags found
No related merge requests found
...@@ -269,7 +269,15 @@ CDynamixel *CDynamixelServer::get_device(int dev_id) ...@@ -269,7 +269,15 @@ CDynamixel *CDynamixelServer::get_device(int dev_id)
{ {
for(i=0;i<this->devices.size();i++) for(i=0;i<this->devices.size();i++)
if(this->devices[i]->get_id()==dev_id) if(this->devices[i]->get_id()==dev_id)
dynamixel=this->devices[i]; {
if(this->state==dyn_scan_done)
dynamixel=this->devices[i];
else
{
/* handle exceptions */
throw CDynamixelServerException(_HERE_,"Device has already been assigned.");
}
}
} }
this->dynamixel_access.exit(); this->dynamixel_access.exit();
if(dynamixel==NULL) if(dynamixel==NULL)
......
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