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

/**
* Used only by SDK itself.
*/
SystemResource(boost::shared_ptr<detail::SystemResourceImpl>);  
/**
* Default contructor.
*/
SystemResource();  

Methods

/**
* Get remaining battery in percentage. (56 for 56%).
*/
int getBatteryPercentage();
/**
* Get if the battery is charging.
*/
bool getBatteryIsCharging();  
/**
* Get if the power outlet is connected to the robot.
*/
bool getDCIsConnected();  
/**
* Get composed power status. 
*/
system_resource::PowerStatus  getPowerStatus();   

For details, please refer to rpos::features::system_resource::PowerStatus.

/**
* Wake up the robot from hibernation.
*/
void wakeUp();   
/**
* hibernate the robot.
*/
void hibernate();   
/** 
* Get the temperature of the mother board, unit: 0.1℃.
*/
int getBoardTemperature();  
/**
* Get the software version of SLAMWARE system.
*/
std::string getSDPVersion(); 
/**
* Get raw scan data. 
*/
rpos::features::system_resource::LaserScan getLaserScan();  

For details, please refer to rpos::features::system_resource::LaserScan.

/**
* Restart the SLAMWARE system in specified mode.
*/
bool restartModule(system_resource::RestartMode mode = system_resource::RestartModeSoft);  
Item Value Description
system_resource::RestartMode RestartModeSoft Soft restart. Restart services only.
RestartModeHard Hard restart. Reboot the whole system.
RestartModeBase Restart base,Some versions of firmware need to restart base after upgrade. It's not required unless you are recommanded specially。
/**
* Adjust system parameter on the fly.
*/
bool setSystemParameter(const std::string& param, const std::string& value);  
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);
/**
* Get current value of system parameter. Please refer to setSystemParameter for available values to param.
*/
std::string getSystemParameter(const std::string& param);  
/**
* Upload binary config.
*/
bool updateBinaryConfig(const Json::Value& jsnCfg);  
/**
* Upload cube config。
* config file can be exported from Cube Config Tool in RoboStudio.
* Warning: Calling this function will restart slamware, please reconnect later.
*/
bool setCubeConfig(const std::string& cfgFilePath);
/**
* Shutdown SLAMWARE system.
*/
bool shutdownSlamcore(const rpos::core::SlamcoreShutdownParam& shutdownArg);  
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.
/**
* Get device info.
*/
system_resource::DeviceInfo getDeviceInfo();  

For details please refer to rpos::features::system_resource::DeviceInfo.

/**
* Get robot health infomation.
*/
rpos::features::system_resource::BaseHealthInfo getRobotHealth();  

For details please refer to rpos::features::system_resource::BaseHealthInfo.

/**
* Clear specific health error code.
*/
void clearRobotHealth(int errorCode);  
/**
* Configure robot network mode.
*/
bool configurateNetwork(
    rpos::features::system_resource::NetworkMode mode,
    const std::map<std::string, std::string>& options
);  

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);
/**
* Get current wireless configuration.
*/
std::map<std::string, std::string> getNetworkStatus();  

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

/**
* 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.
*/
system_resource::HeartBeatToken startHeartBeat(int heartBeatTimeoutInSeconds);  
Name Data type Comments
heartBeatTimeoutInSeconds int Heartbeat timeout in seconds
/**
* 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.
*/
void refreshHeartBeat(system_resource::HeartBeatToken token);  
Name Date type Comments
token system_resource::HeartBeatToken Token returned by startHeartBeat(int)
/**
* Stop heart beat function.
*/
void stopHeartBeat(system_resource::HeartBeatToken token);    
/**
* Voice respond to indicate robot's position. (unsupported yet).
*/
void voiceRespond();  
/**
* Start firmware upgrade with specific firmware file.
*/
void startFirmwareUpgrade(const std::string& filename);  
Name Date type Comments
filename const std::string& The path to the firmware file
/**
* Start firmware upgrade with firmware binary.
*/
void startFirmwareUpgrade(const std::vector<uint8_t>& firmwareContent); 
Name Date type Comments
firmwareContent const std::vector& The binary content of the firmware file
/**
* Send depth camera frame to the SLAMWARE system.
*/
void publishDepthCamFrame(
    int sensorId,
    const rpos::message::depth_camera::DepthCameraFrame& frame
);
Name Date type Comments
sensorId int Sensor ID, should be the same with configuration
frame const rpos::message::depth_camera::DepthCameraFrame& Depth camera frame
/**
* Get operation audit log from SLAMWARE system.
*/
std::vector<system_resource::OperationAuditLog> getOperationAuditLogs();  
/**
* Send customized control bus command to the chasis and receives response.
*/
int sendAndRecvUserDefinedCBUSMessage(
    const void * payload,
    const size_t payloadsize,
    void * recvBuffer,
    size_t & recvDataSize
);
/**
* Begin LIDAR auto tweaking process.
*/
system_resource::LidarAutoTweakRequestResult beginLidarAutoTweak();  

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
/**
* Fetch LIDAR auto tweaking status.
*/
system_resource::LidarAutoTweakStatus getLidarAutoTweakStatus();

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
/**
* Accept LIDAR auto tweaking result, and save to LIDAR.
*/
bool acceptLidarTweakResult();  
/**
* Reject LIDAR auto tweaking result, and revert to original settings.
*/
void resetLidarTweakResult();  
/**
* Cancel current auto tweaking process.
*/
void cancelLidarAutoTweak();