Program Virtual Robots using Gears

By guest contributor, Cort Wee, creator of Ev3devSim and Gears

Hi all. I’m Cort, the creator of Gears, the successor of Ev3devSim. Ev3devSim is a 2D robotics simulator I created to aid in teaching Python for the EV3, but I have found the 2D environment and lack of physics simulation rather limiting. My current project, Gears, is a free and opensource 3D robotics simulator that runs in a browser (no login or accounts required). It is available here or, if you prefer, you can download it from Github and run it on your own server.

Some of the features of Gears include…

Multi-Robots Arena

Run multiple robots simultaneously

The ability to work with or compete against a friend can be a powerful motivator. In Arena mode, Gears can run multiple robots simultaneously, either competing or cooperating with each other to complete a mission. Currently, there are arenas for robot paintball matches, collaborative item collection challenges, two to four-way sumo matches, and a blank arena for synchronized movements (or just general fooling around).

Customizable Robots

Gears comes with seven pre-configured robots to choose from, but you can also customize your own robots with any combinations of sensors and actuators. Components can be placed anywhere on the robot and in any orientation (e.g. forward-facing color sensor). They can also be attached to actuators (e.g. ultrasonic sensor attached to a motorized swivel platform) and be rotated or moved independent from the robot body.

Realistic Physics

Gears simulates realistic physics

Just like a real robot, a GearsBot won’t move straight without a line or gyro to follow. This creates the opportunity for experimenting with many of the techniques used with a real robot (e.g. PID control).

Blockly Enhancements

One drawback in using Scratch or Makecode as a replacement for EV3G is that larger programs with many functions are messy and difficult to manage. Gears uses Blockly (the same engine behind Scratch and Makecode) to power its blocks-based interface, but adds a multi-page system to facilitate organization of code; similar to EV3G, but without forcing its use.

Code reuse is an important programming principle that is difficult to practice in many blocks-based coding environments. To encourage code reuse, Gears provides a function import feature. Students can use it to import useful functions that they have built for a previous mission into their current program.

Blocks to Python to Physical Robot

Block-based programming is great for learning coding basics, but for more complex programs, the expressiveness of a text-based language is far superior. Gears automatically converts its block program into Python and produces Python code that is compatible with either Ev3dev or Pybricks. The user can edit the generated Python code or write their entire program in Python from the start. Besides running it in the simulator, the Python code can also be uploaded and run on a real EV3 brick.

Built-in and Customizable Challenges

Gears comes with many built-in challenges. These include topics-based challenges (e.g. line following, obstacle avoidance), as well as some mission-based challenges (e.g. rescue victims from a burning building). You can also create your own game world; just upload your own image to use as a map, then optionally add obstacles and items to pick up.

Create your own challenge environments

The Future…

At the time of writing this, Gears is only a couple months old, and I’m actively enhancing it whenever I can find the time. If you would like to help, one of the biggest thing you can do is to simply use it and provide feedback, suggestions, and bug reports.

Try out Gears here and help spread the word!


The following two tabs change content below.
Guest Contributor

Guest Contributor

Guest Contributor

Latest posts by Guest Contributor (see all)

Leave a Reply