本页介绍了rotation_action_demo的用法, 包含顺时针旋转,逆时针旋转,旋转到指定角度等功能。 |
本页内容
Sample Code:
使用更高版本的Visual Studio可能会带来编译异常。 使用Visual Studio 2010(无SP1)可能会因为无法与.Net Framework兼容而报编译错误,此时增加SP1更新包即可解决问题 |
(以下任选其一)
右键rotation_action_demo, 打开属性选项,将Slamware SDK 的include目录和lib目录添加到工程
Slamware SDK的include和lib目录无需复制到参考例程目录,只需在Visual Studio里指定路径即可。 |
机器人先逆时针转一周,再顺时针转一周,最后转到yaw值为pi的位置。
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; |