關於ROS

Why is ROS not a real-time operating system?

ROS isn't even an operating system, it's a framework and it's usually built on top of Ubuntu. First and foremost, it provides a clean way to write several modular programs with inputs and outputs and stitch them together at runtime.

There's no reason you can't run ROS inside a RTOS (however, it was developed on Ubuntu, so it will take effort to get it running on anything else.)

關於Linux安裝RT-PREEMPT實時補丁

 常規意義上來講,Linux並不算是一個實時操作系統,僅僅能實現軟實時,我們可以通過打補丁的方式來實現硬實時,常用的補丁有:RT Preempt、Xenomai等。

Xenomai編程筆記

Xenomai 是一種採用雙內核機制的Linux 內核的強實時擴展。由於Linux 內核本身的實現方式和複雜度,使得Linux 本身不能使用於強實時應用。在雙內核技術下,存在一個支持強實時的微內核,它與Linux 內核共同運行於硬件平台上,實時內核的優先級高於Linux 內核,它負責處理系統的實時任務,而Linux 則負責處理非實時任務,只有當實時內核不再有實時任務需要處理的時候,Linux 內核才能得到運行的機會。 

下面簡要介紹幾類常用的Xenomai 原生API: 
1、任務管理 
Xenomai 本身提供的一系列多任務調度機制,主要有以下一些函數: 
intrt_task_create (RT_TASK *task, const char *name, int stksize, int prio, intmode) ; 任務的創建; 
int rt_task_start(RT_TASK *task, void(*entry)(void *cookie), void *cookie) ;  開始任務調度; 
intrt_task_suspend (RT_TASK *task);              掛起任務; 
intrt_task_delete (RT_TASK *task) ;                刪除任務; 
intrt_task_set_periodic (RT_TASK *task, RTIME idate, RTIME period) ;設置任務運行週期; 
intrt_task_wait_period (unsigned long *overruns_r) ;掛起任務到下個週期再運行; 
intrt_task_set_priority (RT_TASK *task, int prio);設置任務優先級;