ubuntu 22.04源码装ros1 noetic

这篇具有很好参考价值的文章主要介绍了ubuntu 22.04源码装ros1 noetic。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

ubuntu 22.04源码装ros1 noetic


参考链接

https://gist.github.com/Meltwin/fe2c15a5d7e6a8795911907f627255e0

1. 安装依赖

sudo apt-get install python3-rosdep python3-rosinstall-generator python3-vcstools python3-vcstool build-essential

2. 更换rosdep相关的rep链接

参考:https://blog.csdn.net/zyh821351004/article/details/135519444?spm=1001.2014.3001.5501

mkdir -p ~/.ros/rosdep
cd ~/.ros/rosdep
~/.ros/rosdep$ git clone git@github.com:ros/rosdistro.git 

cat rosdep/sources.list.d/20-default.list
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/base.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/python.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/robot/.ros/rosdep/rosdistro/releases/fuerte.yaml fuerte
 
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list

 
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/base.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/python.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/robot/.ros/rosdep/rosdistro/releases/fuerte.yaml fuerte
 
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

sudo gedit /usr/lib/python3/dist-packages/rosdep2/sources_list.py

#DEFAULT_SOURCES_LIST_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list'
DEFAULT_SOURCES_LIST_URL = 'file:///home/robot/.ros/rosdep/rosdistro/rosdep/sources.list.d/20-default.list'

sudo gedit /usr/lib/python3/dist-packages/rosdep2/rep3.py

#REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
REP3_TARGETS_URL = 'file:///home/robot/.ros/rosdep/rosdistro/releases/targets.yaml'

sudo gedit /usr/lib/python3/dist-packages/rosdistro/init.py

#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///home/robot/.ros/rosdep/rosdistro/index-v4.yaml'
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list 
sudo rosdep init
rosdep update

3. 安装 rosdep

sudo rosdep init
rosdep update

4. 创建工作空间下载源码并安装

mkdir ./noetic_ws
cd ./noetic_ws
rosinstall_generator desktop --rosdistro noetic --deps --tar > noetic-desktop.rosinstall
mkdir ./src
vcs import --input noetic-desktop.rosinstall ./src


rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y

等待下载完成
备份打包源码 csdn_下载:

noetic-desktop.rosinstall  noetic-base.rosinstall
noetic-desktop.rosinstall   737行

类似:
- tar:
    local-name: actionlib/actionlib
    uri: https://github.com/ros-gbp/actionlib-release/archive/release/noetic/actionlib/1.14.0-1.tar.gz
    version: actionlib-release-release-noetic-actionlib-1.14.0-1
- tar:
    local-name: angles
    uri: https://github.com/ros-gbp/geometry_angles_utils-release/archive/release/noetic/angles/1.9.13-1.tar.gz
    version: geometry_angles_utils-release-release-noetic-angles-1.9.13-1
/opt/ros/noetic_ws/src$ ls
actionlib              metapackages           rqt_moveit
angles                 navigation_msgs        rqt_msg
bond_core              nodelet_core           rqt_nav_view
catkin                 pluginlib              rqt_plot
class_loader           python_qt_binding      rqt_pose_view
cmake_modules          qt_gui_core            rqt_publisher
common_msgs            qwt_dependency         rqt_py_console
common_tutorials       resource_retriever     rqt_reconfigure
control_msgs           robot_state_publisher  rqt_robot_dashboard
diagnostics            ros                    rqt_robot_monitor
dynamic_reconfigure    rosbag_migration_rule  rqt_robot_plugins
executive_smach        ros_comm               rqt_robot_steering
filters                ros_comm_msgs          rqt_runtime_monitor
gencpp                 rosconsole             rqt_rviz
geneus                 rosconsole_bridge      rqt_service_caller
genlisp                roscpp_core            rqt_shell
genmsg                 ros_environment        rqt_srv
gennodejs              roslint                rqt_tf_tree
genpy                  roslisp                rqt_top
geometry               rospack                rqt_topic
geometry2              ros_tutorials          rqt_web
geometry_tutorials     rqt                    rviz
gl_dependency          rqt_action             std_msgs
image_common           rqt_bag                urdf
interactive_markers    rqt_common_plugins     urdf_tutorial
joint_state_publisher  rqt_console            vision_opencv
kdl_parser             rqt_dep                visualization_tutorials
laser_geometry         rqt_graph              webkit_dependency
media_export           rqt_image_view         xacro
message_generation     rqt_launch
message_runtime        rqt_logger_level

5. 编译代码

./src/catkin/bin/catkin_make_isolated -DCMAKE_BUILD_TYPE=Release

会遇到一些列报错:

5.1 修复rosconsole* log相关问题error

用rosconsole_log4cxx.cpp里面的代码全部替换源代码src/rosconsole/src/rosconsole/impl/rosconsole_log4cxx.cpp

替代rosconsole_log4cxx.cpp
https://gist.github.com/kintzhao/3947142d3161e11e5a0c326b79e9ebdb### 5.2 qt5库相关的安装

sudo apt install  libqt5widgets5  qtcreator qtbase5-dev qt5-qmake cmake

5.3 python-sip配置相关

sudo apt install  sip-dev python3-sip-dev python3-pyqt5.sip
sudo apt install  python3-pyqt5.sip python3-pyqt5 pyqt5-dev 

5.4 std::share_mutex 相关 c++11 与c++17

下载 change_cpp.py 文件到ws路径下,change_cpp.py

import os
from colorama import Fore, Style

WANTED_WIDTH = 100
DISPLAY_WIDTH = min(WANTED_WIDTH, os.get_terminal_size().columns - 2)
print("┏" + "".center(DISPLAY_WIDTH, "━") + "┓")
print(f"┃{Fore.RED}" + "CMakeLists to C++17 Utils".center(DISPLAY_WIDTH, " ") + f"{Style.RESET_ALL}┃")
print(f"┃{Style.BRIGHT+ Fore.BLACK}" + "Meltwin - 2023".center(DISPLAY_WIDTH, " ") + f"{Style.RESET_ALL}┃")
print("┗" + "".center(DISPLAY_WIDTH, "━") + "┛")
print()

REPLACE_FILTER = {
    "-std=c++11":"-std=c++17",
    "COMPILER_SUPPORTS_CXX11": "COMPILER_SUPPORTS_CXX17",
    "CMAKE_CXX_STANDARD 11": "CMAKE_CXX_STANDARD 17",
    "CMAKE_CXX_STANDARD 14": "CMAKE_CXX_STANDARD 17"
}

def fix_cmakelist(cmakelist_path: str) -> None:
    print(f"{Fore.YELLOW}{Fore.RESET}Found {Fore.RED}{cmakelist_path}{Fore.RESET}", end=" ")
    with open(cmakelist_path, "r") as handle:
        data = handle.read()

    # Replacing
    changed = False
    for key, value in REPLACE_FILTER.items():
        if data.find(key) != -1:
            data = data.replace(key, value)
            changed = True

    if changed:
        with open(cmakelist_path, "w") as handle:
            handle.write(data)
    print(f"{Fore.GREEN}Fixed !" if changed else f"{Fore.BLUE}Nothing to change")

def walk_dir(dir: str, depth = 0) -> None:
    if depth >=2:
        return
    for d in os.listdir(dir):
        cmakelist_path = f"{dir}/{d}/CMakeLists.txt"
        if not os.path.isfile(cmakelist_path):
            walk_dir(f"{dir}/{d}", depth+1)
        else :
            fix_cmakelist(cmakelist_path)

if __name__ == "__main__":
    # Get all the CMakeLists.txt
    walk_dir("./src")

将当前src目录下工程cmake中c++17方式的调整为c++11

  python3 change_cpp.py

5.5 opencv库的安装

 sudo apt install  libopencv-dev

5.6 assimp 库安装

 sudo apt install  libassimp-dev python3-pyassimp

5.7 ogre库的安装

sudo apt install  libogre-1.12-dev
sudo apt install  libogre1.12.10

5.8 ogre库中class Vector3 传统问题,

注释掉文件plant_flag_tool.h imu_visual.h 中的class Vector3 定义

gedit /opt/ros/noetic_ws/src/visualization_tutorials/rviz_plugin_tutorials/src/plant_flag_tool.h

namespace Ogre
{
class SceneNode;
//class Vector3;
}

gedit /opt/ros/noetic_ws/src/visualization_tutorials/rviz_plugin_tutorials/src/imu_visual.h

namespace Ogre
{
//class Vector3;
class Quaternion;
}

编译基本就可以通过了,一共184个包

<== Finished processing package [184 of 184]: 'xacro'

6. 安装版

当前路径安装 或 指定路径安装文章来源地址https://www.toymoban.com/news/detail-792587.html

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

