Versions Compared

Key

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

...

  1. 打开samples工程
  2. 右键rotation_action_demo, 打开属性选项,将Slamware SDK 的include目录和lib目录添加到工程
  3. 右键rotation_action_demo, 将此工程设置成StartUp project
  4. 右键rotation_action_demo, 在Debugging页面中command Arguments处输入 192.168.11.1 
    格式说明:rotation_action_demo <IP address> 
  5. 点击F5运行(TODO 添加RoboStudio的视频)
  6. 可以连上Robostudio查看地图及机器人的运动
    Multimedia
    date//旋转到指定角度
    namebandicam 2018-01-30 16-13-28-334.mp4

代码描述

  • 代码功能说明:机器人先逆时针转一周,再顺时针转一周,最后转到yaw值为pi的位置。

    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();			    
    		//anticlockwise rotation
    		rpos::core::Rotation rotation(pi*2, 0, 0);
    		action = sdp.rotate(rotation);
    		action.waitUntilDone();
    		std::cout << "Action Status: " << action.getStatus() << std::endl;
    		//clockwise rotation
    	    rotation.yaw() = pi * (-2);
    		action = sdp.rotate(rotation);
    		action.waitUntilDone();
    		std::cout << "Action Status: " << action.getStatus() << std::endl;
    		//rotate to a certain orientation
    		rpos::core::Rotation orientation(pi, 0, 0);
    		action = sdp.rotateTo(orientation);
    		action.waitUntilDone();
    		std::cout << "Action Status: " << action.getStatus() << std::endl;