rpos::robot_platforms::SlamwareCorePlatform Class

SlamwareCorePlatform denotes a connection to a Slamware-based robot, which can be used to fetch status from the robot and control the robot.

Header File

rpos/robot_platforms/slamware_core_platform.h

Applies to

  • Slamware
  • Mapper (partial)

Base Class

Derived from rpos::core::RobotPlatform

Constructors

/**
* Used only by SDK itself.
*/
SlamwareCorePlatform(boost::shared_ptr<detail::SlamwareCorePlatformImpl> impl);
/**
* Copy constructor.
*/
SlamwareCorePlatform(const SlamwareCorePlatform&);

Operators

/**
* Assignment operator.
*/
SlamwareCorePlatform& operator=(const SlamwareCorePlatform&);

Static Methods

/**
* Connect to specific robot.
*/
static SlamwareCorePlatform connect(
    const std::string& host,
    int port,
    int timeoutInMs = 10000
) throw(ConnectionTimeOutException, ConnectionFailException);
Name Data type Comments
host const std::string& IP address to Slamware-based robot
port int Port to Slamware-based robot
timeoutInMs int Connection timeout (in ms)
Return Value SlamwareCorePlatform Returns SlamwareCorePlatform object on success


Methods

/**
* Disconnect from the robot.
*/
void disconnect();


/**
* Retrieves all rectangle areas of specified usage stored in system.
*/
std::vector <features::artifact_provider::RectangleArea> getRectangleAreas(features::artifact_provider::ArtifactUsage usage);
Name Data type Description
usage features::artifact_provider::ArtifactUsage Specific type of rectangle area.
Return Value std::vector <features::artifact_provider::RectangleArea> Rectangle area obtained.


/**
* Add rectangle area.
*/
bool addRectangleArea(features::artifact_provider::ArtifactUsage usage, const features::artifact_provider::RectangleArea& area);
Name Data type Description
usage features::artifact_provider::ArtifactUsage Specific type of rectangle area.
area const features::artifact_provider::RectangleArea& Rectangle area to add.
Return Value bool true for success, otherwise false.


/**
* Add rectangle areas.
*/
bool addRectangleAreas(features::artifact_provider::ArtifactUsage usage, const std::vector<features::artifact_provider::RectangleArea>& areas);
Name Data type Description
usage features::artifact_provider::ArtifactUsage Specific type of rectangle area.
area const features::artifact_provider::RectangleArea& Rectangle area to add.
Return Value bool true for success, otherwise false.


/**
* Remove rectangle areas.
*/
bool removeRectangleAreaByIds(features::artifact_provider::ArtifactUsage usage, const std::vector<core::SegmentID>& ids);
Name Data type Description
usage features::artifact_provider::ArtifactUsage Specific type of rectangle area.
ids const std::vector<core::SegmentID>& Id to the rectangle area to remove.
Return Value bool true for success, otherwise false.


/**
* Clear all rectangle areas of specified usage.
*/
bool clearRectangleAreas(features::artifact_provider::ArtifactUsage usage); 
Name Data type Description
usage features::artifact_provider::ArtifactUsage Specific type of rectangle area.
Return Value bool true for success, otherwise false.


/**
* Retrieves all the virtual walls and virtual tracks stored in the current SLAMWARE system.
*/
std::vector<core::Line> getLines(features::artifact_provider::ArtifactUsage usage);
Name Data type Comments
usage features::artifact_provider::ArtifactUsage Specifies the type of artifacts
Return Value std::vector<core::Line> Fetched lines


/**
* Add on virtual track or virtual wall object.
*/
bool addLine(features::artifact_provider::ArtifactUsage usage, const core::Line& line);
Name Data type Comments
usage features::artifact_provider::ArtifactUsage Specifies the type of artifacts
line const core::Line& The line to add
Return Value bool true for success, otherwise false


/**
* Add one or more virtual track or virtual wall objects in batch.
*/
bool addLines(features::artifact_provider::ArtifactUsage usage, const std::vector<core::Line>& lines);
Name Data type Comments
usage features::artifact_provider::ArtifactUsage Specifies the type of artifacts
lines const std::vector<core::Line>& Lines to add
Return Value bool true for success, otherwise false


