RooWifi: WiFi adapter for Roomba API
The latest version of RooWifi API is based on the gateway mode and it’s programmed using Qt Creator cross-platform IDE, which allows developers to use Windows, MAC, GNU/Linux,… Next revisions will have support and the required modifications to be able to develop with Visual Studio, gcc,g++ and Python
In roowifi.h comment #define ROOWIFI_DEBUG to disable debug output messages, this define is enabled by default.
If AutoCapture mode is used, when the RooWifi::Sensors is updated, the class generates an AutoCaptureUpdated() SIGNAL. If not the generated SIGNAL is DataReady() when a data byte is received from the RooWifi (eg, manual sensor reading using ExecuteCommand functions).
TCP Socket Connection / Disconnection functions
void SetIP( QString NewIP )
Sets the IP address of RooWifi. You need to call this function to select the IP address of your device. By default the IP address of RooWifi is 10.0.0.1 (the default IP address of RooWifi in Ad-Hoc mode). In Windows Systems you could use the NBNSBios name to connect to your RooWifi. Examples: Windows: SetIP ( “roomba”); Others: SetIP (“10.0.0.1”);
Returns a QString with the NBNSBios name of your RooWifi or you RooWifi’s IP address. Example: QString AddressOfMyRooWifi = GetIP();
Try to connect to RooWifi using a standard TCP/IP socket getting the IP address set in SetIP(QString NewIP) function. If it causes an exception or any error occurs while connecting process it will generate a trigger signal.
Disconnects from RooWifi and close the TCP/IP socket connection.
Returns true if the connection is established or false if not.
Sensors / Roomba Telemetry
Requests all sensor values.
Working modes of Roomba
Puts Roomba in Safe Mode. You can drive your Roomba but when it detects an obstacle or something that could damage the robot it will stop automatically and will set itself to Passive Mode (default).
Puts Roomba in Full Mode. Enables unrestricted control of Roomba and turns off the safety features. Be careful using this mode while driving or controlling Roomba.
Actions / Emulation of buttons
Starts a normal cleaning cycle, the same as a normal “clean” button press. This command puts in Safe Mode.
Starts a spot cleaning cycle, the same as a normal “spot” button press. This command puts in Safe Mode.
Turns on force-seeking-dock mode, which causes the robot to immediately attempt to dock during its cleaning cycle if it encounters the docking beams from the Home Base. (Note, however, that if the robot was not active in a clean, spot or max cycle it will not attempt to execute the docking.) Normally the robot attempts to dock only if the cleaning cycle has completed or the battery is nearing depletion. This command can be sent anytime, but the mode will be cancelled if the robot turns off, begins charging, or is commanded into safe or full modes.
Moving Roomba as you would
Play with Roomba like a RC Car :)
void Drive( int Velocity, int Radius )
Parameters: Velocity: specify the average velocity of the drive wheels in millimeters per second (mm/s). Max forward = 500mm/s. Max backward = -500mm/s Radius: The radius, in millimeters, at which Roomba should turn. The longer radii make Roomba drive straighter; shorter radii make it turn more. Max turn = 1 or -1. Margins= -2000mm , 2000mm A Drive command with a positive velocity and a positive radius will make Roomba drive forward while turning toward the left. A negative radius will make it turn toward the right. Special cases for the radius make Roomba turn in place or drive straight, as specified below. The robot must be in safe or full mode to accept this command.
Turns on Roomba’s Main Brush
Turns off Roomba’s Main Brush
Turns on Roomba’s Vacuum
Turns off Roomba’s Vacuum
Turns on Roomba’s Side Brush
Turns off Roomba’s Side Brush
Turns on all Roomba Cleanning buttons
Turns off all Roomba Cleaning buttons
Turns on Spot Led
Turns off Spot Led
Turns on Max Led
Turns off Max Led
Turns on Clean Led
Turns off Clean Led
Turns on Dirt Led
Turns off Dirt Led Status Led – Deprecated if using >= Roomba 500 series.
void Led_Power_Color( int NewColor )
Sets new color for Power Led (battery led in Roomba 700) Parameter: NewColor: New Color of Power Led ( 0 – 255 )
void Led_Power_Intensity( int NewIntensity )
Sets new intensity of Power Led (battery led in Roomba 700) Parameter: NewIntensity: New Intensity of Power Led ( 0 – 255 )
Turns off Power Led (battery led in Roomba 700)
With these functions you could send and receive sensor data directly through RooWifi with or without use of Auto Capture mode of this “API”
void ExecuteCommand( int CommandToSend )
Parameter: CommandToSend: Command you want to transmit to Roomba
void ExecuteCommandWithParameter( int CommandToSend, int Data )
Parameters: CommandToSend: Command you want to transmit to Roomba. Data: Value to transmit alter the command header.
void ExecuteCommandWithParameters ( int CommandToSend, int* Parameters, int NumParameters )
Parameters: CommandToSend: Command you want to transmit to Roomba. Parameters: Array with parameters. NumParameters: Number of parameters apart of Command. Lenght of Parameters array.
Returns the number of bytes received from Roomba and available in the reception buffer.
int Read(char *Data, int DataLen)
Parameters: Data: Array where you want to sore received data DataLen: Length of received data to read
Auto Capture Mode
Once connected to RooWifi you could use this mode to refresh sensor data with the specified period of time in ms with SetAutoCaptureTime() automatically refreshing RoombaSensors structure.
Enables/starts auto capture mode
Disables/stops auto capture mode
void SetAutoCaptureTime( int NewPeriod )
Sets new period time between sensor packet 0 requests Parameters: NewPeriod: Time in ms between requests
Returns perdiod time between sensor packet 0 requests
Returns a float with calculated value of battery level