ROS MoveIt Robotic Arm




Introduction: ROS MoveIt Robotic Arm

About: My channel about robotics with ROS and machine learning!

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...

Be the First to Share


    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest
    • Rice & Grains Challenge

      Rice & Grains Challenge
    • Puzzles Challenge

      Puzzles Challenge



    Question 2 years ago

    Hi Dmitry, thanks for the awesome tutorial, may I ask what is the dof of this arm, and why did you choose translation3d for the ikfast plugin?


    Answer 2 years ago

    It has 5 DOF and 4-axis (gripper is counted as a DOF, but not as axis). It was so long time ago I cannot remember the exact reason, but from what I recall, Transform6D is not possible for 5 DOF arm and Translation3D basically puts the end effector in desired location (XYZ), which was my goal.


    Tip 3 years ago

    I may be slow responding to comments here, if you have an urgent issue,
    please post a comment on YouTube or contact me directly on LinkedIn :)
    welcome to create issues on GitHub and pull requests, if you make
    useful changes to the code or upgrade the code to newer version of
    frameworks used!


    3 years 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?


    Reply 3 years 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.


    Reply 3 years ago

    Hi! Sorry for the late reply, I got quite busy with other projects recently. The reason I'm asking about DOF and "Approximate IK solutions" option is that I discovered that for all IK solvers that ROS has available, none of them is particularly suitable for robotic manipulators with less than 6 DOF. You can read the discussion I started on MoveIt github here
    and another one

    I improved IK success rate by
    adding one more degree of freedom. But it still fails in about 20% of
    cases, which I solve iterating fast through the grasps and finding the
    one that works


    3 years ago

    Hi Dmitry,

    I am a super noob to robotics. Thanks to your excellent short tutorial, I could make it work. Could you send a link to buy the arm and ramp which you used, so that i could follow your 2nd part too


    Reply 3 years ago

    So glad to hear you liked the tutorial! If you want to see more videos about robotics and AI, you can have a look at my Youtube channel
    Concerning your question, this arm is 3D printed, you can get the files here
    But I would recommend building the second version of this arm, which is very similar, but has easier assembly process
    For the ramp and the ball you can download the SLT files from here
    Good luck!


    Question 3 years 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