ROS MoveIt Robotic Arm

About: A technology enthusiast. Mostly work with robotics and AI.

This is going to be a series of articles about making a robotic arm controlled with ROS(Robotic Operating System) and MoveIt. If you are into robotics ROS is a great framework that will help you to build better robots faster. It allows you to re-utilize packages for different robot systems(computer vision, kinematics, path planning, SLAM, etc) that other people created. ROS is great, but unfortunately it does have a steep learning curve.

So this tutorial is step-by-step guide to making your first robotic arm with motion planning, aimed at upper-beginner and intermediate levels. I assume you have no knowledge of ROS, but do have some basic knowledge Linux and Python, Arduino programming skills.

Step 1: Prepare Your Environment

My environment for development is Ubuntu 16.04 LTS running in a Virtual Box(Windows 10 host machine). If you want to run Ubuntu on VM it's fine, I can confirm ROS Kinetic works, albeit with some quirks(notably 3D acceleration and USB support). If you have regular Ubuntu installation, it would work better.

Note: You can install ROS on Raspberry Pi, but unfortunately it's not powerful enough to run the simulations in Rviz, let alone Gazebo.

1) Install ROS Kinetic. Follow this guide on how to install ROS Kinetic on Ubuntu 16.04.

2) Install MoveIt. MoveIt! is a package for ROS for mobile manipulation, i.e. robotic arms.

3) Check if everything works. Run

roslaunch panda_moveit_config demo.launch rviz_tutorial:=true

if you want, go through moveit basic tutorial

4) You'll need to install urdf_tutorial package as well, we'll use it to visualize our work in progress.

sudo apt-get install ros-kinetic-urdf-tutorial

Step 2: Create Urdf File

If you followed MoveIt quickstart tutorial you should have created catkin workspace in your home directory(the name of the workspace might be different, default from moveit tutorial is ws_moveit). Go to ~ws_moveit/src and clone my github repo there.

If you are using the same robotic arm as I do or just want to practice you can leave the urdf file unchanged, otherwise you'll need to change it to correspond the arm model you have.

Here's a brief explanation of urdf file, looking at my example and the robot model in rviz will help you to understand it better and apply for writing your own urdf file.

links are the parts of the robot, like a wrist or a platform. They have following properties:

used for visual representation in rviz and gazebo. Uses high-quality meshes

used for collision checking during path planning. Recommended to use low-quality meshes, but for tutorial's sake I'm using the same as for visual.

joints in urdf are connections between links which describe how the are positioned in relation to each other and how they move. They have following properties:

the rotation direction of the joint(along x, y or z axis)

minimum and maximum degree of the joint in radians. Only applicable to "revolute" type joints("continuous" joints have no limits, since they, well, rotate continuously)

the position of the joint in relation to the origin

describes which two links are connected with the joint

If you are using the same robotic arm as I do, you'll need to copy 3D meshes of the arm to urdf_tutorial package folder. Do it with this command

sudo cp <names of hte files to copy> /opt/ros/kinetic/share/urdf_tutorial/meshes/

If you're using your own meshes make sure they are centered around the origin(xyz 000 in your favorite 3D modeling software) before you export them to binary(!) stl format.

Now you can launch rviz to visualize the results with this command

roslaunch urdf_tutorial display.launch model:=arm.urdf

(launch it from the folder with the urdf file you created just now)

Check the joints and the links, make sure they are rotating and positioned exactly how they are supposed to. If everything is okay, move on to the next step.

Step 3: Create Robot Configuration With MoveIt Setup Assistant

Now when your urdf file is ready it's time to convert it to robot configuration package.

Launch MoveIt Setup Assistant with the following command

roslaunch moveit_setup_assistant setup_assistant.launch

The process is very well described in MoveIt official tutorial, which you can find here

After you created the configuration package, go to your catkin workspace folder and execute

catkin make

to build the package. Now you can launch it with the following command

roslaunch my_arm_xacro demo.launch rviz_tutorial:=true

where you will need to change "my_arm_xacro" to the name of your package.

Step 4: Done!

If you successfully launched the package you'll see your robot model with interactive markers. You'll be able to control it in simulation, using the markers and then press "Plan and execute" for the kinematic solver to find hte right path to the desired state.

That was the step one, we created a model of our robotic arm and can harvest the power of ROS to calculate and execute motion in the simulation! Next step - do it with the real robot, for that we'll need to write simple robot controller...



    • Remix Contest

      Remix Contest
    • Build a Tool Contest

      Build a Tool Contest
    • Paper Contest

      Paper Contest

    3 Discussions


    5 weeks ago

    Hi. Let's see
    1)Are you using the meshes I provided or made yourown custom meshes for the arm?
    2)What happens if you just drag interactive marker in RVIZ? Can you move it freely? WWithout checking "Approximate IK solutions"
    3) How many DOF does your arm have?

    1 reply

    Reply 4 weeks ago

    1) I am using custom meshes, but I tried with the meshes you provided and got the same error.
    2) The marker can only be used to drag the arm in the plane it is currently in, even though the base should be able to rotate.
    3) I am not sure, each joint can rotate around a single axis. The configuration is similar to your arm.


    Question 6 weeks ago

    I have attempted to move the end
    effector of my robot in rviz using the Move Group Python Interface. I am
    using the set_position_target function. The desired position is
    reachable, which I checked using get_current_pose. When the code is run,
    the following message appears:
    ABORTED:No motion plan found.No execution attempted.

    have tried KDL Kinematics, as well as SRV and TracIK and have also
    tried extending the time that can be taken to generate a solution using
    set_planning_time. The rviz console displays the following:

    [ERROR][1547198381.394090262]:RRTConnect:Unable to sample any valid states for goal tree
    [ INFO][1547198381.394151779]:RRTConnect:Created1 states (1 start +0 goal)[ INFO][1547198381.394183617]:No solution found after 5.009418 seconds
    [ INFO][1547198381.406033807]:Unable to solve the planning problem