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.youkuaiyun.com/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

 

### RK3399 ROS Setup and Configuration #### Installation of Ubuntu System For setting up the Robot Operating System (ROS) on an RK3399 hardware platform, starting with a suitable operating system is essential. The choice here leans towards installing Ubuntu 18.04 as it provides stability along with compatibility for running ROS applications effectively[^4]. #### Installing ROS on RK3399 Once the Ubuntu environment has been established successfully, proceeding to install ROS becomes straightforward. For comprehensive development purposes including simulation tools like RViz and Gazebo alongside core libraries necessary for building robotic systems, opting for a full desktop installation proves beneficial. The command used specifically targets this kind of setup: ```bash sudo apt-get update && sudo apt-get upgrade -y 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://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 sudo apt-get update sudo apt-get install ros-melodic-desktop-full ``` This ensures that all dependencies required by ROS are met within your current Linux distribution while also fetching any updates available from official repositories before initiating the actual package download process[^3]. After completing these steps, initializing `rosdep` can help manage additional dependency requirements efficiently across different packages one might wish to integrate into projects later down the line: ```bash sudo rosdep init rosdep update ``` Setting up environmental variables permanently allows easier access whenever working inside terminal sessions without needing repeated configurations each time they start anew: ```bash echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc ``` To verify whether everything was set correctly after following through above instructions, executing commands such as checking version information should yield positive results indicating successful completion of initial stages outlined so far: ```bash rosversion -d ``` #### Building Custom Packages Creating custom workspace directories facilitates organizing personal developments separately outside default paths provided during standard installations. This approach helps maintain cleanliness between original files versus those modified or created independently over time due to project-specific needs arising periodically throughout experimentation phases involving SLAM algorithms among others. Establishing new workspaces involves creating directory structures followed by invoking build processes using Catkin—the de facto build tool utilized widely within ROS communities today: ```bash mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make source devel/setup.bash ``` These actions prepare grounds whereupon further coding activities may commence comfortably knowing infrastructure already laid out supports rapid prototyping cycles demanded frequently when iterating upon ideas rapidly during research endeavors focused around robotics technologies leveraging platforms similar to RK3399 equipped appropriately via software stacks mentioned earlier hereinbefore described comprehensively enough covering key aspects related directly thereto accordingly[^5].
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值