/**
* Remove specified virtual wall or virtual track based on the object id.
*/
bool removeLineById(features::artifact_provider::ArtifactUsage usage, rpos::core::SegmentID id);
Name Data type Comments
usage features::artifact_provider::ArtifactUsage Specifies the type of artifacts
id rpos::core::SegmentID ID to the line to remove
Return Value bool true for successful removal, otherwise false


/**
* Clear all virtual walls or virtual tracks specified by the usage parameter.
*/
bool clearLines(features::artifact_provider::ArtifactUsage usage);
Name Data type Comments
usage features::artifact_provider::ArtifactUsage Specifies the type of artifacts to remove
Return Value bool true for successful removal, otherwise false


/**
* Set artifact object (virtual wall or virtual track) specified by the line object with the same id to a new position. 
*/
bool moveLine(features::artifact_provider::ArtifactUsage usage, const core::Line& line);
Name Data type Comments
usage features::artifact_provider::ArtifactUsage Specifies the type of artifacts to move
line const core::Line& The line to move
Return Value bool true for successful movement, otherwise false


/**
* Set multiple artifact objects (virtual walls or virtual tracks) specified by the line objects with the same ids to new positions.
*/
bool moveLines(features::artifact_provider::ArtifactUsage usage, const std::vector<core::Line>& lines);
Name Data type Comments
usage features::artifact_provider::ArtifactUsage Specifies the type of artifacts to move
lines const std::vector<core::Line>& Lines to move
Return Value bool true for successful movement, otherwise false


/**
* Get all virtual wall objects stored in the SLAMWARE system.
*/
std::vector<core::Line> getWalls();
Name Data type Comments
Return Value std::vector<core::Line> Fetched virtual walls


/**
* Add one virtual wall line.
*/
bool addWall(const core::Line& wall);
Name Data type Comments
wall const core::Line& Virtual wall to add
Return Value bool true for success, otherwise false


/**
* Add one or more virtual walls.
*/
bool addWalls(const std::vector<core::Line>& walls);
Name Data type Comments
walls const std::vector<core::Line>& Virtual walls to add
Return Value bool true for success, otherwise false


/**
* Remove the virtual wall object specified by the id.
*/
bool clearWallById(const core::SegmentID& id);
Name Data type Comments
id const core::SegmentID ID to the virtual wall to remove
Return Value bool true for successful removal, otherwise false


/**
* Clear all virtual wall objects.
*/
bool clearWalls();
Name Data type Comments
Return Value bool true for successful removal, otherwise false


/**
* Obtain discrepancy monitor area stored in system.
*/
std::vector<core::RectangleF> getMapDiscrepancyMonitorAreas();
Name Data type Description
Return Value std::vector<core::RectangleF> Fetched map discrepancy monitor areas.


/**
* Add map discrepancy monitor area.
*/
bool addMapDiscrepancyMonitorArea(const core::RectangleF& area);
Name Data type Description
area const core::RectangleF& map discrepancy monitor area to add.
Return Value bool true for success, otherwise false


/**
* Add map discrepancy monitor area.
*/
bool addMapDiscrepancyMonitorAreas(const std::vector<core::RectangleF>& areas);
Name Data type Description
area const std::vector<core::RectangleF>& map discrepancy monitor area to add.
Return Value bool true for success, otherwise false.


/**
* Remove map discrepancy monitor area.
*/
bool removeMapDiscrepancyMonitorAreas(const std::vector<core::RectangleF>& areas);
Name Data type Description
area const std::vector<core::RectangleF>& map discrepancy monitor area to remove.
Return Value bool true for success, otherwise false.

/**
* Clear map discrepancy monitor area.
*/
bool clearMapDiscrepancyMonitorAreas();
Name Data type Description
Return Value bool true for success, otherwise false.


/**
* Get all available map types.
*/
std::vector<features::location_provider::MapType> getAvailableMaps();
Name Data type Comments
Return Value std::vector<features::location_provider::MapType> Supported map type.


/**
* Get the map data object with the specified map kind and areas.
*/
features::location_provider::Map getMap(features::location_provider::MapType type, core::RectangleF area, features::location_provider::MapKind kind);
Name Data type Comments
type features::location_provider::MapType The type of the map to fetch
area core::RectangleF The area of the map to fetch
kind features::location_provider::MapKind The kind of the map to fetch
Return Value features::location_provider::Map The map object

