|
AGVC SDK API
0.7.0
|
|
|
|
RPC客户端 更多...
#include <rpc.h>


Public 类型 | |
| enum | Event { Connected , Disconnected } |
Public 成员函数 | |
| RpcClient (int mode=0) | |
| RpcClient | |
| ~RpcClient () | |
| void | setLogHandler (std::function< void(int, const char *, int, const std::string &)> handler) |
| 设置日志处理器 | |
| int | connect (const std::string &ip="", int port=0) |
| 连接到RPC服务 | |
| int | disconnect () |
| 断开RPC连接 | |
| bool | hasConnected () const |
| 判断是否连接RPC | |
| int | login (const std::string &usrname, const std::string &passwd) |
| 登录 | |
| int | logout () |
| 登出 | |
| bool | hasLogined () |
| 判断是否登录 | |
| int | setRequestTimeout (int timeout=10) |
| 设置RPC请求超时时间 | |
| int | setEventHandler (std::function< void(int)> cb) |
| 设置事件处理 | |
| int | setExceptionFree (bool enable) |
| 是否关闭异常抛出 | |
| int | errorCode () const |
| 返回错误代码 | |
| Public 成员函数 继承自 agvc_interface::AgvcInterface | |
| AgvcInterface () | |
| virtual | ~AgvcInterface () |
| int | setSystemClock (const std::string &stamp) |
| 设置agv系统时间 | |
| AgvDetails | getAgvDetails () |
| 查询当前agv信息 | |
| RunningInfo | getRunningInfo () |
| 查询当前agv运行信息 | |
| Pose2d | getAgvCurrentPose () |
| 查询agv当前位姿 | |
| std::vector< Point2d > | getLaserPointCloud () |
| 查询当前激光点云数据 | |
| AsyncInterfaceResultStatus | getAsyncInterfaceResultStatus () |
| 查询异步接口的运行情况,不代表异步接口本身的运行结果 | |
| std::vector< StationMark > | getAllStations () |
| 查询当前地图的所有站点信息 | |
| std::vector< StationMark > | getAllStationsOfTargetMap (const Header &map_header) |
| 查询指定地图的所有站点信息 | |
| int | addStation (const StationMark &station) |
| 添加/修改一个站点 | |
| int | addStations (const std::vector< StationMark > &stations) |
| 添加/修改多个站点 | |
| int | addCPStationUseChargingBoard (const Header &station_header, const double &dis_station_board=1.5) |
| 通过自动识别充电桩位姿来添加充电站点 | |
| int | deleteStation (const Header &station_header) |
| 删除指定站点(会删除与该站点相关的路径) | |
| int | deleteStations (const std::vector< Header > &stations_header) |
| 删除多个站点(会删除与站点相关的路径) | |
| std::vector< PathStation > | getAllPaths () |
| 查询当前地图的所有路径信息 | |
| std::vector< PathStation > | getAllPathsOfTargetMap (const Header &map_header) |
| 查询指定地图的所有路径信息 | |
| PathStation | getCurrentPath () |
| 查询agv当前正在跟踪的路径信息 | |
| int | generatePath (const PathStation &path_station) |
| 生成/修改一条路径 | |
| int | generatePaths (const std::vector< PathStation > &paths_station) |
| 生成/修改多条路径 | |
| int | deletePath (const Header &path_header) |
| 删除一条路径 | |
| int | deletePaths (const std::vector< Header > &paths_header) |
| 删除多条路径 | |
| std::vector< Header > | getMapList () |
| 获取agv所有地图的信息头 | |
| Header | getCurrentMapHeader () |
| 查询当前agv地图的信息头 | |
| OccupancyGridMap | getGridMapFromAgv (const Header &map_header) |
| 获取指定栅格地图信息 | |
| Base64PngMap | getBase64PngMapFromAgv (const Header &map_header) |
| 获取Base64编码的png地图信息 | |
| Base64PngMap | previewPngMapFromAgv (const Header &map_header, const int &image_width_px=0, const int &image_height_px=0) |
| 获取预览图,可指定预览图的长和宽 | |
| int | sendGridMapToAgv (const OccupancyGridMap &map) |
| 将栅格地图信息发送给agv | |
| int | sendBase64PngMapToAgv (const Base64PngMap &map) |
| 将Base64编码的Png地图发送给agv | |
| int | saveMap (const Header &map_header) |
| 建图完成后,调用该接口保存地图 | |
| int | switchMap (const Header &map_header) |
| 切换指定地图 | |
| int | deleteMap (const Header &map_header) |
| 删除一张指定地图 | |
| int | deleteMaps (const std::vector< Header > &map_headers) |
| 删除多张指定地图 | |
| std::vector< MapVirtualArea > | getAllMapVirtualArea () |
| 查询当前地图的虚拟区域 | |
| std::vector< MapVirtualArea > | getAllMapVirtualAreaOfTargetMap (const Header &map_header) |
| 查询目标地图的虚拟区域 | |
| int | addMapVirtualArea (const MapVirtualArea &map_virtual_area) |
| 添加/修改一个虚拟区域 | |
| int | addMapVirtualAreas (const std::vector< MapVirtualArea > &map_virtual_areas) |
| 添加/修改多个虚拟区域 | |
| int | deleteMapVirtualArea (const Header &virtual_area_header) |
| 删除指定虚拟区域 | |
| int | deleteMapVirtualAreas (const std::vector< Header > &virtual_areas_header) |
| 删除多个指定虚拟区域 | |
| MapAllInfo | getGridMapAllInfo (const Header &map_header) |
| 获取指定地图的栅格地图数据、路径、站点、虚拟区信息 | |
| MapAllInfo | getPngMapAllInfo (const Header &map_header) |
| 获取指定地图的Base64地图数据、路径、站点、虚拟区信息 | |
| int | setGridMapAllInfo (const MapAllInfo &map_all_info, const Header &command_header={ "99999", "99999", 1, "99999" }) |
| 设置栅格地图、路径、站点、虚拟区信息 | |
| int | setPngMapAllInfo (const MapAllInfo &map_all_info, const Header &command_header={ "99999", "99999", 1, "99999" }) |
| 设置Base64格式地图、路径、站点、虚拟区信息 | |
| int | deleteMapAllInfo (const Header &map_header) |
| 删除指定地图的全部信息(地图数据、站点、路径、虚拟区信息) | |
| std::vector< std::string > | getWifiList () |
| 获取当前扫描到的WiFi列表 | |
| int | connectWifi (const std::string &ssid, const std::string &password) |
| 连接到指定WiFi(自动切换到WiFi模式) | |
| int | enableHotspot (const std::string &password) |
| 开启热点(自动切换到热点模式) | |
| std::vector< IpAddressInfo > | getIpAddressList () |
| 获取本机所有IP地址 | |
| int | changeRunningMode (const RunningMode &running_mode, const Header &command_header={ "99999", "99999", 1, "99999" }) |
| : 切换agv模式 | |
| int | setControlSpeed (const Speed &speed) |
| 控制agv运动 | |
| int | setNavGoal (const NavGoalType &target) |
| 向agv发送导航任务 | |
| NavInfo | getNavInfo () |
| 获取当前导航信息 | |
| int | pauseAgvSpeed () |
| 暂停agv速度 | |
| int | resumeAgvSpeed () |
| 暂停后,恢复agv速度 | |
| int | cancelNavigation () |
| 取消导航任务 | |
| int | relocation (const Pose2d &init_pose, const Header &command_header={ "99999", "99999", 1, "99999" }) |
| agv重定位 | |
| std::string | getAgvControllerParametersFile () |
| 获取agv控制器的参数文件 | |
| int | setAgvControllerParametersFile (const std::string &agv_parameters) |
| 设置agv控制器的参数文件 | |
| int | refreshAgvControllerParametersFile () |
| 修改agv控制器的参数文件后,让agv各节点刷新参数 | |
| int | resetAgvControllerParametersFile () |
| 将agv控制器的参数文件恢复出厂设置 | |
| int | checkPowerAndAutoCharge (const Header &check_power_header={ "99999", "99999", 99999, "99999" }, const std::string &nav_board_charge_station_id="99999") |
| 检测当前电量,电量低将自动上桩充电 | |
| int | setLeaveBoardTargetStation (const Header &leave_board_target_station_header) |
| 设置自动下桩时的目标站点 | |
| Header | getLeaveBoardTargetStation () |
| 获取自动下桩时的目标站点 | |
| int | forcedAgvToChargingBoard (const Header &forced_charge_header={ "99999", "99999", 99999, "99999" }, const std::string &nav_board_charge_station_id="99999") |
| 强制上桩充电 | |
| int | forcedAgvLeaveChargingBoard (const Header &forced_leave_header={ "99999", "99999", 99999, "99999" }, const std::string &leave_board_target_station_id="99999") |
| 强制下桩 | |
| int | sendAutoChargingCommand (const AutoChargingCommand &auto_charging_command) |
| 下发自动充电命令 | |
| std::string | getAgvLogMessage () |
| 获取agv运行中的日志信息 | |
| int | updateSoftware (const std::string &upgrade_pack_path) |
| agv软件升级 | |
| std::vector< std::string > | getSoftwareVersionList () |
| 获取agv软件版本列表 | |
| int | switchSoftwareVersion (const std::string &software_version) |
| 切换agv软件版本 | |
| int | uninstallSoftware (const std::string &software_version) |
| 卸载agv软件版本 | |
| int | updateFirmware (const FirmwareUpdateParam &update_firmware) |
| agv固件更新 | |
| FirmwareUpdateProcessInfo | getUpdateFirmwareProcess () |
| 获取固件更新过程信息 | |
| int | startCollectCalibrationData (const CalibrationType &type, const Header &command_header={ "99999", "99999", 1, "99999" }) |
| 开始采集数据 | |
| int | cancelCollectCalibrationData (const CalibrationType &type, const Header &command_header={ "99999", "99999", 1, "99999" }) |
| 取消采集数据 | |
| int | startCalibration (const CalibrationType &type, const Header &command_header={ "99999", "99999", 1, "99999" }) |
| 开始标定 | |
| CalibrationProcessInfo | getCalibrationProcessInfo (const CalibrationType &type) |
| 获取标定信息 | |
| int | restartAgv () |
| 重启agv | |
| int | setAgvName (const std::string &agv_name) |
| 设置agv的名称 | |
| int | setPriority (const std::string &name, const std::string &ip="") |
| 控制权设置 | |
| int | releasePriority () |
| 释放控制权 | |
| int | scriptPaused () |
| 暂停脚本 | |
| int | scriptResume () |
| 脚本恢复 | |
| int | scriptStop () |
| 脚本停止权 | |
| ScriptRuntimeState | getScriptStatus () |
| 获取脚本运行状态 | |
| int | setScriptStatus (ScriptRuntimeState status) |
| 设置脚本运行状态 | |
| std::string | errorCodeDecoder (const int &error_code) |
| 错误码查询 | |
| std::vector< Header > | getCurrentErrorCodes () |
| 获取当前的错误码 | |
| int | soundLightPrompt () |
| 寻找agv,自动播放语音并特殊灯光闪烁 | |
| bool | isObstacleAhead (const double &detect_distance=1.0) |
| agv行进方向是否有障碍物 | |
| StationMark | getNearestStation (const double &detect_distance=1.0) |
| 获取指定检测距离范围内的最近站点信息 | |
| agvc_interface::RpcClient::RpcClient | ( | int | mode = 0 | ) |
| mode | 0-TCP 1-UDS |
| agvc_interface::RpcClient::~RpcClient | ( | ) |
| int agvc_interface::RpcClient::connect | ( | const std::string & | ip = "", |
| int | port = 0 ) |
连接到RPC服务
| ip | IP地址 |
| port | 端口号,RPC的端口号是30104 |
| ip和port为空时,采用unix | domain sockets通讯方式 |
| 0 | RPC连接成功 |
| -8 | RPC连接失败,RPC连接被拒绝 |
| -15 | RPC连接失败,SDK版本与Server版本不兼容 |
| int agvc_interface::RpcClient::disconnect | ( | ) |
断开RPC连接
| 0 | 成功 |
| -1 | 失败 |
| int agvc_interface::RpcClient::errorCode | ( | ) | const |
返回错误代码
| bool agvc_interface::RpcClient::hasConnected | ( | ) | const |
判断是否连接RPC
| true | 已连接RPC |
| false | 未连接RPC |
| bool agvc_interface::RpcClient::hasLogined | ( | ) |
判断是否登录
| true | 已登录 |
| false | 未登录 |
| int agvc_interface::RpcClient::login | ( | const std::string & | usrname, |
| const std::string & | passwd ) |
登录
| usrname | 用户名 |
| passwd | 密码 |
| int agvc_interface::RpcClient::logout | ( | ) |
登出
| int agvc_interface::RpcClient::setEventHandler | ( | std::function< void(int)> | cb | ) |
设置事件处理
| cb |
| int agvc_interface::RpcClient::setExceptionFree | ( | bool | enable | ) |
是否关闭异常抛出
| enable |
| void agvc_interface::RpcClient::setLogHandler | ( | std::function< void(int, const char *, int, const std::string &)> | handler | ) |
设置日志处理器
此函数可设置自定义的日志处理函数来处理日志消息。
Agvc SDK 有一套默认的日志系统,按照默认的格式输出到默认的文件。 如果用户不希望采用默认的格式或者不希望输出到默认的文件,那就可以通过这个接口重新自定义格式,或者输出路径。 这个函数可以将用户自定义的日志系统与 Agvc SDK 默认的日志系统合并。
| handler | 日志处理函数 此日志处理函数的下定义如下: void handler(int level, const char* filename, int line, const std::string& message) level 表示日志等级 0: LOGLEVEL_FATAL 严重的错误 1: LOGLEVEL_ERROR 错误 2: LOGLEVEL_WARNING 警告 3: LOGLEVEL_INFO 通知 4: LOGLEVEL_DEBUG 调试 5: LOGLEVEL_BACKTRACE 跟踪 filename 表示文件名 line 表示代码行号 message 表示日志信息 |
| int agvc_interface::RpcClient::setRequestTimeout | ( | int | timeout = 10 | ) |
设置RPC请求超时时间
| timeout | 请求超时时间,单位 ms |