按照以下步骤照做就可以了,很简单的,就是浪费一点点时间罢了。也可以退而求其次,买个树莓派3B+来玩,哈哈。

Step 1: Install Dependecies and Download the Packages

Let’s start by setting up the repositories and installing the necessary dependencies

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-get update
sudo apt-get install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential  cmake

Then initialize rosdep and update it

sudo rosdep init
rosdep update

When that’s done let’s create a dedicated catkin workspace for building ROS and move to that directory.

mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws

Now you have two choices:

ROS-Comm: (Bare Bones) installation – might be preferred choice for Raspberry Pi, since you probably will be running it headless anyway, if you are using it for a robot. Doesn’t include RVIZ, which makes installation process shorter and less hassle.

Desktop Install: includes GUI tools, such as rqt, rviz, and robot-generic libraries.

I’ll go with installing Desktop Install here.

rosinstall_generator desktop --rosdistro melodic --deps --wet-only --tar > melodic-desktop-wet.rosinstall<br>wstool init -j8 src melodic-desktop-wet.rosinstall

The command will take a few minutes to download all of the core ROS packages into the src folder.

If wstool init fails or is interrupted, you can resume the download by running:

 wstool update -j 4 -t src

Step 2: Fix the Issues

Let’s install the compatible version of Assimp (Open Asset Import Library) to fix collada_urdf dependency problem.

mkdir -p ~/ros_catkin_ws/external_src
cd ~/ros_catkin_ws/external_src
wget   http://sourceforge.net/projects/assimp/files/assimp-3.1/assimp-3.1.1_no_test_models.zip/download -O assimp-3.1.1_no_test_models.zip
unzip assimp-3.1.1_no_test_models.zip
cd assimp-3.1.1
cmake .
make
sudo make install

Let’s also install OGRE for rviz

sudo apt-get install  libogre-1.9-dev

Finally we’ll need to fix the issues with libboost. I’m using the solution from this post on stackoverflow:

“The errors during compilation are caused by the ‘boost::posix_time::milliseconds’ function which 
in newer boost versions accepts only an integer argument, but the actionlib package in ROS, gives it a float on several places. You can list all files using that function:

find -type f -print0 | xargs -0 grep ‘boost::posix_time::milliseconds’ | cut -d: -f1 | sort -u

Open them in your text editor and search for the 
‘boost::posix_time::milliseconds’ function call.

and replace calls like this:

boost::posix_time::milliseconds(loop_duration.toSec() * 1000.0f));

with:

boost::posix_time::milliseconds(int(loop_duration.toSec() * 1000.0f)));

and these:

boost::posix_time::milliseconds(1000.0f)

with:

boost::posix_time::milliseconds(1000)

I recommend you use nano text editor, which is simpler than VIM (这点作者的观点我并不认可), Ctrl+O is saving, Ctrl+X is exiting and Ctrl+W is searching.

Next we use the rosdep tool for installing all the rest of the dependencies:

rosdep install --from-paths src --ignore-src --rosdistro melodic -y

Add TipAsk QuestionCommentDownload

Step 3: Build and Source the Installation

Once it has completed downloading the packages and resolving the dependencies you are ready to build the catkin packages.

sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/melodic -j2

If the compilation process freezes(very likely, if you install the desktop version), you need to increase swap space available. By default it’s 100 MB, try increasing it to 2048 MB.

Good luck! The whole compilation process takes about 1 hour, so go make some tea.

Now ROS Melodic should be installed on your Raspberry Pi 4. We’ll source the new installation with following command:

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

Try launching roscore to check if everything was successful.Add TipAsk QuestionCommentDownload

Step 4: Install RPLIDAR ROS Package

Let’s create a separate workspace for other packages, that are not part of core ROS.

From you home folder do:

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make

and source it to bashrc:

echo "source $HOME/catkin_ws/devel/setup.bash" >> ~/.bashrc

Okay, we’re ready to start installing RPLIDAR ROS package.

cd src
sudo git clone https://github.com/Slamtec/rplidar_ros.git
catkin_make

Wait for the package compilation to finish. Try launching the package to see if the compilation was successful:

roslaunch rplidar_ros rplidar.launch

If it doesn’t output any errors, do a quick celebration dance(*optional).

Now only the last piece is missing – since you are probably running Raspberry Pi 4 in headless mode, we can’t visualize lidar messages. For that we’ll need to set-up ROS to run on multiple machines.Add TipAsk QuestionCommentDownload

Step 5: Set Up ROS to Run on Multiple Machines

For this part you will need a Ubuntu 18.04 computer with ROS Melodic installed. Since it’s Ubuntu ROS can be simply installed using apt-get as described in this tutorial.

After you have working ROS installation both on Raspberry Pi and your desktop machine, check the IP addresses of both machines. They need to be on the same network!

Run roscore on your desktop computer and export ROS_MASTER_URI

roscore
export ROS_MASTER_URI=http://[your-desktop-machine-ip]:11311

Next on Raspberry PI execute

export ROS_MASTER_URI=http://[your-desktop-machine-ip]:11311
export ROS_IP=[your-desktop-machine-ip]

and launch RPILIDAR launch file

roslaunch rplidar_ros rplidar.launch

If it launches successfully, check the topics present on your desktop machine with rostopic list

If you can see / scan mesages, everything works as it supposed to work. Then launch RVIZ on your desktop machine, add Laser Scan messages and choose /scan topic. You will also need to change fixed frame to /laser.

