Program the SENTIN3L to walk

In this section, I’ll show how to program the Sentin3l to walk using C# and the Monobrick firmware library. The goal for the program for our little Lego Mindstorms Ev3 Sentin3l droid is to follow the command of the Ev3 IR Remote. To meet this goal, we have to program the droid in such a way that

Download the full code on GitHub!

Responding to the commands received from the Ev3 IR Remote

The commands that the Sentin3l can receive from the Ev3 Remote through the Ev3 IR Sensor are:

  • Walk forward
  • Walk backward
  • Turn right
  • Turn left
  • Fire

So consider the following structure which is useful to interact with the Ev3 IR Remote:

which defines the type of the SENTIN3L   direction :

Please note, that of all the movements defined by the  Direction  enumeration, the SENTIN3L does not not use Left_Backward  and  Right_Backward , while  Left_Forward  and  Right_Forward  simply means turn left on the spot  and turn right on the spot.

Then within the  IRRemoteTask , the  OnTimer() method assigns  direction  which the SENTIN3L has to take according to the commands received from the Ev3 IR Remote:

Program the SENTIN3L to walk

Now, to program the sentin3l to walk, we need to add the task that drives the two Ev3 Large Motors according to the command received by the Ev3 IR Sensor. Before doing that, let’s add an angular position PID regulator for each leg (see here for a PID -proportional integrative derivative- regulator description).

Then we can define the  DriveTask as follows:

Now it’s easy to move the SENTIN3L legs in sync: we need to change the regulators set point only when both motors have reached their set point within a certain threshold. And to turn? To turn left we change the left set point with a negative increment and the right set point with a positive increment:

Download the code from GitHub and try by yourself!

And don’t forget to rate this post! Thank you!

Program the Sentin3l to walk
Tagged on:             

4 thoughts on “Program the Sentin3l to walk

  • December 22, 2017 at 5:15 pm
    Permalink

    i’m a Mac user can i get the coding in a file a can open with my Mac

    Reply
    • December 24, 2017 at 12:24 pm
      Permalink

      Hello Rob,

      Sorry for this late reply…
      I’m a Mac user too, so I think I can try to help you.
      What tool did you use to program the Lego Mindstorms Ev3 so far?

      Ciao,
      Riccardo.

      Ps. Merry Christmas!!!

      Reply
    • January 3, 2019 at 9:20 pm
      Permalink

      Hello Novian,

      Yes of course you can!
      If you need help, please ask!

      Cheers,
      Riccardo.

      Reply

Leave a Reply