Skip to content Skip to main navigation Skip to footer

System Functions

Set lighting effect

Method name: setLight

Calling method:

JSONObject params = new JSONObject();
try {    
    params.put(Definition.JSON_LAMB_TYPE, type);    
    params.put(Definition.JSON_LAMB_TARGET, 0);    
    params.put(Definition.JSON_LAMB_RGB_START, startColor);    
    params.put(Definition.JSON_LAMB_RGB_END, endColor);    
    params.put(Definition.JSON_LAMB_START_TIME, startTime);    
    params.put(Definition.JSON_LAMB_END_TIME, endTime);    
    params.put(Definition.JSON_LAMB_REPEAT, loopTime);    
    params.put(Definition.JSON_LAMB_ON_TIME, duration);    
    params.put(Definition.JSON_LAMB_RGB_FREEZE, finalColor);
} catch (JSONException e) {    
    e.printStackTrace();
}
RobotApi.getInstance().setLight(0, params.toString(), null);

Parameter Description:

  • reqId: int type command id
  • params: String type, can contain the following parameters: type-Lighting effect type start-Start color end-End color startTime-Start time endTime-End time repeat-Loop times onTime-Duration freese-end lighting color
  • type: Is 0
  • startColor: Starting color value of lighting effect
  • endColor: End color value of lighting effect
  • startTime: The color stays at the beginning of the gradient
  • endTime: The time that the color stays at the end of the gradient
  • loopTime: Light effect gradual repetition times
  • duration: Time spent in the gradual change process
  • finalColor: Gradient transition color
  • listener: ActionListener type message callback
  • Color value: 16-bit string in RGB arrangement, such as “F3F3F3” or “00FF00”.

Return Value:

int result 0 command executed / -1 not executed

Applicable Platform:

GreetbotMiniLuckiBaoxiaodi MAXBaodaping
YesNoYesYesNo

Setting up the lighting effect code demo can be found here (the code is suitable for Greetbot, please replace the robot jar package for other robots):Download

Control lucki robot lights

Method name: playMultipleColor Only can work with lucki

Calling method:

public class LightMultipleColor extends LedLightBean {    
    //[0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0,0,0,0,0,0,0]    
    public LightMultipleColor(int[] rgbSet) {        
        this.rgbSet = rgbSet;        
        this.type = 6;        
        this.target = Definition.LAMP_TARGET_FOOT;    
    }
}
public void playMultipleColor(LightMultipleColor color) {    
    Log.d("123", "playMultipleColor color: " + color);    
    if (color == null) {        
        return;    
    }    
    color.setTarget(Definition.LAMP_TARGET_FOOT);    
    color.setType(6);    
    RobotApi.getInstance().setLedLight(reqID, color);
}

Parameter Description:

  • LightMultipleColor: control 15 lights in the lucki robot.

Return Value:

int result 1 command executed / -1 not executed
GreetbotMiniLuckiBaoxiaodi MAXBaodaping
NoNoYesNoNo

Get local SN

Method name: getRobotSn

Calling method:

boolean status = RobotApi.getInstance().getRobotSn(    
    new CommandListener() {        
        @Override        
        public void onResult(int result, String message) {            
            if (Definition.RESULT_OK == result) {                
                String serialNum = message;            
            } else {            
            }        
        }    
    });

Parameter Description:

  • listenerCommandListener message callback {"code":0, "message":"err msg"}

Return Value:

int result 1 command executed / -1 not executed

Applicable Platform:

GreetbotMiniLuckiBaoxiaodi MAXBaodaping
YesYesYesYesYes

Get the system version

Method name: getVersion

Calling method:

String version = RobotApi.getInstance().getVersion();

Applicable Platform:

GreetbotMiniLuckiBaoxiaodi MAXBaodaping
YesYesYesYesYes

Prohibit system functions

The system no longer takes over the emergency stop event, there is no emergency stop screen, but the robot cannot use the motion function, other abilities can be used

Method name: disableEmergency

Calling method:

