本页介绍了go_home_charge的用法, 包含机器人回充命令的使用
本页内容
需要
软件平台
- Visual Studio 2010
- Slamware Windows SDK:Slamware Windows SDK
- RoboStudio:Robostudio installer
- Sample Code:
硬件平台
(以下任选其一)
- Slamware SDP mini
- Slamware SDP
- Slamware 套装 (基于Slamware导航方案的用户机器人系统)
- Zeus/Apollo等底盘系统
编译运行
- 打开samples工程
- 右键go_home_to_charge, 打开属性选项,将Slamware SDK 的include目录和lib目录添加到工程
- 右键go_home_to_charge, 将此工程设置成StartUp project
- 右键go_home_to_charge, 在Debugging页面中command Arguments处输入 192.168.11.1
格式说明:go_home_to_charge <IP address> - 点击F5运行
- 可以连上Robostudio查看地图及机器人的运动
代码描述
代码功能说明: 调用goHome()接口来进行自动回充,如果没有找到充电桩或者充电失败,会重复至多三次调用goHome()
自动回充const int max_go_home_times = 3; SlamwareCorePlatform sdp = SlamwareCorePlatform::connect(argv[1], 1445); std::cout <<"SDK Version: " << sdp.getSDKVersion() << std::endl; std::cout <<"SDP Version: " << sdp.getSDPVersion() << std::endl; int go_home_count = 1; rpos::actions::MoveAction action; do { action = sdp.goHome(); action.waitUntilDone(); if(action.getStatus() == rpos::core::ActionStatusFinished) break; std::cout << "go home to charge times count: " << go_home_count << std::endl; go_home_count++; } while(go_home_count <= max_go_home_times);