Example

rpos::feature::location_provider::MapType mapType = rpos::feature::location_provider::MapType::MapTypeBitmap8Bit;
rpos::feature::location_provider::Mapkind mapKind = rpos::feature::location_provider::MapKind::EXPLORERMAP;
rpos::core::Rectangle knownArea = robotPlatform.getKnownArea(mapType, mapKind);
rpos::feature::location_provider::Map map = robotPlatform.getMap(mapType, knownArea, mapKind);


/**
* Upload map data to the SLAMWARE system based on the map kind.
*/
bool setMap(const features::location_provider::Map& map, features::location_provider::MapType type, features::location_provider::MapKind kind, bool partially = false);
Name Data type Comments
map const features::location_provider::Map& The map data
type features::location_provider::MapType The type of the map
kind features::location_provider::MapKind The kind of the map
partially bool Partially update or replace the whole map
Return Value bool true for successful upload, otherwise false

Example

rpos::feature::location_provider::MapType mapType = rpos::feature::location_provider::MapType::MapTypeBitmap8Bit;
rpos::feature::location_provider::Mapkind mapKind = rpos::feature::location_provider::MapKind::EXPLORERMAP;
rpos::core::Rectangle knownArea = robotPlatform.getKnownArea(mapType, mapKind);
rpos::feature::location_provider::Map map = robotPlatform.getMap(mapType, knownArea, mapKind);
bool bRet = robotPlatform.setMap(map, mapType, mapKind);


/**
* Upload map data along with the robot pose to the SLAMWARE system based on the map kind.
*/
bool setMapAndPose(const core::Pose& pose, const features::location_provider::Map& map, features::location_provider::MapType type, features::location_provider::MapKind kind, bool partially = false);
Name Data type Comments
pose const core::Pose& The robot pose
map const features::location_provider::Map& The map data
type features::location_provider::MapType The type of the map
kind features::location_provider::MapKind The kind of the map
partially bool Partially update or replace the whole map
Return Value bool true for successful upload, otherwise false

Example

rpos::core::Pose pose;
rpos::feature::location_provider::MapType mapType = rpos::feature::location_provider::MapType::MapTypeBitmap8Bit;
rpos::feature::location_provider::Mapkind mapKind = rpos::feature::location_provider::MapKind::EXPLORERMAP;
rpos::core::Rectangle knownArea = robotPlatform.getKnownArea(mapType, mapKind);
rpos::feature::location_provider::Map map = robotPlatform.getMap(mapType, knownArea, mapKind);
bool bRet = robotPlatform.setMapAndPose(pose, map, mapType, mapKind);


/**
* Retrieve the explored(mapped) area of the current map. 
*/
core::RectangleF getKnownArea(features::location_provider::MapType type, features::location_provider::MapKind kind);
Name Data type Comments
type features::location_provider::MapType The type of the map
kind features::location_provider::MapKind The kind of the map
Return Value core::RectangleF Explored area of the map

Example

rpos::feature::location_provider::MapType mapType = rpos::feature::location_provider::MapType::MapTypeBitmap8Bit;
rpos::feature::location_provider::Mapkind mapKind = rpos::feature::location_provider::MapKind::EXPLORERMAP;
rpos::core::RectangleF knownArea = robotPlatform.getKnownArea(mapType, mapKind);


/**
* Clear all map data inside the SLAMWARE system.
*/
bool clearMap();
Name Data type Comments
Return Value bool true for success, otherwise false


/**
* Clear the specified map data inside the SLAMWARE system.
*/
bool clearMap(features::location_provider::MapKind kind);
Name Data type Comments
kind features::location_provider::MapKind The kind of the map
Return Value bool true for success, otherwise false


/**
* Get the robot location calcuated by the SLAMWARE System.
*/
core::Location getLocation();
Name Data type Comments
Return Value core::Location The location of the robot in current map


/**
* Get the robot pose calcuated by the SLAMWARE System.
*/
core::Pose getPose();
Name Data type Comments
Return Value core::Pose The pose of the robot in current map


