ubuntu 24.04安装ros1 noetic

为了后续能够找到安装方法,记录一下:

参考如下链接安装:

https://www.reddit.com/r/ROS/comments/158icpy/compiling_ros1_noetic_from_source_on_ubuntu_2204/

安装步骤如下:

1.获取apt 包

复制代码
sudo apt-get install python3-rosdep python3-rosinstall-generator python3-vcstools python3-vcstool build-essential

2.下载源文件

复制代码
sudo rosdep init && rosdep update

mkdir ~/ros_catkin_ws && cd ~/ros_catkin_ws

rosinstall_generator desktop --rosdistro noetic --deps --tar > noetic-desktop.rosinstall

mkdir ./src && vcs import --input noetic-desktop.rosinstall ./src

3.源文件修改

a、将源文件中所有CMakelist中编译标准改为c++ 17.

b、./src/rosconsole/src/rosconsole/impl/rosconsole_log4cxx.cpp 文件中作如下修改:

复制代码
Line 169: logger->addAppender(std::make_shared<ROSConsoleStdioAppender>());
Line 203: return log4cxx::Logger::getLogger(name).get();
Line 219: log4cxx::spi::LoggerRepositoryPtr repo(log4cxx::Logger::getLogger(ROSCONSOLE_ROOT_LOGGER_NAME)->getLoggerRepository());
Line 355: std::shared_ptr<Log4cxxAppender> g_log4cxx_appender;
Line 359: g_log4cxx_appender = std::make_shared<Log4cxxAppender>(appender);
Line 369: g_log4cxx_appender.reset();
Line 386: std::shared_ptr<log4cxx::spi::LoggerRepository>(log4cxx::Logger::getRootLogger()->getLoggerRepository())->shutdown();

上面是参考链接给的修改内容。除了上面要修改的地方,我在编译的生活还有一个地方报错,修改成如下形式。因为我已经对文件rosconsole_log4cxx.cpp作了上面的修改,所有是不是188行不太确认了,如果报"log4cxx::spi::LocationInfo"问题,按照下面修改就可以了。

复制代码
line 188: logger->forcedLog(g_level_lookup[level], str, (file,file, function, line));

4.编译

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

sudo cp -r ./install_isolated /opt/ros/noetic

5.最后

我在编译时还报了一个问题,就是我之前安装的是jazzy。所以在编译时会报ros变量名不对,这时对变量名做修改就可以了。具体怎么修改,百度。

相关推荐
北漂老男孩8 分钟前
在 Linux 上安装 MATLAB:完整指南与疑难解决方案
linux·运维·matlab
Why not try?!15 分钟前
Centos7 中 Docker运行配置Apache
运维·docker·容器
杰克逊的日记23 分钟前
Flink运维要点
大数据·运维·flink
hnlucky37 分钟前
如何彻底清空docker里面不使用的容器?
运维·docker·容器
像风一样的男人@1 小时前
Linux --systemctl损坏
linux·运维·服务器
南棱笑笑生1 小时前
20250515测试飞凌的OK3588-C的核心板在Linux R4下适配以太网RTL8211F-CG时跑iperf3的极速
linux·服务器·网络
南方以南_1 小时前
【云实验】搭建个人网盘实验
linux·运维·服务器
humors2211 小时前
Windows运维工具批处理版
运维·windows·计算机·电脑·笔记本·维护·台式机
酷爱码1 小时前
Linux实现临时RAM登录的方法汇总
linux·前端·javascript
muxue1781 小时前
chmod 777含义:
linux