Skip to content
Snippets Groups Projects
Commit 8e10ed89 authored by Joan Perez Ibarz's avatar Joan Perez Ibarz
Browse files

changing from servo_frames to uptime for easier comprehension

parent e58b5937
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ void CSegwayRMP200::init_attributes(void)
this->roll_angle=0.0;
this->roll_rate=0.0;
this->yaw_rate=0.0;
this->servo_frames=0.0;
this->uptime=0.0;
this->left_wheel_displ=0.0;
this->right_wheel_displ=0.0;
this->forward_displ=0.0;
......@@ -278,7 +278,7 @@ void CSegwayRMP200::parse_packet(segway_packet *packet)
case 0x0402: this->left_wheel_velocity=((float)((short int)(((int)packet->data[9]<<8)+(int)packet->data[10])))*COUNTS_2_METSEC;
this->right_wheel_velocity=((float)((short int)(((int)packet->data[11]<<8)+(int)packet->data[12])))*COUNTS_2_METSEC;
this->yaw_rate=((float)((short int)(((int)packet->data[13]<<8)+(int)packet->data[14])))*COUNTSDEG_2_RADSEC;
this->servo_frames=((float)((unsigned short int)(((int)packet->data[15]<<8)+(int)packet->data[16])))*SECFRAMES_2_FRAMESEC;
this->uptime=((float)((unsigned short int)(((int)packet->data[15]<<8)+(int)packet->data[16])))*FRAMES_2_SEC;
break;
case 0x0403: this->left_wheel_displ=((float)((int)(((int)packet->data[11]<<24)+((int)packet->data[12]<<16)+((int)packet->data[9]<<8)+(int)packet->data[10])))*COUNTSMETR_2_METR;
this->right_wheel_displ=((float)((int)(((int)packet->data[15]<<24)+((int)packet->data[16]<<16)+((int)packet->data[13]<<8)+(int)packet->data[14])))*COUNTSMETR_2_METR;
......@@ -668,7 +668,7 @@ TSegwayRMP200Status CSegwayRMP200::get_status(void)
status.right_wheel_displ = this->right_wheel_displ;
status.forward_displ = this->forward_displ;
status.yaw_displ = this->yaw_displ;
status.servo_frames = this->servo_frames;
status.uptime = this->uptime;
status.left_torque = this->left_torque;
status.right_torque = this->right_torque;
status.ui_battery = this->ui_battery;
......@@ -716,9 +716,9 @@ float CSegwayRMP200::get_yaw_rate(void)
return this->yaw_rate;
}
float CSegwayRMP200::get_servo_frames(void)
float CSegwayRMP200::get_uptime(void)
{
return this->servo_frames;
return this->uptime;
}
float CSegwayRMP200::get_left_wheel_displacement(void)
......@@ -947,7 +947,7 @@ std::ostream& operator<< (std::ostream& out, CSegwayRMP200& segway)
out << "Left wheel velocity: " << segway.left_wheel_velocity << " m/s" << std::endl;
out << "Right wheel velocity: " << segway.right_wheel_velocity << " m/s" << std::endl;
out << "Yaw rate: " << segway.yaw_rate*CSegwayRMP200::RADS_2_DEGS << " degrees/s" << std::endl;
out << "Servo frames: " << segway.servo_frames << " frames/s" << std::endl;
out << "Up time: " << segway.uptime << " s" << std::endl;
out << "Left wheel displacement: " << segway.left_wheel_displ << " m" << std::endl;
out << "Right wheel displacement: " << segway.right_wheel_displ << " m" << std::endl;
out << "Forward displacement: " << segway.forward_displ << " m" << std::endl;
......
......@@ -85,7 +85,7 @@ struct TSegwayRMP200Status
float forward_displ;
float yaw_displ;
// Other configurations
float servo_frames;
float uptime;
float left_torque;
float right_torque;
float ui_battery;
......@@ -187,7 +187,7 @@ class CSegwayRMP200
static const float COUNTSDEG_2_RAD = M_PI/(7.8f*180.f);
static const float COUNTSDEG_2_RADSEC = M_PI/(7.8f*180.f);
static const float COUNTS_2_METSEC = 1.f/332.f;
static const float SECFRAMES_2_FRAMESEC = 1.f/0.01f;
static const float FRAMES_2_SEC = 0.01f;
static const float COUNTSMETR_2_METR = 1.f/33215.f;
static const float COUNTSREV_2_RADS = 2.f*M_PI/112644.f;
static const float COUNTSNEWTMETR_2_NEWTMETR = 1.f/1094.f;
......@@ -507,12 +507,12 @@ class CSegwayRMP200
/**
* \brief number of frames per second
*
* This value has the number of servo frames in fames per second. This value is
* periodically updated by the read thread and it is not possible to modify it
* otherwise. To get its value use the get_servo_frames() function or the
* overloaded operator <<.
* This value has the number of second since the platform power up. This
* value is periodically updated by the read thread and it is not possible
* to modify it otherwise. To get its value use the get_uptime()
* function or the overloaded operator <<.
*/
float servo_frames;
float uptime;
/**
* \brief left wheel displacement
*
......@@ -1218,16 +1218,16 @@ class CSegwayRMP200
*/
float get_yaw_rate(void);
/**
* \brief function to return the number of servo frames per second
* \brief function to return the number of seconds since power up
*
* This function returns the current number of servo frames per second. This
* function only returns the value of the internal attribute, but it does
* not access the hardware platform. This value is periodically updated by
* the feedback thread.
* This function returns the current number of seconds the platform has been
* running. This function only returns the value of the internal attribute,
* but it does not access the hardware platform. This value is periodically
* updated by the feedback thread.
*
* \return the current number of servo frames per second.
* \return the current number of seconds since power up.
*/
float get_servo_frames(void);
float get_uptime(void);
/**
* \brief function to return the left wheel displacement
*
......@@ -1452,7 +1452,7 @@ class CSegwayRMP200
* Left wheel velocity: <left_wheel_velocity> m/s
* Right wheel velocity: <right_wheel_velocity> m/s
* Yaw rate: <yaw_rate> radians/s
* Servo frames: <servo_frames> frames/s
* Up time: <uptime> s
* Left wheel displacement: <left_wheel_displ> m
* Right wheel displacement: <right_wheel_displ> m
* Forward displacement: <forward_displ> m
......
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