Versions Compared

Key

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

This document introduces the demo project of "rotation_action_demo", including how to rotate clockwise, rotate anticlockwise and rotate turn to a particular angle.

...

Content

...

  1. Right click on "rotation_action_demo" project, set as StartUp as StartUp project.Image Removed
    Image Added

  2. Right click on "rotation_action_demo", then " Properties",configure "include" and "lib" directories to the corresponding folder path of Slamware

    SDK.Image Removed

    SDK.

    Info

    It's not necessary to copy files to the project directory, user will only need to configure the path of SDK.

    Image Added

  3. Right click on "rotation_action_demo", then "properties",set "Command Arguments" as follows: 
    Syntax :rotation:rotation_action_demo <IP address>Image Removed
    Image Added

  4. Click " F5" to to execute.
  5. Robot's motion could be seen in Robostudio.
    Multimedia
    date//
    Rotate to a specified angle
    旋转到指定角度
    namebandicam 2018-01-30 16-13-28-334.mp4


...

Code

  • The robot will first turn anticlockwise, then clockwise, and finally turn to the position where the value of yaw is pi.

    Code Block
    languagecpp
    firstline1
    titleRotate a particular angle/Rotate to a particular angle
    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;

...