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

Disabled the servos when changing the control mode to avoid erratic motions.

parent 0a05031c
No related branches found
No related tags found
No related merge requests found
......@@ -329,15 +329,16 @@ void CDynamixelMotor::set_control_mode(control_mode mode)
else
{
try{
if(this->info.model=="XL_320")
if(this->mode!=mode)
{
this->dynamixel_dev->write_byte_register(this->registers[dyn_control_mode],(unsigned char)mode);
usleep(10000);
this->mode=mode;
}
else
{
if(this->mode!=mode)
this->disable();
if(this->info.model=="XL_320")
{
this->dynamixel_dev->write_byte_register(this->registers[dyn_control_mode],(unsigned char)mode);
usleep(10000);
this->mode=mode;
}
else
{
if(mode==angle_ctrl)
{
......
......@@ -840,6 +840,7 @@ void CDynamixelMotorGroup::set_control_mode(control_mode mode)
if(this->mode!=mode)
{
this->disable();
for(i=0;i<this->servo_id.size();i++)
{
try{
......
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