[ROS Mini Challenge] #3 – make a manipulator robot execute a trajectory

Written by Bayode Aderinola

12/02/2020

In this post, we will see how to configure MoveIt to make a manipulator robot execute a trajectory based on a Position Goal. We send a Position Goal to the manipulator, and the robot computes and executes a trajectory plan in order to reach this goal.

PS: This ROS project is part of our ROS Mini Challenge series, which gives you an opportunity to win an amazing ROS Developers T-shirt! This challenge is already solved. For updates on future challenges, please stay tuned to our Twitter channel.

Step 1: Grab a copy of the ROS Project that contains the simulation

Click here to get your own copy of the project. If you don’t have an account on the ROS Development Studio, you will need to create one. Once you create an account or log in, we will copy the project to your workspace. That done, open your ROSject using the Open button. This might take a few moments, please be patient.

You should now see a notebook with detailed instructions about the challenge. Please ignore the Claim your Prize! section because…well…you are late the party 🙂

Step 2: Start the Simulation and run the MoveIt program to configure the manipulator

  1. Click on the Simulations menu and then Choose launch file . In the dialog that appears, select main.launch from the shadow_gazebo package. Then click the Launch button. You should see a Gazebo window popup showing the simulation: a manipulator robot.
  2. Start the MoveIt package – pick a Shell from the Tools menu and run the following command:
user:~$ roslaunch myrobot_moveit_config myrobot_planning_execution.launch

Once you see the green text that says “You can start planning now”, pick the Graphical Tools app from the Tools menu.

Probably, at first, you will see the window a bit displaced.

 

In order to center it, just click on the Resize opened app button. At the end, you should get something like this:

In the window that appears, go to the Planning tab and then to the Select Goal State dropdown under Query.

 

Select “start” and click Update.

 

Click on the Plan button under Commands in order to calculate a suitable trajectory for reaching the goal position.

Finally, click on the Execute button under Commands in order to execute the position goal (and the plan).

You should see the manipulator on the right moving in order to execute the trajectory, as shown below (in the Graphical Tools and the Gazebo windows).

But this didn’t happen did it? Let’s fix that in the next section!

Step 3: Let’s solve the problem!

What the heck was the problem?! Hmm, I wished I had paid more attention to the Shell…because it left a message for us there, in red letters! Let’s go see it:

[ERROR] [1580760680.575679474]: Unable to identify any set of controllers that can actuate the specified joints: [ elbow_joint shoulder_lift_joint shoulder_pan_joint wrist_1_joint wrist_2_joint wrist_3_joint ]
[ERROR] [1580760680.575917519]: Known controllers and their joints:

[ INFO] [1580760680.671585828]: ABORTED: Solution found but controller failed during execution

We didn’t set up a controller for moving the robot arm. Whew!

We need to examine the package to find the fix, so fire up the IDE from the Tools menu and browse to the catkin_ws/src/myrobot_moveit_config package. In the launch subdirectory, we have a file named smart_grasping_sandbox_moveit_controller_manager.launch.xml:

<launch>
  <rosparam file="$(find myrobot_moveit_config)/config/my_controllers.yaml"/>
  <param name="use_controller_manager" value="false"/>
  <param name="trajectory_execution/execution_duration_monitoring" value="false"/>
  <param name="moveit_controller_manager" value="moveit_simple_controller_manager/MoveItSimpleControllerManager"/>
</launch>

The first line of the configuration above refers to a file my_controllers.yamlfile in the config subdirectory let’s open that file up:

controller_list:
    Hi there!

Huh, we expected this file to list the controllers, but all we get here is “Hi there!”! We don’t need that – so this must be the wrong file! We need to find a file containing the controllers we need, so let’s check out some other files there, for example controllers.yaml:

controller_list:
  - name: arm_controller
    action_ns: follow_joint_trajectory
    type: JointTrajectoryController
    joints:
      - shoulder_pan_joint
      - shoulder_lift_joint
      - elbow_joint
      - wrist_1_joint
      - wrist_2_joint
      - wrist_3_joint
  - name: hand_controller
    action_ns: follow_joint_trajectory
    type: FollowJointTrajectory
    joints:
      - H1_F1J1
      - H1_F1J2
      - H1_F1J3
      - H1_F2J1
      - H1_F2J2
      - H1_F2J3
      - H1_F3J1
      - H1_F3J2
      - H1_F3J3

WOW, this might be what we need (ssh! Top secret: it is!), so let’s copy over the contents of controllers to  my_controllers and save!

Step 4: Test the Fix

Now get back to the Shell. Stop the program we ran in Step 2 using Ctrl + C.

^C[rviz_rosdscomputer_8081_1478977940469499802-4] killing on exit
[move_group-3] killing on exit
[joint_state_publisher-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
user:~$ roslaunch myrobot_moveit_config myrobot_planning_execution.launch

After this, repeat everything in Step 2. Oops, yeah, it didn’t work yet!! Instead, we got another error:

[ERROR] [1580771100.563075907, 98.692000000]: Unable to identify any set of controllers that can actuate the specified joints: [ elbow_joint shoulder_lift_joint shoulder_pan_joint wrist_1_joint wrist_2_joint wrist_3_joint ]
[ERROR] [1580771100.563656482, 98.692000000]: Known controllersand their joints:
controller 'hand_controller' controls joints:
  H1_F1J1
  H1_F1J2
  H1_F1J3
  H1_F2J1
  H1_F2J2
  H1_F2J3
  H1_F3J1
  H1_F3J2
  H1_F3J3

The controllers again! Now let’s examine the error message again.

  • The controllers for the parts that need to move could not be found. But these controllers are listed in the my_controllers.yaml .
  • Some other controllers listed in the same file were found.

Perhaps there’s some misconfiguration – let’s have a second look at this my_controllers.yaml file:

  • We have two controllers: arm_controller and hand_controller.
  • They both have an action_ns called follow_joint_trajectory.
  • But they have different types! They should be the same since they have the same “action namespace”!
  • The type for arm_controller is probably wrong because it’s the one we couldn’t find!

Now, change the type for arm_controller to FollowJointTrajectory and repeat step 2! Now the manipulator should execute the trajectory successfully – you should see the robot arm moving in both the Graphical Tools and the Gazebo windows.

This is one example of how to make a manipulator robot execute a trajectory based on a Position Goal. I hope you found it useful.

Extra: Video of this post

We made a video showing how this challenge was solved. If you prefer “sights and sounds” to “black and white”, here you go:

Related Resources

Feedback

Did you like this post? Do you have questions about what was explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.

If you want to learn about other ROS or ROS2 topics, please let us know in the comments area and we will do a video or post about it.

Masterclass 2023 batch2 blog banner

Check Out These Related Posts

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This