public abstract class RoombaJSSC extends Object
Constructor and Description |
---|
RoombaJSSC() |
Modifier and Type | Method and Description |
---|---|
int |
angleTurned()
Get the angle turned in degrees since the last sensor data request.
|
int |
batteryCapacity()
Get the estimated charge capacity of roomba's battery in milliamp-hours (mAh)
|
int |
batteryCharge()
Get the estimated charge of the roomba's battery in milliamp-hours (mAh).
|
int |
batteryCurrent()
Get the current in milliamps (mA) flowing into or out of roomba's battery.
|
int |
batteryTemperature()
Get the temperature of Roomba's battery in degrees Celsius.
|
int |
batteryVoltage()
Get the voltage of the battery in millivolt (mV)
|
boolean |
bumpLeft()
Get value of left bumper sensor.
|
boolean |
bumpRight()
Get value of right bumper sensor.
|
boolean |
buttonCleanPressed()
Check if the clean button is pressed.
|
boolean |
buttonClockPressed()
Check if the clock button is pressed.
|
boolean |
buttonDayPressed()
Check if the day button is pressed.
|
boolean |
buttonDockPressed()
Check if the dock button is pressed.
|
boolean |
buttonHourPressed()
Check if the hour button is pressed.
|
boolean |
buttonMinutePressed()
Check if the minute button is pressed.
|
void |
buttons(boolean clean,
boolean spot,
boolean dock,
boolean minute,
boolean hour,
boolean day,
boolean schedule,
boolean clock)
This command lets you push Roomba’s buttons.
|
boolean |
buttonSchedulePressed()
Check if the schedule button is pressed.
|
boolean |
buttonSpotPressed()
Check if the spot button is pressed.
|
int |
chargingState()
Get current charging state
|
void |
clean()
This command starts the default cleaning mode.
|
void |
cleanMax()
This command starts the Max cleaning mode, which will clean until the battery is dead.
|
void |
cleanSpot()
This command starts the Spot cleaning mode.
|
boolean |
cliffFrontLeft()
Get value of cliff front left sensor.
|
boolean |
cliffFrontRight()
Get value of cliff front right sensor.
|
boolean |
cliffLeft()
Get value of cliff left sensor.
|
boolean |
cliffRight()
Get value of cliff right sensor.
|
int |
cliffSignalFrontLeft()
Get the strength of the cliff front left signal.
|
int |
cliffSignalFrontRight()
Get the strength of the cliff front right signal.
|
int |
cliffSignalLeft()
Get the strength of the cliff left signal.
|
int |
cliffSignalRight()
Get the strength of the cliff right signal.
|
abstract boolean |
connect(String portId) |
void |
digitLedsAscii(char char0,
char char1,
char char2,
char char3)
This command controls the four 7 segment displays on the Roomba 560 and 570 using ASCII character codes.
|
int |
dirtDetectLevel()
Get the level of the dirt detect sensor.
|
abstract void |
disconnect() |
int |
distanceTraveled()
Get distance travelled in mm since the last sensor data request.
|
void |
drive(int velocity,
int radius)
This command controls Roomba’s drive wheels.
|
void |
driveDirect(int rightVelocity,
int leftVelocity)
This command lets you control the forward and backward motion of Roomba’s drive wheels independently.
|
void |
drivePWM(int rightPWM,
int leftPWM)
This command lets you control the raw forward and backward motion of Roomba’s drive wheels independently.
|
int |
encoderCountsLeft()
Get the (cumulative) number of raw left encoder counts.
|
int |
encoderCountsRight()
Get the (cumulative) number of raw right encoder counts.
|
void |
fullMode()
This command gives you complete control over Roomba by putting the OI into Full mode,
and turning off the cliff, wheel-drop and internal charger safety features.
|
void |
hardReset()
This command resets the Roomba, as if you had removed and reinserted the battery.
|
boolean |
homebaseChargerAvailable()
Check if the homebase charger is present and powered.
|
int |
infraredCharacterLeft()
Get the character currently received by the left receiver.
|
int |
infraredCharacterOmni()
Get the character currently received by the omnidirectional receiver.
|
int |
infraredCharacterRight()
Get the character currently received by the right receiver.
|
boolean |
internalChargerAvailable()
Check if the internal charger is present and powered.
|
void |
leds(boolean debris,
boolean spot,
boolean dock,
boolean check_robot,
int powerColor,
int powerIntensity)
This command controls the LEDs common to all models of Roomba 600.
|
boolean |
lightBumperCenterLeft()
Check if the center left light bumper detects an obstacle.
|
boolean |
lightBumperCenterRight()
Check if the center right light bumper detects an obstacle.
|
boolean |
lightBumperFrontLeft()
Check if the front left light bumper detects an obstacle.
|
boolean |
lightBumperFrontRight()
Check if the front right light bumper detects an obstacle.
|
boolean |
lightBumperLeft()
Check if the left light bumper detects an obstacle.
|
boolean |
lightBumperRight()
Check if the right light bumper detects an obstacle.
|
int |
lightBumperSignalCenterLeft()
Get the strength of the light bumper center left signal.
|
int |
lightBumperSignalCenterRight()
Get the strength of the light bumper center right signal.
|
int |
lightBumperSignalFrontLeft()
Get the strength of the light bumper front left signal.
|
int |
lightBumperSignalFrontRight()
Get the strength of the light bumper front right signal.
|
int |
lightBumperSignalLeft()
Get the strength of the light bumper left signal.
|
int |
lightBumperSignalRight()
Get the strength of the light bumper right signal.
|
boolean |
mainBrushOvercurrent()
Get value of main brush overcurrent sensor.
|
int |
mode()
Get the current OI mode.
|
int |
motorCurrentLeft()
Get the current being drawn by the left wheel motor in milli Ampere (mA).
|
int |
motorCurrentMainBrush()
Get the current being drawn by the main brush motor in milli Ampere (mA).
|
int |
motorCurrentRight()
Get the current being drawn by the right wheel motor in milli Ampere (mA).
|
int |
motorCurrentSideBrush()
Get the current being drawn by the side brush motor in milli Ampere (mA).
|
void |
motors(boolean sideBrush,
boolean vacuum,
boolean mainBrush,
boolean sideBrushClockwise,
boolean mainBrushOutward)
This command lets you control the forward and backward motion of Roomba’s main brush, side brush,
and vacuum independently.
|
void |
motorsPWM(int mainBrushPWM,
int sideBrushPWM,
int vacuumPWM)
This command lets you control the speed of Roomba’s main brush, side brush, and vacuum independently.
|
void |
play(int songNumber)
This command lets you select a song to play from the songs added to Roomba using the Song command.
|
abstract String[] |
portList() |
void |
powerOff()
This command powers down Roomba.
|
void |
relativeLeds(boolean debris,
boolean spot,
boolean dock,
boolean check_robot,
int powerColor,
int powerIntensity)
This command controls the LEDs common to all models of Roomba 600.
|
int |
requestedRadius()
Get the radius most recently requested with a Drive command.
|
int |
requestedVelocity()
Get the velocity most recently requested with a Drive command.
|
int |
requestedVelocityLeft()
Get the left wheel velocity most recently requested with a Drive Direct command.
|
int |
requestedVelocityRight()
Get the right wheel velocity most recently requested with a Drive Direct command.
|
void |
reset()
Reset the Roomba after error, this will also run the 'start' and 'safe' commands.
|
void |
safeMode()
This command puts the OI into Safe mode, enabling user control of Roomba.
|
boolean |
safetyFault()
Check if a safety fault has occurred, this will put the roomba into passive mode.
|
void |
schedule(boolean sun,
boolean mon,
boolean tue,
boolean wed,
boolean thu,
boolean fri,
boolean sat,
int sun_hour,
int sun_min,
int mon_hour,
int mon_min,
int tue_hour,
int tue_min,
int wed_hour,
int wed_min,
int thu_hour,
int thu_min,
int fri_hour,
int fri_min,
int sat_hour,
int sat_min)
This command sends Roomba a new schedule.
|
void |
schedulingLeds(boolean sun,
boolean mon,
boolean tue,
boolean wed,
boolean thu,
boolean fri,
boolean sat,
boolean colon,
boolean pm,
boolean am,
boolean clock,
boolean schedule)
This command controls the state of the scheduling LEDs present on the Roomba 560 and 570.
|
void |
seekDock()
This command directs Roomba to drive onto the dock the next time it encounters the docking beams.
|
abstract boolean |
send(byte[] bytes) |
abstract boolean |
send(int b) |
void |
setDayTime(int day,
int hour,
int minute)
This command sets Roomba’s clock.
|
boolean |
sideBrushOvercurrent()
Get value of side brush overcurrent sensor.
|
void |
sleep(int millis)
General sleep function that gives commands that use this function some time to instantiate.
|
void |
song(int songNumber,
RoombaSongNote[] notes,
int tempo)
This command lets you specify up to four songs to the OI that you can play at a later time.
|
int |
songNumber()
Get the currently selected song.
|
boolean |
songPlaying()
Check if a song is playing.
|
void |
start()
This command starts the OI.
|
void |
startup()
This command starts the OI of the roomba and puts it in Safe mode
which enables user control.
|
boolean |
stasis()
Check if the roomba is making forward progress.
|
void |
stop()
This command stops the OI.
|
void |
updateSensors()
This command requests new sensor data from the roomba.
|
boolean |
virtualWall()
Get value of virtual wall sensor.
|
boolean |
wall()
Get value of wall sensor.
|
int |
wallSignal()
Get the strength of the wall signal.
|
boolean |
wheelDropLeft()
Get value of left wheel drop sensor.
|
boolean |
wheelDropRight()
Get value of right wheel drop sensor.
|
boolean |
wheelOvercurrentLeft()
Get value of left wheel overcurrent sensor.
|
boolean |
wheelOvercurrentRight()
Get value of right wheel overcurrent sensor.
|
public abstract String[] portList()
public abstract boolean connect(String portId)
public abstract void disconnect()
public abstract boolean send(byte[] bytes)
public abstract boolean send(int b)
public void start()
public void startup()
Note: Wait at least 500ms before sending any commands.
public void stop()
public void powerOff()
public void reset()
public void hardReset()
Note: Wait at least 5000ms before sending any commands.
public void safeMode()
public void fullMode()
public void clean()
public void cleanMax()
public void cleanSpot()
public void seekDock()
public void schedule(boolean sun, boolean mon, boolean tue, boolean wed, boolean thu, boolean fri, boolean sat, int sun_hour, int sun_min, int mon_hour, int mon_min, int tue_hour, int tue_min, int wed_hour, int wed_min, int thu_hour, int thu_min, int fri_hour, int fri_min, int sat_hour, int sat_min) throws IllegalArgumentException
sun
- Enable Sunday schedulingmon
- Enable Monday schedulingtue
- Enable Tuesday schedulingwed
- Enable Wednesday schedulingthu
- Enable Thursday schedulingfri
- Enable Friday schedulingsat
- Enable Saturday schedulingsun_hour
- Sunday scheduled hoursun_min
- Sunday scheduled minutemon_hour
- Monday scheduled hourmon_min
- Monday scheduled minutetue_hour
- Tuesday scheduled hourtue_min
- Tuesday scheduled minutewed_hour
- Wednesday scheduled hourwed_min
- Wednesday scheduled minutethu_hour
- Thursday scheduled hourthu_min
- Thursday scheduled minutefri_hour
- Friday scheduled hourfri_min
- Friday scheduled minutesat_hour
- Saturday scheduled hoursat_min
- Saturday scheduled minuteIllegalArgumentException
- One of the arguments is out of bounds.public void setDayTime(int day, int hour, int minute) throws IllegalArgumentException
day
- Day number: 0 = Sunday, 1 = Monday ... 6 = Saturdayhour
- Hour in 24hour format 0-23minute
- Minute 0-59IllegalArgumentException
- One of the arguments is out of bounds.public void drive(int velocity, int radius) throws IllegalArgumentException
velocity
- The average velocity of the drive wheels in millimeters per second (mm/s)
A positive velocity makes the roomba drive forward, a negative velocity
makes it drive backwards.
min: -500mm/s max: 500mm/sradius
- The radius in millimeters at which Roomba will turn
The longer radii make Roomba drive straighter, while the shorter radii make Roomba turn more.
The radius is measured from the center of the turning circle to the center of Roomba.
min: -2000mm max: 2000mm
Special cases:IllegalArgumentException
- One of the arguments is out of bounds.public void driveDirect(int rightVelocity, int leftVelocity) throws IllegalArgumentException
rightVelocity
- Right wheel velocity min: -500 mm/s, max: 500 mm/sleftVelocity
- Left wheel velocity min: -500 mm/s, max: 500 mm/sIllegalArgumentException
- One of the arguments is out of bounds.public void drivePWM(int rightPWM, int leftPWM) throws IllegalArgumentException
rightPWM
- Right wheel PWM (min: -100%, max: 100%)leftPWM
- Left wheel PWM (min: -100%, max: 100%)IllegalArgumentException
- One of the arguments is out of bounds.public void motors(boolean sideBrush, boolean vacuum, boolean mainBrush, boolean sideBrushClockwise, boolean mainBrushOutward)
sideBrush
- Turns on side brushvacuum
- Turns on vacuummainBrush
- Turns on main brushsideBrushClockwise
- if true the side brush will turn clockwise (default: counterclockwise)mainBrushOutward
- if true the side brush will turn outward (default: inward)public void motorsPWM(int mainBrushPWM, int sideBrushPWM, int vacuumPWM) throws IllegalArgumentException
mainBrushPWM
- Main brush PWM (min: -100%, max: 100%)sideBrushPWM
- Side brush PWM (min: -100%, max: 100%)vacuumPWM
- Vacuum PWM (min: 0%, max: 100%)IllegalArgumentException
- One of the arguments is out of bounds.public void relativeLeds(boolean debris, boolean spot, boolean dock, boolean check_robot, int powerColor, int powerIntensity) throws IllegalArgumentException
debris
- Turns on the debris LEDspot
- Turns on the spot LEDdock
- Turns on the dock LEDcheck_robot
- Turns on the check robot LEDpowerColor
- Controls the power LED red color relative to green: 0% = green, 100% = red.
Intermediate values are intermediate colors (orange, yellow, etc).powerIntensity
- Controls the intensity of the power led. 0% = off, 100% = full intensity.
Intermediate values are intermediate intensities.IllegalArgumentException
- One of the arguments is out of bounds.public void leds(boolean debris, boolean spot, boolean dock, boolean check_robot, int powerColor, int powerIntensity) throws IllegalArgumentException
debris
- Turns on the debris LEDspot
- Turns on the spot LEDdock
- Turns on the dock LEDcheck_robot
- Turns on the check robot LEDpowerColor
- Controls the power LED color: 0 = green, 255 = red.
Intermediate values are intermediate colors (orange, yellow, etc).powerIntensity
- Controls the intensity of the power led. 0 = off, 255 = full intensity.
Intermediate values are intermediate intensities.IllegalArgumentException
- One of the arguments is out of bounds.public void schedulingLeds(boolean sun, boolean mon, boolean tue, boolean wed, boolean thu, boolean fri, boolean sat, boolean colon, boolean pm, boolean am, boolean clock, boolean schedule)
sun
- Turn on scheduling Sunday LEDmon
- Turn on scheduling Monday LEDtue
- Turn on scheduling Tuesday LEDwed
- Turn on scheduling Wednesday LEDthu
- Turn on scheduling Thursday LEDfri
- Turn on scheduling Friday LEDsat
- Turn on scheduling Saturday LEDcolon
- Turn on scheduling Colon LEDpm
- Turn on scheduling PM LEDam
- Turn on scheduling AM LEDclock
- Turn on scheduling clock LEDschedule
- Turn on scheduling schedule LEDpublic void digitLedsAscii(char char0, char char1, char char2, char char3) throws IllegalArgumentException
char0
- First characterchar1
- Second characterchar2
- Third characterchar3
- Fourth characterIllegalArgumentException
- One of the arguments is out of bounds.public void buttons(boolean clean, boolean spot, boolean dock, boolean minute, boolean hour, boolean day, boolean schedule, boolean clock)
clean
- Presses the clean buttonspot
- Presses the spot buttondock
- Presses the dock buttonminute
- Presses the minute buttonhour
- Presses the hour buttonday
- Presses the day buttonschedule
- Presses the schedule buttonclock
- Presses the clock buttonpublic void song(int songNumber, RoombaSongNote[] notes, int tempo) throws IllegalArgumentException
songNumber
- Song number (0-15)notes
- Array of RoombaSongNote (max. 16)tempo
- Tempo in BPM (min. 60 BPM, max. 800 BPM)IllegalArgumentException
- One of the arguments is out of bounds.public void play(int songNumber) throws IllegalArgumentException
songNumber
- Song number (0-15)IllegalArgumentException
- One of the arguments is out of bounds.public void updateSensors() throws RuntimeException
Note: Don't invoke this method more than once per 50ms, this will possibly corrupt the sensor data received from the roomba.
RuntimeException
- If sensor data updates are requested more than once per 50ms.public boolean safetyFault()
public boolean bumpRight()
public boolean bumpLeft()
public boolean wheelDropRight()
public boolean wheelDropLeft()
public boolean wall()
public boolean cliffLeft()
public boolean cliffFrontLeft()
public boolean cliffFrontRight()
public boolean cliffRight()
public boolean virtualWall()
public boolean sideBrushOvercurrent()
public boolean mainBrushOvercurrent()
public boolean wheelOvercurrentRight()
public boolean wheelOvercurrentLeft()
public int dirtDetectLevel()
public int infraredCharacterOmni()
public int infraredCharacterLeft()
public int infraredCharacterRight()
public boolean buttonCleanPressed()
public boolean buttonSpotPressed()
public boolean buttonDockPressed()
public boolean buttonMinutePressed()
public boolean buttonHourPressed()
public boolean buttonDayPressed()
public boolean buttonSchedulePressed()
public boolean buttonClockPressed()
public int distanceTraveled()
Note: if the sensor data is not polled frequently enough this value is capped at its minimum or maximum (-32768, 32767)
public int angleTurned()
Note: if the sonsor data is not polled requently enough this value is capped at its minimum or maximum (-32768, 32767)
public int chargingState()
States:
public int batteryVoltage()
public int batteryCurrent()
public int batteryTemperature()
public int batteryCharge()
public int batteryCapacity()
public int wallSignal()
public int cliffSignalLeft()
public int cliffSignalFrontLeft()
public int cliffSignalFrontRight()
public int cliffSignalRight()
public boolean internalChargerAvailable()
public boolean homebaseChargerAvailable()
public int mode()
OI modes:
public int songNumber()
public boolean songPlaying()
public int requestedVelocity()
public int requestedRadius()
public int requestedVelocityRight()
public int requestedVelocityLeft()
public int encoderCountsLeft()
Note: This number will roll over to 0 after it passes 65535.
public int encoderCountsRight()
Note: This number will roll over to 0 after it passes 65535.
public boolean lightBumperLeft()
public boolean lightBumperFrontLeft()
public boolean lightBumperCenterLeft()
public boolean lightBumperCenterRight()
public boolean lightBumperFrontRight()
public boolean lightBumperRight()
public int lightBumperSignalLeft()
public int lightBumperSignalFrontLeft()
public int lightBumperSignalCenterLeft()
public int lightBumperSignalCenterRight()
public int lightBumperSignalFrontRight()
public int lightBumperSignalRight()
public int motorCurrentLeft()
public int motorCurrentRight()
public int motorCurrentMainBrush()
public int motorCurrentSideBrush()
public boolean stasis()
Note: this method returns false when the roomba is turning, driving backward, or is not driving.
public void sleep(int millis)
millis
- Time in milliseconds that the current Thread should sleep.Copyright © 2017. All rights reserved.