Voila!Add TipAsk QuestionCommentDownload

Step 6: Done!

This guide can be a first step towards building your ROS robot on top of new Raspberry Pi 4. We have installed ROS Melodic and prepared the installation for running headless and connecting to our desktop machine over wireless network for remote control.

Next steps are dependent on what type of robot you want to build. You can add motors and encoders for odometry, stereo camera for Visual SLAM and all sorts of other exciting and useful things.

在树莓派4b上安装 ROS MELODIC 源码安装的更多相关文章

  1. 在ConoHa上Centos7环境下源码安装部署LNMP

    本文记录了从源码,在Centos 7上手动部署LNMP环境的过程,为了方便以后对nginx和mariadb进行升级,这里采用yum的方式进行安装. 1.建立运行网站和数据库的用户和组 groupadd ...

  2. 004-nginx简介、安装配置【源码安装和mac安装】、基本使用

    一.概述 1.1.Nginx是什么 Nginx是一款轻量级的Web服务器,也是一款轻量级的反向代理服务器[常用]. 1.2.Nginx能干什么 Nginx能干的事情很多,这里简要罗列一些: 1:直接支 ...

  3. Redis for linux安装配置之—-源码安装

    一‘redis单实例安装配置1.下载redis源码压缩包,并将其上传至服务器/usr/local2.解压redis源码压缩包  # tar -xzvf redis-3.2.12.tar.gz3.进入r ...

  4. nginx安装,手动源码安装

    什么是Nginx? Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Ra ...

  5. Mysql for Linux安装配置之—— 源码安装

    1.安装 --假设已经有mysql-5.5.10.tar.gz以及cmake-2.8.4.tar.gz两个源码压缩文件1)先安装cmake(mysql5.5以后是通过cmake来编译的)   # ta ...

  6. 【SystemTap】 Linux下安装使用SystemTap源码安装SystemTap

    转自 http://blog.csdn.net/zklth/article/details/6248558 文章 http://blog.csdn.net/zklth/archive/2010/09/ ...

  7. Red hat Linux 安装Node.js 源码安装

    1. 下载源码包 http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz 2.准备安装环境,>python2.6, gcc, g++ pytho ...

  8. 【只需3步】Linux php的安装与配置[源码安装]

    作者小波/QQ463431476欢迎转载! Linux:redhat 6/centos 6 继续上一篇笔记Apache的配置http://www.cnblogs.com/xiaobo-Linux/p/ ...

  9. 如何在CentOS 7中安装最新Git(源码安装)

    如何在CentOS 7中安装最新Git 2017年05月20日 11:49:53 阅读数:1624 Git是在今天的软件开发行业一个非常有用的版本控制工具.我一直使用Git.于是为Linux公社的读者 ...

随机推荐

  1. eventFlow 系列 <三> 查询所有

    接着上面的例子,产生2条数据.怎么把这两条数据查询出来呢? var commandBus = resolver.Resolve<ICommandBus>(); , ); var execu ...

  2. 学习笔记-Rabin-Karp哈希

    在数学一本通上看过这两人名字,现在又出现了... 思想: 用一个整数表示一个字符串 \(w_{str}\)=(\(a_0\) \(p^{n-1}\)+\(a_1\) \(p^{n-2}\)+...+\ ...

  3. restTemplate源码解析(三)创建ClientHttpRequest请求对象

    所有文章 https://www.cnblogs.com/lay2017/p/11740855.html 正文 上一篇文章中,我们大体看了一下restTemplate的核心逻辑.再回顾一下核心代码 p ...

  4. js中this关键字用法详解

    1.全局环境中的this 在全局环境中,this 指向全局对象Global,即 window 对象 如: alert(this); // 显示 [object Window] alert(this = ...

  5. cordova 和 java ( JDK ) 和 android-studio (SDK)的初始安装和配置

    一:前言(2018) 之前封装APP都是用的HBuilder结合mui来封装的简单app,有空的时候想研究下之前的phonegap来封装app.然后遇到的问题还是蛮多的,毕竟之前没弄过. 下面的步骤主 ...

  6. 3.Java集合-HashSet实现原理及源码分析

    一.HashSet概述: HashSet实现Set接口,由哈希表(实际上是一个HashMap实例)支持,它不保证set的迭代顺序很久不变.此类允许使用null元素 二.HashSet的实现: 对于Ha ...

  7. 纪念一下,时隔多年,继delphi上成功运行sql之后

    纪念一下,时隔多年,继delphi上成功运行sql之后,在linux上用eclipse成功运行Wordcount程序,不容易呀,折腾了十几天 但我知道,这仅仅是我学习大数据的一个开始,仅此纪念一下,不 ...

  8. mysql 忘记/修改数据库密码

    window mysql 修改密码 方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = ...

  9. 如何利用while语句打印“九九乘法口诀表”

    需求:输出九九乘法表 plus.py代码如下: i=1 j=1 while i<=9: j=1 while j<=i: print(j,'*',i,'=',str(i*j)+' ',end ...

  10. 洛谷P5002 专心OI - 找祖先

    题目概括 题目描述 这个游戏会给出你一棵树,这棵树有\(N\)个节点,根结点是\(R\),系统会选中\(M\)个点\(P_1,P_2...P_M\). 要Imakf回答有多少组点对\((u_i,v_i ...