/**
* Upload and set the robot pose to the SLAMWARE System.
*/
bool setPose(const core::Pose& pose);
Name Data type Comments
pose const core::Pose& The pose to set for the robot
Return Value bool true for success, otherwise false


/**
* Check whether the localization system is enabled in the SLAMWARE system. 
* Deadreck data will be used once localization system is disabled.
*/
bool getMapLocalization();
Name Data type Comments
Return Value bool true for localization system is enabled, otherwise false


/**
* Set the SLAMWARE system to enable or disable the localization system.
* Deadreck data will be used once localization system is disabled.
*/
bool setMapLocalization(bool localization);
Name Data type Comments
localization bool Enable or disable localization system
Return Value bool true for success, otherwise false


/**
* Check wehther SLAMWARE system will perform map update to the specified map kind.
* SLAMWARE system enters localization enhanced mode once map update is disabled.
*/
bool getMapUpdate(rpos::features::location_provider::MapKind kind = rpos::features::location_provider::EXPLORERMAP);
Name Data type Comments
kind rpos::features::location_provider::MapKind The kind of the map
Return Value bool true for map update is enabled, otherwise false


/**
* Set whether SLAMWARE system will perform map update to the specified map kind. 
* SLAMWARE system enters localization enhanced mode once map update is disabled.
*/
bool setMapUpdate(bool update, rpos::features::location_provider::MapKind kind = rpos::features::location_provider::EXPLORERMAP);
Name Data type Comments
update bool Enable or disable map update
kind rpos::features::location_provider::MapKind The kind of the map
Return Value bool true for success, otherwise false


/**
* Get the localization quality indication value of the current pose.
*/
int getLocalizationQuality();
Name Data type Comments
Return Value int Localization quality indicator


/**
* Get the Aux localization data (require external module support).
*/
features::location_provider::PointPDF getAuxLocation();
Name Data type Comments
Return Value features::location_provider::PointPDF Location detected via aux localization provider


/**
* Get the charging base (dock) pose base on the current explorer map.
*/
bool getHomePose(core::Pose& pose);
Name Data type Comments
pose core::Pose& The pose of the charging base
Return Value bool true for successful and has a registered charging base, otherwise false


/**
* Set the charging base (dock) pose base on the current explorer map.
*/
bool setHomePose(core::Pose pose);
Name Data type Comments
pose core::Pose The pose of the charging base to set
Return Value bool true for success, otherwise false


/**
* Get the Aux localization beacon status (require external module support).
*/
features::location_provider::AuxLocalizationStatus getAuxLocalizationStatus(features::location_provider::AuxLocalizationSource source);
Name Data type Comments
source features::location_provider::AuxLocalizationSource The source of aux location provider
Return Value features::location_provider::AuxLocalizationStatus Status of the specified location provider

/**
* Get the imu data of robot.
*/
bool getImuInRobotCoordinate(rpos::core::Imu& imu)
Name Data type Comments
Imu core:Imu The imu data of robot
Return Value bool true for succes, otherwise false


Motion Planning Methods (only applies to Slamware)

/**
* Requires the robot to move to a set of key points (milestone) specified by the parameters. 
* The robot will try its best to reach each points specified. In case of obstacles occurs, the robot will avoid hitting them by planning a valid  path.
*/
actions::MoveAction moveTo(
    const std::vector<core::Location>& locations,
    bool appending
);
Name Data type Comments
locations const std::vector<core::Location>& Points collection that the robot should reach
appending bool Once set to true, a current working action (if any) won't get aborted and the key points specified by the function will be pending to the task queue.
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Requires the robot to move to a key point (milestone) specified by the parameters.
* The robot will try its best to reach the point specified. In case of obstacles occurs, the robot will avoid hitting them by planning a valid path.
*/
actions::MoveAction moveTo(
    const core::Location& location,
    bool appending
);
Name Data type Comments
location const core::Location& Point that the robot should reach
appending bool nce set to true, a current working action (if any) won't get aborted and the key points specified by the function will be pending to the task queue.
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Requires the robot to move to a set of key points (milestone) specified by the parameters and turn to a specified heading. 
* The robot will try its best to reach each points specified. In case of obstacles occurs, the robot will avoid hitting them by planning a valid  path.
*/
actions::MoveAction moveTo(
    const std::vector<rpos::core::Location>& locations,
    const features::motion_planner::MoveOptions& options
);
Name Data type Comments
locations const std::vector<rpos::core::Location>& Points collection that the robot should reach
options features::motion_planner::MoveOptions& Motion Options
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Requires the robot to move to a key point (milestone) specified by the parameters and turn to a specified heading in the end of the action. 
* The robot will try its best to reach the point specified. In case of obstacles occurs, the robot will avoid hitting them by planning a valid path.
*/
actions::MoveAction moveTo(
    const core::Location& location,
    const features::motion_planner::MoveOptions& options
);
Name Data type Comments
location const core::Location& Point that the robot should reach
options features::motion_planner::MoveOptions& Motion Options
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Make the robot move along with the specified direction. No obstle avoidance or path planning will be performed.
*/
actions::MoveAction moveBy(const core::Direction& direction);
Name Data type Comments
direction const core::Direction& The direction to move towards
Return Value actions::MoveAction A MoveAction object refer to the navigation task

