NanoPC-T4/rk3399安装ros melodic

相对于树莓派的1G内存来讲,NanoPC T4的4G内存,性能提升了不止一倍,树莓派内存不足,容易编译失败,还要添加swap来凑,NanoPC T4的内存足够完成编译过程

1.首先说第一个坑,我安装的系统是rk3399-eflasher-friendlydesktop-bionic-4.4-arm64-20190511.img,这个系统我的感觉有点精分,从理论上来讲,他就是一个定制版本的Ubuntu 18.04,但是其内核版本很低,还是4.4,但是文件系统里面自带了一个高版本的OpenCV 4,而在安装ros时,会再安装上去一个opencv3,导致两个版本冲突,会编译失败,所以装好系统之后第一件事就是把opencv4干掉,我的方法是通过locate命令,找到所有opencv4的路径,然后删除,这个系统默认不带locate命令,可以安装

sudo apt install mlocate -y

2.安装qt4,因为编译小R 机器人附送的代码需要依赖qt4,

sudo apt install qt4-default -y

3. 正常安装melodic即可,我还是把官方的命令再粘贴一遍

http://wiki.ros.org/melodic/Installation/Ubuntu

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

sudo apt update

sudo apt install ros-melodic-ros-base

sudo rosdep init
rosdep update

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

sudo usermod -aG dialout $USER

安装完成,退出该终端,重新打开一个终端

4. 安装一些依赖包

sudo apt-get install -y ros-melodic-rosserial
 
sudo apt-get install -y ros-melodic-navigation
 
sudo apt-get install -y ros-melodic-teleop-twist-keyboard 
 
sudo ln -s /dev/ttyUSB0 /dev/xrbase

5. 把ros-core1903.zip 复制到 /home/pi 目录下,unzip 解压出 catkin_ws 目录,进入catkin_ws,删除build目录,然后执行catkin_make 重新编译,如果编译过程中出现缺少依赖,可以参考 https://blog.csdn.net/zhqh100/article/details/98594927,虽然这里面没有全部列举出所有的依赖包,不过也可以看出规律来,缺少什么就安装一下ros-melodic-xxxxx

6. 编译过程中会有一个报错,大致如下:

/home/pi/catkin_ws/src/xrrobot_project/riki_follower/src/follower.cpp:318:24: error: expected constructor, destructor, or type conversion before ‘(’ token
 PLUGINLIB_DECLARE_CLASS(riki_follower, RikiFollower, riki_follower::RikiFollower, nodelet::Nodelet);

解决方法为把上面一行改为

PLUGINLIB_EXPORT_CLASS(riki_follower::RikiFollower, nodelet::Nodelet);

如果再遇到类似错误,也是类似修改

7. 还有一个报错是

/home/pi/catkin_ws/src/xrrobot_project/frontier_exploration/src/explore_server.cpp:44:136: error: no matching function for call to ‘costmap_2d::Costmap2DROS::Costmap2DROS(const char [16], tf::TransformListener&)’

没有解决,我直接把目录frontier_exploration干掉了

8. 编译完成后添加环境变量

echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
 
sudo usermod -aG dialout $USER

9.另起终端启动服务

roslaunch xrrobot bringup.launch

要键盘控制小车运行,另起一个终端,执行如下命令即可

rosrun teleop_twist_keyboard teleop_twist_keyboard.py

10. 

sudo apt install git libv4l-dev
sudo apt install ros-melodic-depth-image-proc
sudo apt install ros-melodic-camera-info-manager
sudo apt install ros-melodic-tf2-geometry-msgs
sudo apt install ros-melodic-costmap-2d
sudo apt install ros-melodic-geographic-msgs
sudo apt install ros-melodic-move-base-msgs
sudo apt install libpcl-dev
sudo apt install ros-melodic-rosserial-python 
sudo apt install libusb-1.0-0-dev 
sudo apt install libudev-dev

11. 

roscore
rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0 _baud:=115200
rosrun teleop_twist_keyboard teleop_twist_keyboard.py

 

It seems that there is an error related to the `realsense2_camera` package in the ROS workspace. The error message suggests that the package cannot be found in the ROS package path. The package path is a list of directories where ROS looks for packages. The `ROS_PACKAGE_PATH` environment variable is set to this list of directories. In your case, the package path includes three directories: `/opt/ros/melodic/share/ros`, `/home/wdr/handeye-calib/src/handeye-calib`, and `/opt/ros/melodic/share`. To resolve the error, you can try the following steps: 1. Make sure that the `realsense2_camera` package is installed in your system. You can do this by running the following command: ``` dpkg -l | grep realsense ``` This will list all the packages related to RealSense cameras. Make sure that the `realsense2-camera` package is installed. 2. Check if the package path is set correctly. You can do this by running the following command: ``` echo $ROS_PACKAGE_PATH ``` This will print the current value of the `ROS_PACKAGE_PATH` environment variable. Make sure that the directory where the `realsense2_camera` package is installed is included in the package path. 3. If the package path is not set correctly, you can add the directory where the `realsense2_camera` package is installed to the package path. You can do this by running the following command: ``` export ROS_PACKAGE_PATH=/path/to/realsense2_camera:$ROS_PACKAGE_PATH ``` Replace `/path/to/realsense2_camera` with the actual path to the directory where the `realsense2_camera` package is installed. 4. If the above steps do not work, you can try reinstalling the `realsense2_camera` package and/or the ROS distribution you are using. If you continue to experience issues, the traceback written to the log file may provide additional information that could help you diagnose the issue.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值