ubuntu 22.04源码装ros1 noetic

2024-01-12 08:04
文章标签 源码 ubuntu ros1 22.04 noetic

本文主要是介绍ubuntu 22.04源码装ros1 noetic,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

ubuntu 22.04源码装ros1 noetic

文章目录

  • ubuntu 22.04源码装ros1 noetic
    • 1. 安装依赖
    • 2. 更换rosdep相关的rep链接
    • 3. 安装 rosdep
    • 4. 创建工作空间下载源码并安装
    • 5. 编译代码
      • 5.1 修复rosconsole* log相关问题**error**
      • 5.3 python-sip配置相关
      • 5.4 *std::share_mutex* 相关 c++11 与c++17
      • 5.5 opencv库的安装
      • 5.6 assimp 库安装
      • 5.7 ogre库的安装
      • 5.8 ogre库中class Vector3 传统问题,
    • 6. 安装版

参考链接

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 ./srcrosdep 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/actionliburi: https://github.com/ros-gbp/actionlib-release/archive/release/noetic/actionlib/1.14.0-1.tar.gzversion: actionlib-release-release-noetic-actionlib-1.14.0-1
- tar:local-name: anglesuri: https://github.com/ros-gbp/geometry_angles_utils-release/archive/release/noetic/angles/1.9.13-1.tar.gzversion: 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, StyleWANTED_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()# Replacingchanged = Falsefor key, value in REPLACE_FILTER.items():if data.find(key) != -1:data = data.replace(key, value)changed = Trueif 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:returnfor 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.txtwalk_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.hnamespace Ogre
{
class SceneNode;
//class Vector3;
}
gedit /opt/ros/noetic_ws/src/visualization_tutorials/rviz_plugin_tutorials/src/imu_visual.hnamespace Ogre
{
//class Vector3;
class Quaternion;
}

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

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

6. 安装版

当前路径安装 或 指定路径安装

./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的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/597256

相关文章

Ubuntu设置程序开机自启动的操作步骤

《Ubuntu设置程序开机自启动的操作步骤》在部署程序到边缘端时,我们总希望可以通电即启动我们写好的程序,本篇博客用以记录如何在ubuntu开机执行某条命令或者某个可执行程序,需要的朋友可以参考下... 目录1、概述2、图形界面设置3、设置为Systemd服务1、概述测试环境:Ubuntu22.04 带图

8种快速易用的Python Matplotlib数据可视化方法汇总(附源码)

《8种快速易用的PythonMatplotlib数据可视化方法汇总(附源码)》你是否曾经面对一堆复杂的数据,却不知道如何让它们变得直观易懂?别慌,Python的Matplotlib库是你数据可视化的... 目录引言1. 折线图(Line Plot)——趋势分析2. 柱状图(Bar Chart)——对比分析3

Ubuntu上手动安装Go环境并解决“可执行文件格式错误”问题

《Ubuntu上手动安装Go环境并解决“可执行文件格式错误”问题》:本文主要介绍Ubuntu上手动安装Go环境并解决“可执行文件格式错误”问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未... 目录一、前言二、系统架构检测三、卸载旧版 Go四、下载并安装正确版本五、配置环境变量六、验证安装七、常见

ubuntu如何部署Dify以及安装Docker? Dify安装部署指南

《ubuntu如何部署Dify以及安装Docker?Dify安装部署指南》Dify是一个开源的大模型应用开发平台,允许用户快速构建和部署基于大语言模型的应用,ubuntu如何部署Dify呢?详细请... Dify是个不错的开源LLM应用开发平台,提供从 Agent 构建到 AI workflow 编排、RA

ubuntu系统使用官方操作命令升级Dify指南

《ubuntu系统使用官方操作命令升级Dify指南》Dify支持自动化执行、日志记录和结果管理,适用于数据处理、模型训练和部署等场景,今天我们就来看看ubuntu系统中使用官方操作命令升级Dify的方... Dify 是一个基于 docker 的工作流管理工具,旨在简化机器学习和数据科学领域的多步骤工作流。

如何在Ubuntu上安装NVIDIA显卡驱动? Ubuntu安装英伟达显卡驱动教程

《如何在Ubuntu上安装NVIDIA显卡驱动?Ubuntu安装英伟达显卡驱动教程》Windows系统不同,Linux系统通常不会自动安装专有显卡驱动,今天我们就来看看Ubuntu系统安装英伟达显卡... 对于使用NVIDIA显卡的Ubuntu用户来说,正确安装显卡驱动是获得最佳图形性能的关键。与Windo

双系统电脑中把Ubuntu装进外接移动固态硬盘的全过程

《双系统电脑中把Ubuntu装进外接移动固态硬盘的全过程》:本文主要介绍如何在Windows11系统中使用VMware17创建虚拟机,并在虚拟机中安装Ubuntu22.04桌面版或Ubunt... 目录一、首先win11中安装vmware17二、磁盘分区三、保存四、使用虚拟机进行系统安装五、遇见的错误和解决

Android实现一键录屏功能(附源码)

《Android实现一键录屏功能(附源码)》在Android5.0及以上版本,系统提供了MediaProjectionAPI,允许应用在用户授权下录制屏幕内容并输出到视频文件,所以本文将基于此实现一个... 目录一、项目介绍二、相关技术与原理三、系统权限与用户授权四、项目架构与流程五、环境配置与依赖六、完整

Android实现定时任务的几种方式汇总(附源码)

《Android实现定时任务的几种方式汇总(附源码)》在Android应用中,定时任务(ScheduledTask)的需求几乎无处不在:从定时刷新数据、定时备份、定时推送通知,到夜间静默下载、循环执行... 目录一、项目介绍1. 背景与意义二、相关基础知识与系统约束三、方案一:Handler.postDel

CentOS和Ubuntu系统使用shell脚本创建用户和设置密码

《CentOS和Ubuntu系统使用shell脚本创建用户和设置密码》在Linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设置密码,本文写了一个shell... 在linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设