Design your own robot for learning research

One of the major drawbacks of performing reinforcement learning, imitation learning, deep learning research on real-world environment is the availability of appropriate simulation environments. For example in reinforcement learning a game or physics simulator is needed with good fidelity to real world scenarios.

There are plenty of games and simulators out there but most often researchers are afraid to create their own environment. And to good reason: it is very hard and also time consuming to create a usable world environment and design all its functions. To deepen the effort, one has to be familiar with a variety of tools and languages from Mechanical Engineering, physic simulators, 3D content creation programs, and more.

When I started working on editing environments, I was often needing to design my own robot and scene, but was always a bit afraid to overcome the significant barrier to do so.

But no more! I have found the courage and the right recipe to do this effortlessly, and with only minimal investment in time.

The purpose of this blog post is to teach you all how I do it, and hopefully convince you you can do this too!

Let us start!!!

First you need to select your 3D and physics simulation environment. Mujoco is a great option, but its cost is prohibitive for beginners and for small companies or research groups. I highly reccomend using Webots or PyBullet. Both are great tools and I have used them with great success. This blog post will focus on use for PyBullet. We will also focus on creating a OpenAI gym environment which is typically used in deep learning research.

If you want to design your robot and environment often you will need the following:

  • a 3D scene with objects, artifacts, tools, machines and furniture
  • a robot
  • actuators and sensors

3D scenes

You may find a nice environment sometimes in Mujoco format. I used to worry, but now fear not! It is easy to create a “.urdf” file based on a Mujoco environment. For example see this one below:

an example environment from Google Research

Mujoco uses “.xml” files to describe words (environments). One can easily translate this type of files into “.urdf”. For example see this original XML file it was translated to this URDF file. This only contains the desk environment with ability to push buttons and open drawers and sliders. You can add a robot arm as per below.

Robots

PyBullet makes it easy to import many pre-configured 3D items, robots and tools. The most preferred import is using “.urdf” files. URDF is a file format from ROS that describes robots and tools.

Universal Robots arms

The best way to create your own robot and environment is to use “.stl” files that can be found in many mechanical tools sites, but an easy repository for robotic arms is ROS industrial. For example a very tipical robot arm used in research and also in manufacturing are the ones from Universal Robots, but also Fanuc, etc. You can usually import robot arms via URDF files as this one here.

Here is an example of how to create an environment with a UR5 robot arm in OpenAI gym format. You can load robot arm URDF together with other desks and furniture, machine and tools in the same way.

Actuators and Sensors

When I was using the UR5 robot I was never able to find an easy to use gripper that is easy to implement in PyBullet. A great gripper example I liked is the Mujoco gripper from this environment. I did not dare attempt to create one myself, so I spent a lot of time trying to use the Robotiq 85 or similar, but was always difficult to operate and use. The reason is that it has complex actuation and difficult operation to implement in a gym environment.

But with the right tools it is actually very easy to design a simple gripper! I used the following tools:

I provide an example URDF gripper I made below. The important things to learn about designing robots in this format is that they are composed of:

  • links
  • joints

Links are part of a robot, like each robot arm segment or the finger and base of a gripper. Joints are ways to connect links together into useful and working robots. Joints also define how links move, for example PRISMATIC is a linear like motion, while REVOLUTE are links that rotate. Follow the guides and examples from ROS. It would be pointless to repeat it all here, but rest assured that a bit of confusion and trial-errors are needed to get started, but you can accomplish one of these in just a few hours, as the one I designed in the image below.

Here is my simple robot gripper

Here is an example URDF for a simple gripper I designed really easily.

Final words

I hope this can help you to challenge your fears and start designing your very own robots, environments and tools!

Keep the innovation rolling!!!

About the author

I have almost 20 years of experience in neural networks in both hardware and software (a rare combination). See about me here: Medium, webpage, Scholar, LinkedIn, and more…

Donations

If you found this article useful, please consider a donation to support more tutorials and blogs. Any contribution can make a difference!

</robot>

I dream and build new technology