到了这里,关于ubuntu 22.04源码装ros1 noetic的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 如何像正常使用ROS一样使用Docker ROS?Ubuntu22.04在docker中安装noetic版本ROS

    自从买了新电脑,遇到的麻烦接连不断。先是安装Ubuntu系统安装不上,安装完成之后网卡、触控板等硬件都没有打上驱动,折腾了老半天,把ubuntu的内核升级到了Ubuntu20.04所支持的最高版本,然而还是没有解决驱动的问题,遂一气之下将系统升级为了Ubuntu22.04,这一次安装完系

    2024年04月17日
    浏览(38)
  • Ubuntu22.04安装ROS

    在安装ROS之前,需要先安装Ubuntu22.04操作系统。您可以从Ubuntu官网下载Ubuntu22.04的最新版本镜像文件,并创建一个可启动的USB。您可以参考以下步骤: 在安装ROS之前,需要先安装Ubuntu22.04操作系统。您可以从Ubuntu官网下载Ubuntu22.04的最新版本镜像文件,并创建一个可启动的USB。

    2024年02月10日
    浏览(41)
  • ubuntu22.04安装ros教程

    安装 ROS 是一个比较复杂的过程,不同版本的 Ubuntu 系统对应的 ROS 版本也不尽相同,因此需要认真阅读官方教程。 下面是在 Ubuntu 22.04 上安装 ROS 的一般步骤: 更新系统:打开终端,运行以下命令:

    2024年02月16日
    浏览(39)
  • Ubuntu22.04安装ROS2

    更新 apt 库 安装语言编码并且设置格式: 更新软件源 ps:如果在第三条命令输入之后出现了一下警告或者类似报错,如果没有,直接跳到第四步即可 解决办法就是设置 hosts 的域名位置跳转 List item 打开浏览器并且输入然后粘贴进入:https://www.ipaddress.com 在下面的输入栏中键入

    2024年02月02日
    浏览(36)
  • 【ROS系统】Ubuntu22.04系统中安装ROS2系统

    参考博客:ROS 安装详细教程 —— Ubuntu22.0.4 LTS 安装 首先,我们需要一个Ubuntu系统。 终端输入指令: 从ubuntu系统界面进行设置: 设置-软件升级-Ubuntu software- source code 为source code选择国内镜像源 确定镜像源可用 通过检查此命令的输出,确保已启用Ubuntu Universe存储库。 apt-ca

    2024年04月27日
    浏览(39)
  • ROS2学习(一):Ubuntu 22.04 安装 ROS2(Iron Irwini)

    一、ROS2(Iron Irwini)介绍 官方文档 Iron Irwini版本支持的平台如下: 二、ROS2(Iron Irwini)安装 1.设置编码 2.使能代码库 现在用apt添加带ROS 2 GPG 将存储库添加到源列表中 3.安装ROS2 Iron 三、ROS2测试 在terminal 1 运行下面的指令: 在terminal 2 运行下面的指令: 四、ROS2卸载 删除RO

    2024年02月10日
    浏览(31)
  • 在Ubuntu22.04系统安装ROS Humble Hawksbill

    目录 一、简述 二、下载安装虚拟机 2.1下载 2.2安装虚拟机 2.3安装Ubuntu系统  三、安装ros 3.1设置编码 3.2添加源 3.3安装ros 3.4设置环境变量 四、检验是否安装成功 五、常见问题说明 ROS Humble Hawksbill 是 ROS 2 的第八个版本。它是最新的长期支持版本的 ROS 2 发行版,可以轻松安装

    2024年02月16日
    浏览(38)
  • (Ubuntu22.04 Jammy)安装ROS2 Humble

    提示:以下内容是已经安装了ubuntu22.04 下进行安装ros2 请确保区域设置支持UTF-8,我们使用以下设置进行测试。 需要将ROS2 apt存储库添加到您的系统中,首先确保Ubuntu Universe存储库已启用。 接着添加带有apt的ROS 2 GPG密钥 然后将存储库添加到源列表中 设置存储库后,更新您的a

    2024年02月01日
    浏览(36)
  • ubuntu22.04,ros2使用自带opencv读取图片

    从网上找了很久的ros2如何使用自带的opencv库或者自定义安装opencv库的教程,自己看的云里雾里的,跟着配置走下来依旧是不能使用,出现的最多的问题,就是找不到头文件或者undefined reference to \\\'cv::imread(std::cxxll::basic stringchar, std::char traits, std::allocator const, int)\\\'这一类的未定义

    2024年02月10日
    浏览(37)
  • 树莓派4B+Ubuntu22.04 Server安装ROS2 Humble

    通过本章学习,了解ROS2相关版本,能够熟练掌握ROS2安装相关操作,最终让 Talker-listener 实例跑起来。 参考网站: ROS2官网:https://www.ros.org/ ROS2 Humble版本:https://docs.ros.org/en/humble/Installation.html 注意:如果对ROS已经有一定的了解,可以忽略此章节。 更多更具体的ROS介绍请查看

    2024年02月11日
    浏览(30)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包