Example

rpos::core::ACTION_DIRECTION actionDirection = rpos::core::ACTION_DIRECTION::FORWARD;
rpos::core::Direction direction(actionDirection);
rpos::actions::MoveAction moveBy = platform.moveBy(direction);


/**
* Make the robot move along with the specified direction. 
*/
actions::MoveAction moveBy(
    const core::Direction& direction,
    const features::motion_planner::MoveOptions& options
);
Name Data type Comments
direction const core::Direction& The direction to move towards
options features::motion_planner::MoveOptions& Unsupported yet
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Make the robot move with a turning angle theta.
*/
actions::MoveAction moveBy(
    float theta,
    const features::motion_planner::MoveOptions& options
);
Name Data type Comments
theta float The turning angle
options features::motion_planner::MoveOptions& Unsupported yet
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Make the robot turn to the specified heading.
*/
actions::MoveAction rotateTo(const core::Rotation& orientation);
Name Data type Comments
orientation const core::Rotation& Required heading
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Make the robot turn to the specified heading.
*/
actions::MoveAction rotateTo(
    const core::Rotation& orientation,
    const features::motion_planner::MoveOptions& options
);
Name Data type Comments
orientation const core::Rotation& Required heading
options features::motions_planner::MoveOptions& Unsupported yet
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Make the robot turn by the specified angle.
*/
actions::MoveAction rotate(const core::Rotation& rotation);
Name Data type Comments
orientation const core::Rotation& Required turning angle
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Make the robot turn by the specified angle.
*/
actions::MoveAction rotate(
    const core::Rotation& rotation,
    const features::motion_planner::MoveOptions& options
);
Name Data type Comments
orientation const core::Rotation& Required turning angle
options features::motions_planner::MoveOptions& Unsupported yet
Return Value actions::MoveAction A MoveAction object refer to the navigation task


/**
* Require the robot to perform self relocalization to recover it post on the map. The robot will move.
*/
actions::MoveAction recoverLocalization(
    const core::RectangleF& area,
    const features::motion_planner::RecoverLocalizationOptions& options=features::motion_planner::RecoverLocalizationOptions()
);
Name Data type Comments
area const core::Rectangle& The search area for relocalization
options features::motion_planner::RecoverLocalizationOptions& Extra options to relocalization
Return Value actions::MoveAction A MoveAction object refer to the relocalization task


/**
* Use dock station to perform self relocalization.
*/
actions::MoveAction recoverLocalizationByDock();


/**
* Create an action to control robot by velocity command.
*/
rpos::actions::VelocityControlMoveAction velocityControl(rpos::features::motion_planner::VelocityControlFlag flag = rpos::features::motion_planner::MonitoredByLocalizationQuality);
Name Data type Description
VelocityControlFlag MonitoredByLocalizationQuality Monitored by localization quality monitor,can't control robot when in lowlocalization status
NotMonitored NotMonitored by low localization quality
Return Value actions::VelocityControlMoveAction A MoveAction object refer to the velocity control task


/**
* Retrieve the current action of the robot. If the Action::isEmpty() of the returned object is false, there is no action working at all.
*/
actions::MoveAction getCurrentAction();
Name Data type Comments
Return Value actions::MoveAction A MoveAction object refer to current navigation or relocalization task


