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

Removed the walk status attribute.

Solved a bug in the codification of some of the walk parameters.
parent b0608740
No related branches found
No related tags found
No related merge requests found
......@@ -80,8 +80,6 @@ CDarwinRobot::CDarwinRobot(const std::string &name,std::string &bus_id,int bus_s
this->robot_device->read_byte_register(DARWIN_MM_NUM_SERVOS,&this->manager_num_servos);
/* get the current action status */
this->robot_device->read_byte_register(DARWIN_ACTION_CNTRL,&this->action_status);
/* get the current walking status */
this->robot_device->read_byte_register(DARWIN_WALK_CNTRL,&this->walk_status);
/* get the current joints status */
for(i=0;i<JOINTS_NUM_GROUPS;i++)
this->robot_device->read_byte_register(DARWIN_JOINT_GRP0_CNTRL+i*5,&this->joints_status[i]);
......@@ -956,7 +954,7 @@ double CDarwinRobot::walk_get_x_offset(void)
if(this->robot_device!=NULL)
{
this->robot_device->read_byte_register(DARWIN_WALK_X_OFFSET,&offset);
return ((double)offset)/1000.0;
return ((double)((signed char)offset))/1000.0;
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
......@@ -982,7 +980,7 @@ double CDarwinRobot::walk_get_y_offset(void)
if(this->robot_device!=NULL)
{
this->robot_device->read_byte_register(DARWIN_WALK_Y_OFFSET,&offset);
return ((double)offset)/1000.0;
return ((double)((signed char)offset))/1000.0;
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
......@@ -1008,7 +1006,7 @@ double CDarwinRobot::walk_get_z_offset(void)
if(this->robot_device!=NULL)
{
this->robot_device->read_byte_register(DARWIN_WALK_Z_OFFSET,&offset);
return ((double)offset)/1000.0;
return ((double)((signed char)offset))/1000.0;
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
......@@ -1098,7 +1096,7 @@ void CDarwinRobot::walk_set_hip_pitch_offset(double offset_rad)
if(this->robot_device!=NULL)
{
offset=(unsigned short int)((offset_rad*180.0/PI)*8.0);
offset=(unsigned short int)((offset_rad*180.0/PI)*1024.0);
this->robot_device->write_word_register(DARWIN_WALK_HIP_PITCH_OFF_L,offset);
}
else
......@@ -1112,7 +1110,7 @@ double CDarwinRobot::walk_get_hip_pitch_offset(void)
if(this->robot_device!=NULL)
{
this->robot_device->read_word_register(DARWIN_WALK_HIP_PITCH_OFF_L,&offset);
return (((double)offset)*PI/180.0)/8.0;
return (((double)offset)*PI/180.0)/1024.0;
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
......@@ -1124,7 +1122,8 @@ void CDarwinRobot::walk_set_period(double period_s)
if(this->robot_device!=NULL)
{
period=(unsigned char)(period_s*1000.0);
period=(unsigned short int)(period_s*1000.0);
std::cout << period_s << "," << period << std::endl;
this->robot_device->write_word_register(DARWIN_WALK_PERIOD_TIME_L,period);
}
else
......@@ -1320,7 +1319,7 @@ double CDarwinRobot::walk_get_arm_swing_gain(void)
if(this->robot_device!=NULL)
{
this->robot_device->read_byte_register(DARWIN_WALK_ARM_SWING_GAIN,&gain_int);
return ((double)gain_int)*32.0;
return ((double)gain_int)/32.0;
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
......@@ -1381,10 +1380,7 @@ double CDarwinRobot::walk_get_rot_speed(void)
void CDarwinRobot::walk_start(void)
{
if(this->robot_device!=NULL)
{
this->walk_status|=WALK_START;
this->robot_device->write_byte_register(DARWIN_WALK_CNTRL,this->walk_status);
}
this->robot_device->write_byte_register(DARWIN_WALK_CNTRL,WALK_START);
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
}
......@@ -1392,10 +1388,7 @@ void CDarwinRobot::walk_start(void)
void CDarwinRobot::walk_stop(void)
{
if(this->robot_device!=NULL)
{
this->walk_status|=WALK_STOP;
this->robot_device->write_byte_register(DARWIN_WALK_CNTRL,this->walk_status);
}
this->robot_device->write_byte_register(DARWIN_WALK_CNTRL,WALK_STOP);
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
}
......
......@@ -52,8 +52,6 @@ class CDarwinRobot
unsigned char manager_status;
/* action status */
unsigned char action_status;
/* walk status */
unsigned char walk_status;
/* joint group status */
unsigned char joints_status[JOINTS_NUM_GROUPS];
/* head tracking status */
......@@ -137,7 +135,7 @@ class CDarwinRobot
double walk_get_yaw_offset(void);
void walk_set_hip_pitch_offset(double offset_rad);
double walk_get_hip_pitch_offset(void);
void walk_set_period(double period_ms);
void walk_set_period(double period_s);
double walk_get_period(void);
void walk_set_ssp_dsp_ratio(double ratio);
double walk_get_ssp_dsp_ratio(void);
......
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