Upload
doankiet
View
222
Download
0
Embed Size (px)
Citation preview
RooWifi
2
Content
DOCUMENTATION / PUBLIC FUNCTIONS ........................................................................................1
CONTENT.......................................................................................................................................2
TCP SOCKET CONNECTION / DISCONNECTION................................................................4
VOID SETIP( QSTRING NEWIP ) .....................................................................................................4 QSTRING GETIP()............................................................................................................................4 VOID CONNECT() .............................................................................................................................4 VOID DISCONNECT() ........................................................................................................................4
SENSORS / ROOMBA TELEMETRY.........................................................................................4
VOID REQUESTALLSENSORS() ........................................................................................................4
WORKING MODES OF ROOMBA.............................................................................................5
VOID SAFEMODE() ..........................................................................................................................5 VOID FULLMODE()...........................................................................................................................5
ACTIONS / EMULATION OF BUTTONS .................................................................................5
VOID CLEAN() ..................................................................................................................................5 VOID SPOT().....................................................................................................................................5 VOID GODOCK() ..............................................................................................................................5
MOVING ROOMBA AS YOU WOULD .....................................................................................5
VOID DRIVE( INT VELOCITY, INT RADIUS ); ....................................................................................6
MOTOR CONTROL ......................................................................................................................6
VOID MAINBRUSH_ON().................................................................................................................6 VOID MAINBRUSH_OFF()................................................................................................................6 VOID VACUUM_ON() .......................................................................................................................6 VOID VACUUM_OFF()......................................................................................................................6 VOID SIDEBRUSH_ON()...................................................................................................................6
RooWifi
3
VOID SIDEBRUSH_OFF() .................................................................................................................6 VOID ALLCLEANINGMOTORS_ON() ...............................................................................................6 VOID ALLCLEANINGMOTORS_OFF()..............................................................................................7
LED CONTROL..............................................................................................................................7
VOID LED_SPOT_ON() ....................................................................................................................7 VOID LED_SPOT_OFF()...................................................................................................................7 VOID LED_MAX_ON() .....................................................................................................................7 VOID LED_MAX_OFF()....................................................................................................................7 VOID LED_CLEAN_ON() ..................................................................................................................7 VOID LED_CLEAN_OFF().................................................................................................................7 VOID LED_DIRT_ON() .....................................................................................................................7 VOID LED_DIRT_OFF()....................................................................................................................7 STATUS LED - DEPRECATED IF USING >= ROOMBA 500 SERIES. ..................................................7 VOID LED_POWER_COLOR( INT NEWCOLOR ) ..............................................................................8 VOID LED_POWER_INTENSITY( INT NEWINTENSITY )...................................................................8 VOID LED_POWER_OFF() ...............................................................................................................8
PLAYING MUSIC IN ROOMBA..................................................................................................8
VOID STORESONG( INT SONGNUMBER, INT SONGLENGTH, INT *SONG, INT *SONGDURATION)..........................................................................................................................................................8 VOID PLAYSONG( INT SONGNUMBER)...........................................................................................8
DIRECT COMMUNICATION.......................................................................................................8
VOID EXECUTECOMMAND( INT COMMANDTOSEND )...................................................................9 VOID EXECUTECOMMANDWITHPARAMETER( INT COMMANDTOSEND, INT DATA ) ..................9 BYTESAVAILABLE()..........................................................................................................................9 INT READ(CHAR *DATA, INT DATALEN) ........................................................................................9
AUTO CAPTURE MODE..............................................................................................................9
VOID STARTAUTOCAPTURE() .........................................................................................................9 VOID STOPAUTOCAPTURE() ........................................................................................................ 10 VOID SETAUTOCAPTURETIME( INT NEWPERIOD )..................................................................... 10 INT GETAUTOCAPTURETIME()..................................................................................................... 10 FLOAT GETBATTERYLEVEL() ....................................................................................................... 10
CONTACT INFORMATION ..................................................................................................... 10
RooWifi
4
TCP Socket Connection / Disconnection
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”);
QString GetIP() Returns a QString with the NBNSBios name of your RooWifi or you RooWifi’s IP address.
Example: QString AddressOfMyRooWifi = GetIP();
void Connect() 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.
void Disconnect() Disconnects from RooWifi, closet he TCP/IP socket connection.
Returns true if the connection is stablished or false if not.
Sensors / Roomba Telemetry
void RequestAllSensors() Requests all sensor values.
RooWifi
5
Working modes of Roomba
void SafeMode() Roomba in Safe Mode. You could drive your Roomba but when it detects an obstacle or something that Could damage the robot it will stops automatically and puts in Passive Mode (default).
void FullMode() 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 in this mode.
Actions / Emulation of buttons
void Clean() Starts a normal cleaning cycle, the same as a normal “clean” button press. This command puts in Safe Mode.
void Spot() Starts a spot cleaning cycle, the same as a normal “spot” button press. This command puts in Safe Mode.
void GoDock() 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 with a RC Car :)
RooWifi
6
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 radius 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.
Motor Control
void MainBrush_On() Turns on Roomba's Main Brush
void MainBrush_Off() Turns off Roomba's Main Brush
void Vacuum_On() Turns on Roomba's Vacuum
void Vacuum_Off() Turns off Roomba's Vacuum
void SideBrush_On() Turns on Roomba's Side Brush
void SideBrush_Off() Turns off Roomba's Side Brush
void AllCleaningMotors_On() Turns on all Roomba Cleanning buttons
RooWifi
7
void AllCleaningMotors_Off() Turns off all Roomba Cleaning buttons
Led Control
void Led_Spot_On() Turns on Spot Led
void Led_Spot_Off() Turns off Spot Led
void Led_Max_On() Turns on Max Led
void Led_Max_Off() Turns off Max Led
void Led_Clean_On() Turns on Clean Led
void Led_Clean_Off() Turns off Clean Led
void Led_Dirt_On() Turns on Dirt Led
void Led_Dirt_Off() Turns off Dirt Led
Status Led - Deprecated if using >= Roomba 500 series. void Led_Status_Green_On()
void Led_Status_Red_On()
void Led_Status_Ambar_On()
void Led_Status_Off()
RooWifi
8
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 )
void Led_Power_Off() Turns off Power Led (battery led in Roomba 700)
Playing Music in Roomba
void StoreSong( int SongNumber, int SongLength, int *Song, int *SongDuration) Parameter:
• SongNumber: Number of song that you would to store in Roomba ( 1 - 16 ). • SongLength: Number of notes of new song ( 1 - 16 ). • Song: Array with all notes to store. Max 16 notes. • SongDuration: Aray with all notes duration to store SongDuration[0]
corresponds with Song[0].
void PlaySong( int SongNumber) Parameter:
• SongNumber: Specifies the number of song you would to play ( 1 - 16 ).
Direct Communication
With these functions you could send and receive sensor data directly through RooWifi with or without use of Auto Capture mode of this "API"
RooWifi
9
void ExecuteCommand( int CommandToSend ) Parameter:
• CommandToSend: Command you want to transmit to Roomba
void ExecuteCommandWithParameter( int CommandToSend, int Data ) Parameter:
• CommandToSend: Command you want to transmit to Roomba. • Data: Value to transmit alter the command header.
void ExecuteCommandWithParameters ( int CommandToSend, int* Parameters, int NumParameters )
Parameter:
• CommandToSend: Command you want to transmit to Roomba. • Parameters: Array with parameters. • NumParameters: Number of parameters apart of Command. Lenght of
Parameters array.
bytesAvailable() 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.
void StartAutoCapture() Enables/starts auto capture mode
RooWifi
10
void StopAutoCapture() 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
int GetAutoCaptureTime() Returns perdiod time between sensor packet 0 requests
float GetBatteryLevel() Returns a float with calculated value of battery level
Contact Information
If you want to contact directly with us, please send an email to this email address: