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

Solved some minor bugs.

parent fa49aeaa
No related branches found
No related tags found
No related merge requests found
......@@ -960,13 +960,26 @@ double CDarwinRobot::walk_get_y_offset(void)
throw CDarwinRobotException(_HERE_,"Invalid robot device");
}
void CDarwinRobot::walk_set_z_offset(double offset_m)
{
unsigned char offset;
if(this->robot_device!=NULL)
{
offset=(unsigned char)(offset_m*1000.0);
this->robot_device->write_byte_register(DARWIN_WALK_Z_OFFSET,offset);
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
}
double CDarwinRobot::walk_get_z_offset(void)
{
unsigned char offset;
if(this->robot_device!=NULL)
{
this->robot_device->read_byte_register(DARWIN_WALK_Y_OFFSET,&offset);
this->robot_device->read_byte_register(DARWIN_WALK_Z_OFFSET,&offset);
return ((double)offset)/1000.0;
}
else
......@@ -1051,19 +1064,32 @@ double CDarwinRobot::walk_get_yaw_offset(void)
throw CDarwinRobotException(_HERE_,"Invalid robot device");
}
void CDarwinRobot::walk_set_hip_picth_offset(double offset_rad)
void CDarwinRobot::walk_set_hip_pitch_offset(double offset_rad)
{
unsigned short int offset;
if(this->robot_device!=NULL)
{
offset=(unsigned char)((offset_rad*180.0/PI)*1024.0);
offset=(unsigned short int)((offset_rad*180.0/PI)*8.0);
this->robot_device->write_word_register(DARWIN_WALK_HIP_PITCH_OFF_L,offset);
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
}
double CDarwinRobot::walk_get_hip_pitch_offset(void)
{
unsigned short int offset;
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;
}
else
throw CDarwinRobotException(_HERE_,"Invalid robot device");
}
void CDarwinRobot::walk_set_period(double period_s)
{
unsigned short int period;
......
......@@ -126,7 +126,7 @@ class CDarwinRobot
double walk_get_pitch_offset(void);
void walk_set_yaw_offset(double offset_rad);
double walk_get_yaw_offset(void);
void walk_set_hip_picth_offset(double offset_rad);
void walk_set_hip_pitch_offset(double offset_rad);
double walk_get_hip_pitch_offset(void);
void walk_set_period(double period_ms);
double walk_get_period(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