types.cpp
Go to the documentation of this file.
1 #include "create/types.h"
2 
3 namespace create {
4 
5  RobotModel::RobotModel(const ProtocolVersion version, const float axleLength, const unsigned int baud, const float maxVelocity, const float wheelDiameter):
6  id(nextId),
7  version(version),
8  axleLength(axleLength),
9  baud(baud),
10  maxVelocity(maxVelocity),
11  wheelDiameter(wheelDiameter) {
12  nextId <<= 1;
13  }
14 
15  bool RobotModel::operator ==(RobotModel& other) const {
16  return id == other.id;
17  }
18 
19  RobotModel::operator uint32_t() const {
20  return id;
21  }
22 
23  uint32_t RobotModel::getId() const {
24  return id;
25  }
26 
28  return version;
29  }
30 
31  float RobotModel::getAxleLength() const {
32  return axleLength;
33  }
34 
35  unsigned int RobotModel::getBaud() const {
36  return baud;
37  }
38 
40  return maxVelocity;
41  }
42 
44  return wheelDiameter;
45  }
46 
47  uint32_t RobotModel::nextId = 1;
48 
49  RobotModel RobotModel::ROOMBA_400(V_1, 0.258, 57600);
50  RobotModel RobotModel::CREATE_1(V_2, 0.258, 57600);
51  RobotModel RobotModel::CREATE_2(V_3, 0.235, 115200, 0.5, 0.072);
52 }
ProtocolVersion version
Definition: types.h:77
static uint32_t nextId
Definition: types.h:84
unsigned int getBaud() const
Definition: types.cpp:35
static RobotModel CREATE_1
Compatible with Create 1 or Roomba 500 series.
Definition: types.h:68
unsigned int baud
Definition: types.h:79
Definition: create.h:48
ProtocolVersion getVersion() const
Definition: types.cpp:27
float getMaxVelocity() const
Definition: types.cpp:39
ProtocolVersion
Definition: types.h:41
float getWheelDiameter() const
Definition: types.cpp:43
RobotModel(const ProtocolVersion version, const float axleLength, const unsigned int baud, const float maxVelocity=0.5, const float wheelDiameter=0.078)
Definition: types.cpp:5
uint32_t id
Definition: types.h:76
float wheelDiameter
Definition: types.h:81
bool operator==(RobotModel &other) const
Definition: types.cpp:15
uint32_t getId() const
Definition: types.cpp:23
static RobotModel CREATE_2
Compatible with Create 2 or Roomba 600 series and greater.
Definition: types.h:73
float axleLength
Definition: types.h:78
float maxVelocity
Definition: types.h:80
static RobotModel ROOMBA_400
Compatible with Roomba 400 series and earlier.
Definition: types.h:63
float getAxleLength() const
Definition: types.cpp:31


libcreate
Author(s): Jacob Perron
autogenerated on Sat May 8 2021 03:02:37