關于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);設定任務優先級;