Minor refactor

This commit is contained in:
Jacob Perron 2016-04-15 14:33:59 -07:00
parent 82b01e4057
commit 44a6f809e8
3 changed files with 11 additions and 7 deletions

View file

@ -454,11 +454,11 @@ namespace create {
/* Get the estimated position of Create based on wheel encoders. /* Get the estimated position of Create based on wheel encoders.
*/ */
const create::Pose& getPose() const; create::Pose getPose() const;
/* Get the estimated velocity of Create based on wheel encoders. /* Get the estimated velocity of Create based on wheel encoders.
*/ */
const create::Vel& getVel() const; create::Vel getVel() const;
/* Get the number of corrupt serial packets since first connecting to Create. /* Get the number of corrupt serial packets since first connecting to Create.
*/ */

View file

@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef CREATE_TYPES_H #ifndef CREATE_TYPES_H
#define CREATE_TYPES_H #define CREATE_TYPES_H
#include <vector>
namespace create { namespace create {
enum RobotModel { enum RobotModel {
CREATE_1 = 0, // Roomba 400 series CREATE_1 = 0, // Roomba 400 series
@ -226,7 +228,7 @@ namespace create {
float x; float x;
float y; float y;
float yaw; float yaw;
float covariance[9]; std::vector<float> covariance;
}; };
typedef Pose Vel; typedef Pose Vel;

View file

@ -32,10 +32,12 @@ namespace create {
pose.x = 0; pose.x = 0;
pose.y = 0; pose.y = 0;
pose.yaw = 0; pose.yaw = 0;
pose.covariance = std::vector<float>(9, 0.0);
vel.x = 0; vel.x = 0;
vel.y = 0; vel.y = 0;
vel.yaw = 0; vel.yaw = 0;
poseCovar = Matrix(3, 3); vel.covariance = std::vector<float>(9, 0.0);
poseCovar = Matrix(3, 3, 0.0);
data = boost::shared_ptr<Data>(new Data(model)); data = boost::shared_ptr<Data>(new Data(model));
serial = boost::make_shared<Serial>(data); serial = boost::make_shared<Serial>(data);
} }
@ -871,11 +873,11 @@ namespace create {
} }
} }
const Pose& Create::getPose() const { Pose Create::getPose() const {
return pose; return pose;
} }
const Vel& Create::getVel() const { Vel Create::getVel() const {
return vel; return vel;
} }