/**
* Require the SLAMWARE system to find a path to the destination specified by the parameter. The path found will be returned.
*/
features::motion_planner::Path searchPath(const core::Location& location);
Name Data type Comments
location const core::Location& Goal
Return Value features::motion_planner::Path Searched path


/**
* get all supported motion strategies.
* motion strategy contains a series of configuration items that affect machine behavior.
*/
std::vector<std::string> enumSupportedMotionStrategies();   


/**
* set a motion strategy to robot
*/
bool setMotionStrategy(const std::string& strategy);   


/**
* get current motion strategy
*/
std::string getCurrentMotionStrategy();   


/**
* Require the SLAMWARE system to navigate to and dock to charge station.
*/
actions::MoveAction goHome(rpos::features::motion_planner::GoHomeFlag flag = rpos::features::motion_planner::Dock);
Name Data type Description
GoHomeFlag Dock Go to home dock.
NoDock Go to position before home dock.
Return Value actions::MoveAction A MoveAction object refer to the go home task


System Resource Methods

/**
* Get remaining battery in percentage. (56 for 56%).
*/
int getBatteryPercentage();
Name Data type Comments
Return Value int Remaining battery in percentage


/**
* Get if the battery is charging. 
*/
bool getBatteryIsCharging();
Name Data type Comments
Return Value bool true for charging, false for not charging


/**
* Get if the power outlet is connected to the robot. 
*/
bool getDCIsConnected();
Name Data type Comments
Return Value bool true for power outlet connected, otherwise false


/**
* Get composed power status. 
*/
features::system_resource::PowerStatus getPowerStatus(); 
Name Data type Comments
Return Value features::system_resource::PowerStatus Power status

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


/**
* Get the temperature of the mother board, unit: 0.1℃. 
*/
int getBoardTemperature();
Name Data type Comments
Return Value int Temperature of the mother board, unit: 0.1℃(452 for 45.2℃)


/**
* Upload binary config. 
*/
bool updateBinaryConfig(const Json::Value& jsnCfg);
Name Data type Comments
jsnCfg const Json::Value& The new binary config to upload
Return Value bool true for success, otherwise false


/**
* Get device info. 
*/
features::system_resource::DeviceInfo getDeviceInfo();
Name Data type Comments
Return Value features::system_resource::DeviceInfo Device information

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


/**
* 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
);
Name Data type Comments
payload const void* Pointer to the payload to send
payloadsize const size_t Size of the payload to send
recvBuffer void* Pointer to the receive buffer
recvDataSize size_t& Size of the receive buffer
Return Value int Return result of the command operation


/**
* Start firmware upgrade with specific firmware file. 
*/
void startFirmwareUpgrade(const std::string& filename);
Name Data type Comments
filename const std::string& The path to the firmware file


/**
* Wake up the robot from hibernation.
*/
void wakeUp();


/**
* hibernate the robot.
*/
void hibernate();


/**
* Get the software version of SLAMWARE system. 
*/
std::string getSDPVersion();
Name Data type Comments
Return Value std::string The software version of SLAMWARE system


/**
* Get the version of the SDK.
*/
std::string getSDKVersion();
Name Data type Comments
Return Value std::string The version of the SDK


/**
* Get raw scan data. 
*/
features::system_resource::LaserScan getLaserScan();
Name Data type Comments
Return Value features::system_resource::LaserScan The raw LIDAR scan

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


/**
* Restart the SLAMWARE system in specified mode.
*/
bool restartModule(features::system_resource::RestartMode mode = features::system_resource::RestartModeSoft);
Name Data type Comments
mode features::system_resource::RestartMode Restart mode
Return Value bool true for successful restart requests, false for invalid request or status


/**
* 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
Return Value bool true for success, otherwise `false

Example

Bool bRet = platform.setSystemParameter(SYSPARAM_ROBOT_SPEED, SYSVAL_ROBOT_SPEED_HIGH);


/**
* Get current value of system parameter.
*/
std::string getSystemParameter(const std::string& param);
Name Data type Comments
param const std::string& The key to the system parameter, see following table for details
Return Value std::string Current value of the parameter

Please refer to setSystemParameter for available values to param.

Example

