Close

Controlling the 7 motors: Installing FreeRTOS

A project log for Building the Thor robot

Building a 6-axis robot based on the Thor robot. When size DOES matter!

olaf-baeyensOlaf Baeyens 12/31/2016 at 13:496 Comments

Thanks to Danny I discovered FreeRTOS that probably will make controlling the 7 stepper motors fluently. It is a small "Real Time Operating System" (RTOS) designed for small devices.

I went to the FreeRTOS web site but when I unzipped the files, I did not find a Arduino Sketch version.

In the end I found out how easily you can install it from Sketch itself.

Open Arduino Sketch

Go to menu Sketch --> Include Library --> Manage Libraries

You now find a list of libraries you can modify, update and install.

Search for freeRTOS, and you will find it. Click on it and you get an install option.

Once installed you are ready to go.

The source code fro that Arduino version is coming from: https://github.com/feilipu/Arduino_FreeRTOS_Library

Discussions

dannyvandenheuvel wrote 08/20/2017 at 07:31 point

My browser did some strange things, sorry for the many 'Hi's' :-)
I continue my conversation,
Use this script,
#include <TaskScheduler.h>

void vStp01TaskON();
void vStp02TaskON();
void vStp03TaskON();

Scheduler TS;

Task t1(10, TASK_FOREVER, &vStp01TaskON,&TS); // 10ms task
Task t2(500, TASK_FOREVER, &vStp02TaskON,&TS); // 500ms task
Task t3(100, TASK_FOREVER, &vStp03TaskON, &TS); // 100ms task


void setup(){

  t1.enable();

  t2.enable();
  t3.enable();

}


void loop() {

    TS.execute();
}


// TASK 01
void vStp01TaskON() {

// do your thing every 10ms...
}

// TASK 01
void vStp02TaskON() {

// do your thing every 500ms...
}

// TASK 03
void vStp03TaskON() {

// do your thing every 100ms...
}

This works perfect!

  Are you sure? yes | no

dannyvandenheuvel wrote 08/20/2017 at 07:24 point

Hi,

It's not really multitasking, the processor has one hardware thread, so what the do is pausing things in software and handle the rest of it. I worked with RTOS but it wasn't that good, did go to the standard arduino library 'TaskScheduler' works perfect for me!

#include <TaskScheduler.h>

  Are you sure? yes | no

dannyvandenheuvel wrote 08/20/2017 at 07:19 point

HI,

  Are you sure? yes | no

dannyvandenheuvel wrote 08/20/2017 at 07:19 point

Hi,

  Are you sure? yes | no

Olaf Baeyens wrote 08/19/2017 at 21:21 point

No I want to develop it myself from scratch. This Thor project for me it is a learning process, it does not matter if I build it or not. This FreeTOS would severely slow down my performance in movement. The time to learn this OS would take the same amount for me to develop from scratch.


  Are you sure? yes | no

Sepio wrote 08/19/2017 at 21:08 point

Do you still use FreeRTOS today?

  Are you sure? yes | no