Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. 在sample code所在文件夹中,打开 samples.sln
  2. 右键move_to_spot, 打开属性选项,将Slamware SDK 的include目录和lib目录添加到工程
  3. 右键move_to_spot, 将此工程设置成StartUp project
  4. 右键move_to_spot, 在Debugging页面中command Arguments处输入 192.168.11.1 (Slamware AP 模式默认IP地址)。 注: 此sample为 windows console application, 也可以在console中用命令行执行,用法为:move_to_spot <IP address> 
  5. 点击F5运行
  6. (TODO 添加RoboStudio的视频)

描述:

  • 代码功能说明: 调用goHome机器人导航运动到()接口来进行自动回充,如果没有找到充电桩或者充电失败,会重复至多三次调用goHome()2, 0) 点,然后从(2,0) 沿虚拟轨道运动到(0, 0)点

    Code Block
    languagecpp
    firstline1
    title获取传感器数据
    linenumberstrue
            SlamwareCorePlatform sdp = SlamwareCorePlatform::connect(argv[1], 1445);
    		std::cout <<"SDK Version: " << sdp.getSDKVersion() << std::endl;
    		std::cout <<"SDP Version: " << sdp.getSDPVersion() << std::endl;
    		rpos::actions::MoveAction action = sdp.getCurrentAction();
    		if (action)
    			action.cancel();		
    		//move to location (2, 0), not on virtual track
    		rpos::features::motion_planner::MoveOptions options;
    		options.flag = MoveOptionFlag(MoveOptionFlagMilestone | MoveOptionFlagPrecise | MoveOptionFlagWithYaw | MoveOptionFlagReturnUnreachableDirectly);
    		action = sdp.moveTo(rpos::core::Location(12, 0), options, pi);
    		action.waitUntilDone();
    		if (action.getStatus() == rpos::core::ActionStatusError)
    			std::cout << "Action Failed: " << action.getReason() << std::endl;
    		//draw a virtual track from (0, 0) to (2, 0), then move to (0, 0) via virtual track
    		rpos::core::Line line(rpos::core::Point(0,0),rpos::core::Point(2,0));
    		sdp.addLine(ArtifactUsageVirtualTrack, line);
    		options.flag = MoveOptionFlag(MoveOptionFlagKeyPoints | MoveOptionFlagPrecise | MoveOptionFlagReturnUnreachableDirectly);
    		action = sdp.moveTo(rpos::core::Location(0, 0), options);
    		action.waitUntilDone();
    		if (action.getStatus() == rpos::core::ActionStatusError)
    			std::cout << "Action Failed: " << action.getReason() << std::endl;