std::string robotSpeed = platform.getSystemParameter(SYSPARAM_ROBOT_SPEED);


/**
* 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);
Name Data type Comments
cfgFilePath const std::string& File path of the new cube config to upload
Return Value bool true for success, otherwise false
/**
* 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.
Return Value bool true for success, otherwise false


/**
*  Get robot health infomation.
*/
features::system_resource::BaseHealthInfo getRobotHealth();
Name Data type Comments
Return Value features::system_resource::BaseHealthInfo Robot health info

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


/**
* Clear specific health error code.
*/
void clearRobotHealth(int errorCode);
Name Data type Comments
errorCode int The error code to clear


/**
* Configure robot network mode.
*/
bool configurateNetwork(
    features::system_resource::NetworkMode mode,
    const std::map<std::string, std::string>& options
);
Name Data type Comments
mode features::system_resource::NetworkMode Network mode
options const std::map<std::string, std::string>& Network mode options
Return Value bool true for success, otherwise false

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::NetworkMode::NetworkModeStation,options);


/**
* Get current wireless configuration.
*/
std::map<std::string, std::string> getNetworkStatus();

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

Name Data type Comments
Return Value std::map<std::string, std::string> Network configuration


/**
* 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.
*/
features::system_resource::HeartBeatToken startHeartBeat(int heartBeatTimeoutInSeconds);
Name Data type Comments
heartBeatTimeoutInSeconds int Heartbeat timeout in seconds
Return Value features::system_resource::HeartBeatToken Heart beat 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.
*/
void refreshHeartBeat(features::system_resource::HeartBeatToken token);
Name Data type Comments
token features::system_resource::HeartBeatToken Token returned by startHeartBeat(int)


/**
* Stop heart beat function.
*/
void stopHeartBeat(features::system_resource::HeartBeatToken token);
Name Data type Comments
token features::system_resource::HeartBeatToken Token returned by startHeartBeat(int)


/**
* Send depth camera frame to the SLAMWARE system.
*/
void publishDepthCamFrame(
    int sensorId,
    const rpos::message::depth_camera::DepthCameraFrame& frame
);
Name Data type Comments
sensorId int Sensor ID, should be the same with configuration
frame const rpos::message::depth_camera::DepthCameraFrame& Depth camera frame


/**
*Send depth camera frame to the SLAMWARE system
*/
void publishDepthCamFrame(const rpos::features::location_provider::BitmapMap& obstacle);
Name Data type Comments
obstacle const rpos::features::location_provider::BitmapMap& Depth camera obstacle frame
BitmapMap description:


/**
* Get operation audit log from SLAMWARE system.
*/
std::vector<features::system_resource::OperationAuditLog> getOperationAuditLogs();
Name Data type Comments
Return Value std::vector<features::system_resource::OperationAuditLog> Audit log


LIDAR Tweaking Methods (only applies to Slamware)

/**
* Begin LIDAR auto tweaking process.
*/
rpos::features::system_resource::LidarAutoTweakRequestResult beginLidarAutoTweak();
Name Data type Comments
Return Value rpos::features::system_resource::LidarAutoTweakRequestResult Return value


/**
* Fetch LIDAR auto tweaking status.
*/
rpos::features::system_resource::LidarAutoTweakStatus getLidarAutoTweakStatus();
Name Data type Comments
Return Value rpos::features::system_resource::LidarAutoTweakStatus Return value


/**
* Accept LIDAR auto tweaking result, and save to LIDAR.
*/
bool acceptLidarTweakResult();
Name Data type Comments
Return Value bool true for success, otherwise false


/**
* Reject LIDAR auto tweaking result, and revert to original settings.
*/
void resetLidarTweakResult();


/**
* Cancel current auto tweaking process.
*/
void cancelLidarAutoTweak();


/**
* Get sensor list. 
*/
bool getSensors(std::vector<features::impact_sensor::ImpactSensorInfo>& sensors);
Name Data type Comments
sensors std::vector<features::impact_sensor::ImpactSensorInfo&> Sensor information
Return Value bool true for success, otherwise false


/**
* Fetch all sensor's values. 
*/
bool getSensorValues(
    std::map<
        features::impact_sensor::impact_sensor_id_t,
        features::impact_sensor::ImpactSensorValue
    >& values
);
Name Data type Comments
values std::map<features::impact_sensor::impact_sensor_id_t, features::impact_sensor::ImpactSensorValue>& Sensor value map
Return Value bool true for success, otherwise false

