Create Place Moves

The gripper moves through three poses in order to place the box: Approach, place and retreat. In this exercise, we will create these place poses for the TCP coordinate frame.

Locate Function

  • In the main program , locate the function call to application.computePlaceToolPoses().

  • Go to the source file of that function by clicking in any part of the function and pressing F2 in QtCreator.

  • Remove the first line containing the following RCLCPP_ERROR_STREAM ... so that the program runs.

Complete Code

  • Find every line that begins with the comment Fill Code: and read the description. Then, replace every instance of the comment UNCOMMENT AND COMPLETE with the appropriate line of code.

    /* Fill Code:
  • The position of the box at the place location is saved in the global variable cfg.BOX_PLACE_TF.

  • setOrigin() and setRotation() methods enable the modification of the place transform.

  • The createManipulationPoses() uses the values of the approach and retreat distances in order to create the corresponding poses at the desired target.

Build Code and Run

  • Compile the pick and place node:

    • In QTCreator: Build ‣ Build Project

    • Alternatively, in a terminal:

      colcon build
  • Run the supporting nodes with the launch file (only if needed):

    ros2 launch pick_and_place_application
  • In another terminal, run your node with the launch file:

    ros2 launch pick_and_place_application
  • The TCP and wrist positions at the place location will be printed on the terminal. You should see something like this:

    [INFO] [1400556479.404574973] [pick_and_place_node]: Pick Move 2 Succeeded
    [INFO] [1400556479.404866351] [pick_and_place_node]: tcp position at place: [-0.4, 0.6, 0.17]
    [ERROR] [1400556479.404981729] [pick_and_place_node]: doBoxPlace is not implemented yet.  Aborting.

API References