35 #include <boost/numeric/ublas/matrix.hpp> 51 typedef boost::numeric::ublas::matrix<float>
Matrix;
95 void init(
bool install_signal_handler);
97 Matrix
addMatrices(
const Matrix &A,
const Matrix &B)
const;
102 std::shared_ptr<create::Data>
data;
141 bool connect(
const std::string& port,
const int& baud);
148 inline bool connected()
const {
return serial->connected(); };
194 bool driveRadius(
const float& velocity,
const float& radius);
202 bool driveWheels(
const float& leftWheel,
const float& rightWheel);
210 bool driveWheelsPwm(
const float& leftWheel,
const float& rightWheel);
218 bool drive(
const float& xVel,
const float& angularVel);
248 bool setAllMotors(
const float& mainPower,
const float& sidePower,
const float& vacuumPower);
284 bool setPowerLED(
const uint8_t& power,
const uint8_t& intensity = 255);
305 bool setDigits(
const std::vector<bool>& segments)
const;
317 const uint8_t& digit3,
const uint8_t& digit4)
const;
330 const uint8_t& songLength,
331 const uint8_t* notes,
332 const float* durations)
const;
340 bool playSong(
const uint8_t& songNumber)
const;
679 #endif // CREATE_DRIVER_H uint64_t getTotalPackets() const
Get the total number of serial packets received (including corrupt packets) since first connecting to...
bool setSideMotor(const float &power)
Set the power to the side brush motor.
uint8_t getIROmni() const
Get value of 8-bit IR character currently being received by omnidirectional sensor.
uint8_t powerLEDIntensity
bool isLeftWheeldrop() const
float getMeasuredRightWheelVel() const
Get the measured velocity of the right wheel.
bool setVacuumMotor(const float &power)
Set the power to the vacuum motor.
bool isWheelOvercurrent() const
bool isLightBumperFrontLeft() const
bool setDigitsASCII(const uint8_t &digit1, const uint8_t &digit2, const uint8_t &digit3, const uint8_t &digit4) const
Set the four 7-segment display digits from left to right with ASCII codes. Any code out side the acce...
bool isCliffRight() const
bool isLeftBumper() const
create::ChargingState getChargingState() const
Get the current charging state.
bool driveWheels(const float &leftWheel, const float &rightWheel)
Set the velocities for the left and right wheels.
bool dock() const
Starts the docking behaviour. Changes mode to MODE_PASSIVE.
int8_t getTemperature() const
Get the temperature of battery.
bool isHourButtonPressed() const
Get state of 'hour' button.
bool isClockButtonPressed() const
Not supported by any firmware!
uint16_t getLightSignalFrontLeft() const
Get the signal strength from the front-left light sensor.
bool isLightBumperCenterRight() const
float getRequestedLeftWheelVel() const
Get the requested velocity of the left wheel. This value is bounded at the maximum velocity of the ro...
void setDtHistoryLength(const uint8_t &dtHistoryLength)
Set dtHistoryLength parameter. Used to configure the size of the buffer for calculating average time ...
bool setDate(const create::DayOfWeek &day, const uint8_t &hour, const uint8_t &min) const
Sets the internal clock of Create.
float getRightWheelDistance() const
Get the total distance the right wheel has moved.
create::Pose getPose() const
Get the estimated pose of Create based on wheel encoders.
uint8_t getDirtDetect() const
Get level of the dirt detect sensor.
float getRequestedRightWheelVel() const
Get the requested velocity of the right wheel. This value is bounded at the maximum velocity of the r...
bool enableDockLED(const bool &enable)
Set the green "dock" LED on/off.
bool setPowerLED(const uint8_t &power, const uint8_t &intensity=255)
Set the center power LED.
bool isLightBumperFrontRight() const
float getBatteryCharge() const
Get battery's remaining charge.
uint8_t getIRRight() const
Get value of 8-bit IR character currently being received by right sensor.
void init(bool install_signal_handler)
float getCurrent() const
Get current flowing in/out of battery. A positive current implies Create is charging.
bool driveWheelsPwm(const float &leftWheel, const float &rightWheel)
Set the direct for the left and right wheels.
std::shared_ptr< create::Data > data
bool isVirtualWall() const
bool isCliffFrontRight() const
bool setDigits(const std::vector< bool > &segments) const
Set the four 7-segment display digits from left to right.
bool playSong(const uint8_t &songNumber) const
Play a previously created song. This command will not work if a song was not already defined with the...
bool connected() const
Check if serial connection is active.
bool isMovingForward() const
Matrix addMatrices(const Matrix &A, const Matrix &B) const
create::Vel getVel() const
Get the estimated velocity of Create based on wheel encoders.
uint64_t getNumCorruptPackets() const
Get the number of corrupt serial packets since first connecting to Create. This value is ideally zero...
uint16_t getLightSignalCenterLeft() const
Get the signal strength from the center-left light sensor.
std::shared_ptr< create::Serial > serial
bool isLightBumperLeft() const
bool clean(const create::CleanMode &mode=CLEAN_DEFAULT)
Starts a cleaning mode. Changes mode to MODE_PASSIVE.
Create(RobotModel model=RobotModel::CREATE_2, bool install_signal_handler=true)
Default constructor.
bool isScheduleButtonPressed() const
Not supported by any firmware!
bool enableCheckRobotLED(const bool &enable)
Set the orange "check Create" LED on/off.
bool driveRadius(const float &velocity, const float &radius)
Set the average wheel velocity and turning radius of Create.
bool enableSpotLED(const bool &enable)
Set the green "spot" LED on/off.
bool setMainMotor(const float &power)
Set the power to the main brush motor.
bool isMinButtonPressed() const
Get state of 'min' button.
bool isCleanButtonPressed() const
Get state of 'clean' button ('play' button on Create 1).
bool drive(const float &xVel, const float &angularVel)
Set the forward and angular velocity of Create.
bool isDockButtonPressed() const
Get state of 'dock' button ('advance' button on Create 1).
float getMeasuredLeftWheelVel() const
Get the measured velocity of the left wheel.
boost::numeric::ublas::matrix< float > Matrix
bool enableDebrisLED(const bool &enable)
Set the blue "debris" LED on/off.
float getVoltage() const
Get battery voltage.
uint16_t getLightSignalLeft() const
Get the signal strength from the left light sensor.
bool isMainBrushOvercurrent() const
bool isRightWheeldrop() const
bool isRightBumper() const
bool isDayButtonPressed() const
Get state of 'day' button.
std::chrono::time_point< std::chrono::steady_clock > prevOnDataTime
uint16_t getLightSignalCenterRight() const
Get the signal strength from the center-right light sensor.
bool isSpotButtonPressed() const
Get state of 'spot' button.
bool isCliffFrontLeft() const
uint16_t getLightSignalRight() const
Get the signal strength from the right light sensor.
bool isSideBrushOvercurrent() const
float getBatteryCapacity() const
Get estimated battery charge capacity.
bool connect(const std::string &port, const int &baud)
Make a serial connection to Create.
static RobotModel CREATE_2
Compatible with Create 2 or Roomba 600 series and greater.
uint8_t getIRLeft() const
Get value of 8-bit IR character currently being received by left sensor.
bool setAllMotors(const float &mainPower, const float &sidePower, const float &vacuumPower)
Set the power of all motors.
void disconnect()
Disconnect from serial.
float getLeftWheelDistance() const
Get the total distance the left wheel has moved.
bool setMode(const create::CreateMode &mode)
Change Create mode.
create::CreateMode getMode()
Get the current mode reported by Create.
~Create()
Attempts to disconnect from serial.
std::deque< float > dtHistory
bool isLightBumperRight() const
bool isLightBumperCenterLeft() const
uint16_t getLightSignalFrontRight() const
Get the signal strength from the front-right light sensor.
bool defineSong(const uint8_t &songNumber, const uint8_t &songLength, const uint8_t *notes, const float *durations) const
Defines a song from the provided notes and labels it with a song number.