Notes: features::impact_sensor::ImpactSensorValue's struct is as follows:

struct ImpactSensorValue {
    impact_sensor_timestamp_t time;
    float value;
};


/**
* Fetch specified sensors' value. 
*/
bool getSensorValues(
    const std::vector<features::impact_sensor::impact_sensor_id_t>& sensorIds,
    std::vector<features::impact_sensor::ImpactSensorValue>& values
);
Name Data type Comments
sensorIds const std::vector<features::impact_sensor::impact_sensor_id_t>& IDs of the sensors to fetch
values std::vector<features::impact_sensor::ImpactSensorValue>& Sensor values
Return Value bool true for success, otherwise false


/**
* Fetch specific sensor's value. 
*/
bool getSensorValue(
    features::impact_sensor::impact_sensor_id_t sensorId,
    features::impact_sensor::ImpactSensorValue& value
);
Name Data type Comments
sensorId features::impact_sensor::impact_sensor_id_t ID of the sensor to fetch
values features::impact_sensor::ImpactSensorValue& Sensor value
Return Value bool true for success, otherwise false


/**
* Get firmware update info. 
*/
detail::objects::UpdateInfo getUpdateInfo();
Name Data type Comments
Return Value detail::objects::UpdateInfo Firmware update info


/**
* Request a firmware update. 
*/
bool startFirmwareUpdate();
Name Data type Comments
Return Value bool true for success, otherwise false


/**
* Get firmware update progress. 
*/
detail::objects::UpdateProgress getFirmwareUpdateProgress();
Name Data type Comments
Return Value detail::objects::UpdateProgress Firmware update progress


Composite Map Operations

/**
* Fetch composite map from SLAMWARE system.
*/
robot_platforms::objects::CompositeMap getCompositeMap();
Name Data type Comments
Return Value robot_platforms::objects::CompositeMap Fetched map


/**
* Replace robot maps and pose with composite map and pose.
*/
void setCompositeMap(const robot_platforms::objects::CompositeMap& map, const core::Pose& pose);
Name Data type Comments
map const robot_platforms::objects::CompositeMap& The composite map
pose const core::Pose& The pose of the robot

Example

auto pose = platform.getPose();

rpos::robot_platforms::objects::Metadata metadata;
std::vector< boost::shared_ptr<rpos::robot_platforms::objects::MapLayer> > maps;

auto map_layer_v_walls = boost::make_shared<rpos::robot_platforms::objects::LineMapLayer>();
maps.push_back(map_layer_v_walls);
map_layer_v_walls->setUsage("virtual_walls");
map_layer_v_walls->setType(rpos::robot_platforms::objects::LineMapLayer::Type);
rpos::robot_platforms::objects::Line line(Point(0, 0), Point(10, 10));
line.name = "1";
map_layer_v_walls->lines()[line.name] = line;

rpos::robot_platforms::objects::CompositeMap compositeMap(metadata, maps);
platform. setCompositeMap (compositeMap, pose);


Statistics Methods (only applies to Slamware)

/**
* Get odometry value.
*/
double getOdometry();
Name Data type Comments
Return Value double In meters


/**
* Get system run time (in seconds).
*/
double getSystemRunningTime();
Name Data type Comments
Return Value double System runtime in seconds


System Event Provider

/*
* Get a SystemEventProvider  to read event from slamware  
【Notice】Do not call this function frequently,  hold the shared pointer  
*/
boost::shared_ptr<robot_platforms::objects::SystemEventProvider> createSystemEventProvider(int timeoutInSeconds = 30)

Example

auto eventProvider = createSystemEventProvider();
while(true)
{
    std::vector<rpos::core::DiagnosisInfoInternalSystemEvent> events;
    if(eventProvider->readEvents(events))
    {
        //handle the system event
        for (auto it = events.begin(); it != events.end(); ++it)
        {
            printf("event:%d",(*it).internalSystemEvent);
        }
    }
    //read every 500 milliseconds 
    boost::this_thread::sleep_for(boost::chrono::milliseconds(500)); 
}