赞
踩
cat /proc/cpuinfo | grep family
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
cpu family : 6
写在前面:
注意编译过程中的报错,以及不兼容状况
step1: Get the linux kernel
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.9.24.tar.gz
tar xf linux-4.9.24.tar.gz
step2:Get Xenomai 3.0.9
wget https://xenomai.org/downloads/xenomai/stable/xenomai-3.0.9.tar.bz2
tar xf xenomai-3.0.9.tar.bz2
step3:Apply the Xenomai patch
cd linux-4.9.24
wget https://xenomai.org/downloads/ipipe/v4.x/x86/ipipe-core-4.9.24-x86-2.patch
…/xenomai-3.0.9/scripts/prepare-kernel.sh --arch=x86_64 --ipipe=ipipe-core-4.9.24-x86-2.patch
step4:Configure the kernel
cp kernel4.config linux-4.9.24#kernel4为自己在make menuconfig配置后保存而成,也可以不load,直接配置
Take the actual working config :
1 yes “” | make oldconfig
sudo apt install libncurses5-dev
make menuconfig
2 important!!!
load kernel4.config,add xenomai coalbalt config:
Xenomai/cobalt–>Drivers–>Real-time IPC drivers -->RTIPC protocol family(Enable)
Recommended options:
ps:
W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_14.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver8_7.bin for module i915
get into
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915
download kbl_guc_ver9_14 and bxt_guc_ver8_7 ,put them into /lib/firmware/i915
sudo cp /home/iimt/RTlinux/bxt_guc_ver8_7.bin /lib/firmware/i915/
sudo cp /home/iimt/RTlinux/kbl_guc_ver9_14.bin /lib/firmware/i915/
step8:Allow non-root users
sudo addgroup xenomai --gid 1234
sudo addgroup root xenomai
sudo usermod -a -G xenomai $USER
step9:
Configure GRUB and reboot
sudo gedit /etc/default/grub
replace
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”
GRUB_CMDLINE_LINUX=""
to
GRUB_DEFAULT=“Advanced options for GNU/Linux>GNU/Linux, with Linux 4.9.24-xenomai-3.0.9”(注意,这里与grub界面一致)
#GRUB_DEFAULT=saved
#GRUB_SAVEDEFAULT=true
#Comment the following lines
#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash xenomai.allowed_group=1234”
GRUB_CMDLINE_LINUX=""
ps:
grep menuentry /boot/grub/grub.cfg
前缀带有menuentry都是GRUB_DEFAULT可以设置的启动项,
step10:
If you have an Intel HD Graphics integrated GPU (any type) :
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash i915.enable_rc6=0 i915.enable_dc=0 noapic xenomai.allowed_group=1234”
This removes powersavings from the graphics, that creates disturbing interruptions.
step11:
Update GRUB and reboot
sudo update-grub
ps:
iimt@iimt:~/RTlinux$ sudo update-grub
/usr/sbin/grub-mkconfig: 9: /etc/default/grub: Comment: not found
the file format is discrrect
sudo reboot
ps:
if you are ubuntu and windows double system,maybe erro
如果出现无法使用sudo update-grub,比如:/usr/sbin/grub-mkconfig 1 /etc/default/grub i# not found
解决方法:
sudo cp /usr/share/grub/default/grub /etc/default/grub
step12:
Installing Xenomai 3.0.5 User space libraries
enable xenomai test file
iimt@iimt:~$ sudo dpkg-reconfigure bash
1 First, make sure that you are running the cobalt kernel :
uname -a
Linux iimt 4.9.24-xenomai-3.0.5 #1 SMP Sun Apr 19 16:04:42 CST 2020 x86_64 x86_64 x86_64 GNU/Linux
iimt@iimt:~$ dmesg | grep Xenomai
[ 2.084619] [Xenomai] scheduling class idle registered.
[ 2.084620] [Xenomai] scheduling class rt registered.
[ 2.084647] [Xenomai] SMI-enabled chipset found, but SMI workaround disabled
[ 2.084691] I-pipe: head domain Xenomai registered.
[ 2.085941] [Xenomai] allowing access to group 1234
[ 2.086021] [Xenomai] Cobalt v3.0.9
2
cd xenomai-3.0.9
./configure --with-pic --with-core=cobalt --enable-smp --disable-tls --enable-dlopen-libs --disable-clock-monotonic-raw
make -jnproc
sudo make install
–disable-clock-monotonic-raw : http://xenomai.org/pipermail/xenomai/2017-September/037695.html
step13:防止gazebo编译问题的修复,适用于xenomai3.0.5
git clone https://git.xenomai.org/xenomai-3.git
iimt@iimt:~$ cd xenomai-3
root@iimt:/home/iimt/xenomai-3# ./scripts/bootstrap
root@iimt:/home/iimt/xenomai-3#./configure --with-pic --with-core=cobalt --enable-smp --disable-tls --enable-dlopen-libs
root@iimt:/home/iimt/xenomai-3#make -jnproc
root@iimt:/home/iimt/xenomai-3#sudo make install
step14:更新bash
echo ’
export XENOMAI_ROOT_DIR=/usr/xenomai
export XENOMAI_PATH=/usr/xenomai
export PATH=
P
A
T
H
:
PATH:
PATH:XENOMAI_PATH/bin:
X
E
N
O
M
A
I
P
A
T
H
/
s
b
i
n
e
x
p
o
r
t
P
K
G
C
O
N
F
I
G
P
A
T
H
=
XENOMAI_PATH/sbin export PKG_CONFIG_PATH=
XENOMAIPATH/sbinexportPKGCONFIGPATH=PKG_CONFIG_PATH:
X
E
N
O
M
A
I
P
A
T
H
/
l
i
b
/
p
k
g
c
o
n
f
i
g
e
x
p
o
r
t
L
D
L
I
B
R
A
R
Y
P
A
T
H
=
XENOMAI_PATH/lib/pkgconfig export LD_LIBRARY_PATH=
XENOMAIPATH/lib/pkgconfigexportLDLIBRARYPATH=LD_LIBRARY_PATH:$XENOMAI_PATH/lib
export OROCOS_TARGET=xenomai
’ >> ~/.xenomai_rc
echo ‘source ~/.xenomai_rc’ >> ~/.bashrc
source ~/.bashrc
step15:测试延时
进入下面的路径
root@iimt:cd /usr/xenomai/bin
root@iimt:/usr/xenomai/bin# ./latency
程序返回
== Sampling period: 100 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up…
RTT| 00:00:01 (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|—msw|—lat best|–lat worst
RTD| 0.587| 1.288| 3.972| 0| 0| 0.587| 3.972
RTD| 0.070| 1.235| 4.716| 0| 0| 0.070| 4.716
RTD| 0.766| 1.304| 4.332| 0| 0| 0.070| 4.716
RTD| 0.513| 1.262| 3.682| 0| 0| 0.070| 4.716
RTD| 0.681| 1.193| 4.090| 0| 0| 0.070| 4.716
RTD| 0.308| 1.293| 5.854| 0| 0| 0.070| 5.854
RTD| 0.571| 1.286| 3.885| 0| 0| 0.070| 5.854
RTD| 0.655| 1.287| 4.149| 0| 0| 0.070| 5.854
RTD| 0.319| 1.309| 167.149| 1| 0| 0.070| 167.149
RTD| 0.678| 1.294| 4.759| 1| 0| 0.070| 167.149
RTD| 0.545| 1.420| 7.076| 1| 0| 0.070| 167.149
RTD| 0.329| 1.700| 8.384| 1| 0| 0.070| 167.149
RTD| 0.592| 1.673| 14.650| 1| 0| 0.070| 167.149
RTD| 0.676| 1.424| 9.247| 1| 0| 0.070| 167.149
RTD| 0.615| 1.541| 6.126| 1| 0| 0.070| 167.149
RTD| 0.687| 1.427| 7.313| 1| 0| 0.070| 167.149
RTD| 0.542| 1.459| 7.325| 1| 0| 0.070| 167.149
RTD| 0.361| 1.534| 13.339| 1| 0| 0.070| 167.149
RTD| 0.277| 1.879| 27.216| 1| 0| 0.070| 167.149
RTD| 0.372| 1.749| 10.360| 1| 0| 0.070| 167.149
RTD| 0.636| 1.360| 8.031| 1| 0| 0.070| 167.149
RTT| 00:00:22 (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|—msw|—lat best|–lat worst
RTD| 0.587| 1.454| 88.391| 1| 0| 0.070| 167.149
RTD| 0.298| 1.436| 8.258| 1| 0| 0.070| 167.149
RTD| 0.670| 1.405| 11.138| 1| 0| 0.070| 167.149
RTD| 0.417| 1.448| 5.063| 1| 0| 0.070| 167.149
RTD| 0.201| 1.497| 8.388| 1| 0| 0.070| 167.149
RTD| 0.273| 1.460| 7.163| 1| 0| 0.070| 167.149
RTD| 0.224| 1.544| 7.259| 1| 0| 0.070| 167.149
RTD| 0.199| 1.586| 8.507| 1| 0| 0.070| 167.149
RTD| 0.523| 1.382| 8.158| 1| 0| 0.070| 167.149
RTD| 0.354| 1.312| 8.098| 1| 0| 0.070| 167.149
RTD| 0.642| 1.324| 7.136| 1| 0| 0.070| 167.149
RTD| 0.365| 1.324| 9.153| 1| 0| 0.070| 167.149
RTD| 0.521| 1.368| 17.231| 1| 0| 0.070| 167.149
RTD| 0.496| 1.370| 7.195| 1| 0| 0.070| 167.149
RTD| 0.351| 1.571| 30.495| 1| 0| 0.070| 167.149
RTD| 0.363| 1.641| 47.734| 1| 0| 0.070| 167.149
RTD| 0.279| 1.464| 9.942| 1| 0| 0.070| 167.149
RTD| 0.614| 1.660| 8.249| 1| 0| 0.070| 167.149
RTD| 0.385| 1.565| 8.296| 1| 0| 0.070| 167.149
RTD| 0.132| 1.317| 15.283| 1| 0| 0.070| 167.149
RTD| 0.264| 1.297| 7.719| 1| 0| 0.070| 167.149
RTT| 00:00:43 (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|—msw|—lat best|–lat worst
RTD| 0.095| 1.372| 6.350| 1| 0| 0.070| 167.149
RTD| 0.203| 1.416| 140.959| 2| 0| 0.070| 167.149
RTD| 0.191| 1.493| 11.571| 2| 0| 0.070| 167.149
RTD| 0.274| 1.469| 11.582| 2| 0| 0.070| 167.149
RTD| 0.706| 1.340| 8.041| 2| 0| 0.070| 167.149
RTD| 0.369| 1.393| 8.844| 2| 0| 0.070| 167.149
RTD| 0.692| 1.497| 10.873| 2| 0| 0.070| 167.149
RTD| 0.560| 1.503| 8.843| 2| 0| 0.070| 167.149
RTD| 0.919| 1.446| 8.542| 2| 0| 0.070| 167.149
RTD| 0.763| 1.403| 121.735| 3| 0| 0.070| 167.149
RTD| 0.666| 1.615| 8.049| 3| 0| 0.070| 167.149
RTD| 0.618| 1.363| 117.100| 4| 0| 0.070| 167.149
RTD| 0.377| 1.541| 7.279| 4| 0| 0.070| 167.149
RTD| 0.665| 1.362| 33.822| 4| 0| 0.070| 167.149
RTD| 0.592| 1.502| 4.829| 4| 0| 0.070| 167.149
RTD| 0.639| 1.484| 68.959| 4| 0| 0.070| 167.149
RTD| 0.315| 1.754| 6.209| 4| 0| 0.070| 167.149
RTD| 0.410| 1.803| 82.379| 4| 0| 0.070| 167.149
RTD| 0.194| 1.529| 5.824| 4| 0| 0.070| 167.149
RTD| 0.265| 1.509| 5.583| 4| 0| 0.070| 167.149
RTD| 0.264| 1.560| 10.817| 4| 0| 0.070| 167.149
RTT| 00:01:04 (periodic user-mode task, 100 us period, priority 99)
可以看到平均延时时间1.5us左右
step16:修复负延时问题
$ echo 0 > /proc/xenomai/latency
Now run the latency test
If the minimum latency value is positive, then get the lowest value from the latency test (ex: 0.088 us)
and write it to the calibration file ( here you have to write 88 ns) :
$ echo my_super_value_in_ns > /proc/xenomai/latency
例如:
RTS| -0.042| 1.166| 135.696| 1| 0| 00:00:41/00:00:41
root@iimt:/usr/xenomai/bin# echo 42 >/proc/xenomai/latency
dell textbook
OROCOS RTT on Xenomai
Orocos RTT is fully compatible with Xenomai, but it needs to be built from source.
The only difference in the build process is the need to set export OROCOS_TARGET=xenomai before compiling.
Orocos Toolchain 2.9 on Xenomai
export OROCOS_TARGET=xenomai
mkdir -p ~/isir/orocos-2.9_ws/src
cd ~/isir/orocos-2.9_ws/src
wstool init
wstool merge https://raw.githubusercontent.com/kuka-isir/rtt_lwr/rtt_lwr-2.0/lwr_utils/config/orocos_toolchain-2.9.rosinstall
wstool update -j2
cd orocos_toolchain
git submodule foreach git checkout toolchain-2.9
git submodule foreach git pull
cd ~/isir/orocos-2.9_ws/
source /opt/ros/kinetic/setup.bash
rosdep install --from-paths ~/isir/orocos-2.9_ws/src --ignore-src --rosdistro kinetic -y -r
catkin config --init --install --extend /opt/ros/kinetic/ --cmake-args -DCMAKE_BUILD_TYPE=Release -DENABLE_MQ=ON -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB
catkin build
RTT ROS Integration 2.9 on Xenomai
export OROCOS_TARGET=xenomai
mkdir -p ~/isir/rtt_ros-2.9_ws/src
cd ~/isir/rtt_ros-2.9_ws/src
wstool init
wstool merge https://github.com/kuka-isir/rtt_lwr/raw/rtt_lwr-2.0/lwr_utils/config/rtt_ros_integration-2.9.rosinstall
wstool update -j2
cd ~/isir/rtt_ros-2.9_ws/
source ~/isir/orocos-2.9_ws/install/setup.bash
rosdep install --from-paths ~/isir/rtt_ros-2.9_ws/src --ignore-src --rosdistro kinetic -y -r
catkin config --init --install --extend ~/isir/orocos-2.9_ws/install --cmake-args -DCMAKE_BUILD_TYPE=Release -DENABLE_MQ=ON -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB
catkin build
Tip
Always build for Xenomai on the Xenomai computer : echo ‘export OROCOS_TARGET=xenomai’ >> ~/.bashrc
Note
Libraries built with xenomai will have -xenomai.so appended to the library name (ex libmycontroller-xenomai.so)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。