RobotApi.getInstance.disableEmergency();

API for obtaining emergency status, or rigister listener:

RobotApi.getInstance().getRobotStatus(Definition.STATUS_EMERGENCY,new StatusListener(){            
    @Override            
    public void onStatusUpdate(String type, String data) throws RemoteException {                        
        Log.d("onStatusUpdate","Status:"+data);            
    }        
});
RobotApi.getInstance().registerStatusListener(Definition.STATUS_EMERGENCY,new StatusListener(){    
    @Override    
    public void onStatusUpdate(String type, String data) throws RemoteException {            
        Log.d("onStatusUpdate","status:"+type+";value:"+data);    
    }
});

Applicable Platform:

GreetbotMiniLuckiBaoxiaodi MAXBaodaping
YesYesYesYesYes

Disable the current battery interface, you can use any ability of the client app except the chassis when charging

Method name: disableBattery

Calling method:

RobotApi.getInstance().disableBattery();

API for obtaining battery status:

RobotSettingApi.getInstance().getRobotString(Definition.ROBOT_SETTINGS_BATTERY_INFO);

Applicable Platform:

GreetbotMiniLuckiBaoxiaodi MAXBaodaping
YesYesYesYesYes

Disable function keys, the button behind the head of Lucky Leopard, used to terminate the current task

Method name: disableFunctionKey

Calling method:

RobotApi.getInstance().disableFunctionKey();

Applicable Platform:

GreetbotMiniLuckiBaoxiaodi MAXBaodaping
NoNoYesNoNo

Dormant

Scene introduction:

Hibernation is a mode that allows the robot to keep running at low power consumption when there is no task or when the battery is low. To use this function , you need to add this to your project.
<uses-permission android:name="com.ainirobot.coreservice.robotSettingProvider" />

Applicable Platform:

GreetbotMiniLuckiBaoxiaodi MAXBaodaping
NoNoYesNoNo

Hibernate

Method name: robotStandby

Calling method:

RobotApi.getInstance().robotStandby(0, new CommandListener() {    
    @Override    
    public void onStatusUpdate(int status, String data, String extraData) {                
        super.onStatusUpdate(status, data, extraData);    
    }
});

Stop hibernation

Method name: robotStandbyEnd

Calling method:

RobotApi.getInstance().robotStandbyEnd(reqId);

BigScreenBot Development

Introduction

BigScreenBot is a large-screen version of GreetBot, which supports large-screen display content.

1. Permission issues

BigScreenBot display content must apply for the SYSTEM_ALERT_WINDOW permission of the global pop-up dialog box.

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

2. The picture is not full screen problem

<ImageView    
    android:id="@+id/bs_image"    
    android:layout_width="match_parent"    
    android:layout_height="match_parent"    
    android:layout_weight="1"    
    android:scaleType="fitXY"/>

Sample code

Multi Robots Info

Get multi robots info

If the robot have ESP32 multi-robot hardware, use this code get receive multi-robot info.

JRobotApi.getInstance().registerStatusListener(Definition.STATUS_MULTIPLE_ROBOT_WORKING, mStatusListener);
private StatusListener mStatusListener = new StatusListener() {    
    @Override    
    public void onStatusUpdate(String type, String data) {        
        try {            
            Type dataType = new TypeToken<List<MultiRobotStatus>>(){}.getType();                
            List<MultiRobotStatus> curRobotStatus = mGson.fromJson(data, dataType);        
        }catch(Exception ex){        
        }    
    }
}

If the robot does not have ESP32 multi-robot hardware, this will not work. And about the structure of MultiRobotStatus, just like this:

public class MultiRobotStatus {    
    private BasePoseBean pose;    
    private BasePoseBean goal;    
    private int id;    
    private int priority;    
    private boolean mapMatch;    
    private long time;    
    private int status;    
    private boolean curRobot = false;    
    private int errorStatus = 0;
}
GreetbotMiniLuckiBaoxiaodi MAXBaodaping
NoNoYesNoNo