rpos::features::SystemResource Class

System resource related feature, which provides raw LIDAR scan, power management, chasis status information and etc. access functions.

Header File

rpos/features/system_resource/feature.h

Applies to

  • Slamware
  • Mapper

Base Class

Derived from rpos::core::Feature

Constructors

SystemResource(boost::shared_ptr<detail::SystemResourceImpl>)  

Used only by SDK itself

SystemResource()  

Default contructor

Methods

int getBatteryPercentage()

Get remaining battery in percentage. (56 for 56%)

bool getBatteryIsCharging()  

Get if the battery is charging

bool getDCIsConnected()  

Get if the power outlet is connected to the robot

system_resource::PowerStatus  getPowerStatus()   

Get composed power status. For details please refer to rpos::features::system_resource::PowerStatus

void wakeUp()   

Wake up the robot from hibernation.

int getBoardTemperature()  

Get the temperature of the mother board, unit: 0.1℃.

std::string getSDPVersion()  

Get the software version of SLAMWARE system.

rpos::features::system_resource::LaserScan getLaserScan()  

Get raw scan data. For details, please refer to rpos::features::system_resource::LaserScan

bool restartModule(system_resource::RestartMode mode = system_resource::RestartModeSoft)  

Restart the SLAMWARE system in specified mode

Restart Modes

Value Comments
RestartModeSoft Soft restart. Restart services only
RestartModeHard Hard restart. Reboot the whole system
bool setSystemParameter(const std::string& param, const std::string& value)  

Adjust system parameter on the fly.

Name Data type Comments
param const std::string& The key to the system parameter, see following table for details
value const std::string& The new value to this parameter

System Parameters

Name Comments Available Values
base.max_moving_speed Max linear speed for robot float literal or one of three:"high","medium","low"
motionplan.low_localization_quality_threshold Thershold to stop robot movement under low localization quality Integer between 0 to 100
base.power_off_wait_time Time to wait when power off is requested Integer, in seconds

Example

bool bRet = platform.setSystemParameter(SYSPARAM_ROBOT_SPEED, SYSVAL_ROBOT_SPEED_HIGH);
std::string getSystemParameter(const std::string& param)  

Get current value of system parameter. Please refer to setSystemParameter for available values to param.

bool updateBinaryConfig(const Json::Value& jsnCfg)  

Upload binary config

bool shutdownSlamcore(const rpos::core::SlamcoreShutdownParam& shutdownArg)  

Shutdown SLAMWARE system

Name Data type Comments
shutdownArg const rpos::core::SlamcoreShutdownParam& Fields of this struct: restartTimeIntervalMinute for time interval to restart; shutdownTimeIntervalMinute for time interval to shutdown; please notice, restart time should be greater than shutdown time, or an OperationFailException will be thrown.
system_resource::DeviceInfo getDeviceInfo()  

Get device info, for details please refer to rpos::features::system_resource::DeviceInfo

rpos::features::system_resource::BaseHealthInfo getRobotHealth()  

Get robot health infomation, for details please refer to rpos::features::system_resource::BaseHealthInfo

void clearRobotHealth(int errorCode)  

Clear specific health error code.

bool configurateNetwork(
    rpos::features::system_resource::NetworkMode mode,
    const std::map<std::string, std::string>& options
)  

Configure robot network mode

Parameters

Network Modes ssid password channel ip dns gateway mask
NetworkModeAp Optional Optional Optional Optional Optional Optional Optional
NetworkModeStation Required Optional -- -- -- -- --
NetworkModeWifiDisabled -- -- -- -- -- -- --
NetworkModeDHCPDisabled -- -- -- -- -- -- --
NetworkModeDHCPEnabled -- -- -- -- -- -- --
  1. Only listed modes are supported yet, ssid, password, channel, and other fields may be optional or required according to selected network mode (-- for N/A)
  2. NetworkModeWifiDisabled will disable the WiFi function

Example

std::map<std::string, std::string> options;
options[“ssid”] = “Slamtec”;
options[“password”] = “slamtect”;
Bool bRet = platform.configureNetwork(rpos::features::system_resource::NetworkModeStation,options);
std::map<std::string, std::string> getNetworkStatus()  

Get current wireless configuration

Notes: currently only mode, ssid, and ip are returned

system_resource::HeartBeatToken startHeartBeat(int heartBeatTimeoutInSeconds)  

Start heart beat. After first start, the client app should invoke refreshHeartBeat method periodically to tell it's working properly. If SLAMWARE doesn't receive the token in preset timeout, it will judge client application's malfunctioning and abort current action.

Name Data type Comments
heartBeatTimeoutInSeconds int Heartbeat timeout in seconds
void refreshHeartBeat(system_resource::HeartBeatToken token)  

Refresh heart beat. Only one or no token is active. If startHeartBeat is invoked twice, the first token will be invalidated, and only later timeout and token are valid.

Name Date type Comments
token system_resource::HeartBeatToken Token returned by startHeartBeat(int)
void stopHeartBeat(system_resource::HeartBeatToken token)    

Stop heart beat function.

void voiceRespond()  

Voice respond to indicate robot's position. (unsupported yet)

void startFirmwareUpgrade(const std::string& filename)  

Start firmware upgrade with specific firmware file.

Name Date type Comments
filename const std::string& The path to the firmware file
void startFirmwareUpgrade(const std::vector<uint8_t>& firmwareContent)  

Start firmware upgrade with firmware binary

Name Date type Comments
firmwareContent const std::vector& The binary content of the firmware file
void publishDepthCamFrame(
    int sensorId,
    const rpos::message::depth_camera::DepthCameraFrame& frame
)

Send depth camera frame to the SLAMWARE system

Name Date type Comments
sensorId int Sensor ID, should be the same with configuration
frame const rpos::message::depth_camera::DepthCameraFrame& Depth camera frame
std::vector<system_resource::OperationAuditLog> getOperationAuditLogs()  

Get operation audit log from SLAMWARE system

int sendAndRecvUserDefinedCBUSMessage(
    const void * payload,
    const size_t payloadsize,
    void * recvBuffer,
    size_t & recvDataSize
)

Send customized control bus command to the chasis and receives response

system_resource::LidarAutoTweakRequestResult beginLidarAutoTweak()  

Begin LIDAR auto tweaking process

Return values

Return value Comment
LidarAutoTweakRequestResultStarted LIDAR auto tweaking started
LidarAutoTweakRequestResultNotSupport The robot doesn't support this feature
LidarAutoTweakRequestResultDisabled This feature is disabled in the configuration
system_resource::LidarAutoTweakStatus getLidarAutoTweakStatus()

Fetch LIDAR auto tweaking status

Return values

Return value Comments
LidarAutoTweakStatusIdle Idle, the tweaking process is not triggered
LidarAutoTweakStatusWaitingForContext The tweaking process is triggered, but still collecting more data
LidarAutoTweakStatusTweaking All required data is ready, tweaking LIDAR
LidarAutoTweakStatusDone LIDAR is tweaked, wait for accept or reject
LidarAutoTweakStatusFailed Cannot find out a proper parameter for this tweaking
bool acceptLidarTweakResult()  

Accept LIDAR auto tweaking result, and save to LIDAR

void resetLidarTweakResult()  

Reject LIDAR auto tweaking result, and revert to original settings

void cancelLidarAutoTweak()  

Cancel current auto tweaking process