top of page

#6: Matter.js

28 nov 2019
2 minuten om te lezen

In order for my robot to walk I decided that, because it needs to be a smart robot, he will train himself to walk. To do that I will create a simulation of my robot and perform neuroevolution on this simulation. Why a simulation you might ask, I decided for a simulation instead of my real robot because of a few aspects, the obvious one is that it would require much work to always upload the new generation onto the physical robot. The next one is that the simulation can be made in the time that I wait for my components and for my 3D printed chassis.


The simulation.

For the simulation I got recommended to work with the physics engine Matter.js, because this engine was new to me, I decided to take some time in exploring it. First I followed the tutorial Getting started: https://github.com/liabru/matter-js/wiki/Getting-started.


After doing the start-up tutorial I decided to look into the documentation: https://brm.io/matter-js/docs/classes/Common.html and test a few things out myself to get to know the engine a bit better. I tested other shapes then a rectangle, mouse event, direction of the angle, ...

Because I want to simulate my robot I needed to learn how to make a shape out of other shapes, in order to learn that I found a demo where they make a rag doll along side other shapes. The demo: https://brm.io/matter-js/demo/#ragdoll.

After going through the code of this rag doll and analysing it, I started transforming it into my robot.

The difficulty I faced with the code for the robot was the connection of each limb, as you can see here the connection is presented as the white dots and lines between the different shapes, rectangles. In the normal world these lines are invisible, the difficulty I faced was bringing the limbs together not necessarily the connection as you can see that worked, but bringing the actual rectangle, legs, to the big rectangle, chest.

Here you see that I finally have figured it out, but the proportions are a bit off. Because it is a simulation of my in real life robot the proportions and shape needs to be as close as the real deal.


Recente blogposts

Alles weergeven

Opmerkingen


bottom of page