目录
容器
编译?
foxy
RViz2?
容器
修改docker镜像保存路径
$ systemctl show --property=FragmentPath docker
$ sudo mkdir /ssd/docker
$ sudo vi /lib/systemd/system/docker.service
--graph=/ssd/docker
$ sudo systemctl daemon-reload
$ sudo service docker restart
安装portainer
$ docker pull portainer/portainer
$ docker run -d -p 9000:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --name portainer-test portainer/portainer
拉取?nvidiajetson/l4t-ros2-foxy-pytorch:r32.5镜像
$ docker pull nvidiajetson/l4t-ros2-foxy-pytorch:r32.5
利用portainer创建容器,web界面进入容器使能ssh服务,并允许root用户登录。
$ apt update
$ apt install ssh
$ vi /etc/ssh/sshd_config
PermitRootLogin yes
$ passwd
$ service ssh start
编译?
foxy
?编译ROS2 foxy
$ cd /opt/ros/foxy
$ colcon build --symlink-install
Summary: 200 packages finished [28min 1s]
Summary: 200 packages finished [17min 2s]
运行demo
$ ros2 topic list
$ ros2 run demo_nodes_cpp talker
RViz2?
编译RViz2
$ cd /workspace/ros2_ws/src
$ git clone -b foxy https://github.com/ros2/rviz.git
Cloning into 'rviz'...
remote: Enumerating objects: 27003, done.
remote: Counting objects: 100% (828/828), done.
remote: Compressing objects: 100% (313/313), done.
remote: Total 27003 (delta 625), reused 574 (delta 468), pack-reused 26175
Receiving objects: 100% (27003/27003), 15.33 MiB | 898.00 KiB/s, done.
Resolving deltas: 100% (19620/19620), done.
$ cd /workspace/ros2_ws
$ source /opt/ros/foxy/install/setup.bash
$ colcon build --symlink-install
Starting >>> rviz_assimp_vendor
Starting >>> rviz_ogre_vendor
Starting >>> hand_pose_msgs
Starting >>> pose_msgs
Starting >>> ros2_trt_pose
Finished <<< ros2_trt_pose [5.22s]
--- stderr: pose_msgs
Error parsing '/workspace/ros2_ws/src/ros2_trt_pose/pose_msgs/package.xml':
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 596, in parse_package_string
root = dom.parseString(data)
File "/usr/lib/python3.6/xml/dom/minidom.py", line 1968, in parseString
return expatbuilder.parseString(string)
File "/usr/lib/python3.6/xml/dom/expatbuilder.py", line 925, in parseString
return builder.parseString(string)
File "/usr/lib/python3.6/xml/dom/expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: XML or text declaration not at start of entity: line 18, column 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/ros/foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 143, in <module>
main()
File "/opt/ros/foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 52, in main
raise e
File "/opt/ros/foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 49, in main
args.package_xml.read(), filename=args.package_xml.name)
File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 598, in parse_package_string
raise InvalidPackage('The manifest contains invalid XML:\n%s' % ex, filename)
catkin_pkg.package.InvalidPackage: Error(s) in package '/workspace/ros2_ws/src/ros2_trt_pose/pose_msgs/package.xml':
The manifest contains invalid XML:
XML or text declaration not at start of entity: line 18, column 0
CMake Error at /opt/ros/foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:94 (message):
execute_process(/usr/bin/python3
/opt/ros/foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
/workspace/ros2_ws/src/ros2_trt_pose/pose_msgs/package.xml
/workspace/ros2_ws/build/pose_msgs/ament_cmake_core/package.cmake) returned
error code 1
Call Stack (most recent call first):
/opt/ros/foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
/opt/ros/foxy/install/rosidl_cmake/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:226 (ament_package_xml)
CMakeLists.txt:25 (rosidl_generate_interfaces)
---
Failed <<< pose_msgs [7.19s, exited with code 1]
Aborted <<< hand_pose_msgs [11.5s]
Aborted <<< rviz_assimp_vendor [4min 47s]
Aborted <<< rviz_ogre_vendor [8min 39s]
Summary: 1 package finished [8min 42s]
1 package failed: pose_msgs
3 packages aborted: hand_pose_msgs rviz_assimp_vendor rviz_ogre_vendor
2 packages had stderr output: pose_msgs rviz_ogre_vendor
7 packages not processed
删除package.xml文件中<?xml version="1.0"?>前的注释部分。
$ vi /workspace/ros2_ws/src/ros2_trt_pose/pose_msgs/package.xml
$ colcon build --symlink-install
Starting >>> rviz_assimp_vendor
Starting >>> rviz_ogre_vendor
Starting >>> hand_pose_msgs
Starting >>> pose_msgs
Starting >>> ros2_trt_pose
Finished <<< ros2_trt_pose [6.90s]
--- stderr: rviz_ogre_vendor
CMake Error at CMake/Utils/MacroLogFeature.cmake:100 (MESSAGE):
-----------------------------------------------------------------------------
-- The following REQUIRED packages could NOT be located on your system.
-- Please install them before continuing this software installation.
-- If you are in Windows, try passing -DOGRE_DEPENDENCIES_DIR=<path to
dependencies>
-----------------------------------------------------------------------------
+ Xaw: X11 Athena widget set <http://www.x.org>
-----------------------------------------------------------------------------
Call Stack (most recent call first):
CMake/FeatureSummary.cmake:234 (MACRO_DISPLAY_FEATURE_LOG)
CMakeLists.txt:516 (include)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
X11_Xrandr_LIB (ADVANCED)
linked by target "OgreGLSupport" in directory /workspace/ros2_ws/build/rviz_ogre_vendor/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GLSupport
make[2]: *** [ogre-v1.12.1-prefix/src/ogre-v1.12.1-stamp/ogre-v1.12.1-configure] Error 1
make[1]: *** [CMakeFiles/ogre-v1.12.1.dir/all] Error 2
make: *** [all] Error 2
---
Failed <<< rviz_ogre_vendor [7.88s, exited with code 2]
Aborted <<< rviz_assimp_vendor [12.2s]
Aborted <<< pose_msgs [13.0s]
Aborted <<< hand_pose_msgs [21.6s]
Summary: 1 package finished [24.6s]
1 package failed: rviz_ogre_vendor
3 packages aborted: hand_pose_msgs pose_msgs rviz_assimp_vendor
1 package had stderr output: rviz_ogre_vendor
7 packages not processed
安装libxaw7-dev...等。
$ apt install libxaw7-dev libxrandr-dev libfreetype6-dev qt5-default
再次编译。
$ colcon build --symlink-install
Starting >>> rviz_assimp_vendor
Starting >>> rviz_ogre_vendor
Starting >>> hand_pose_msgs
Starting >>> pose_msgs
Starting >>> ros2_trt_pose
Finished <<< rviz_assimp_vendor [5.13s]
Finished <<< ros2_trt_pose [7.37s]
Finished <<< hand_pose_msgs [14.5s]
Starting >>> ros2_trt_pose_hand
Finished <<< ros2_trt_pose_hand [5.79s]
Finished <<< pose_msgs [29.2s]
[Processing: rviz_ogre_vendor]
...
Finished <<< rviz_ogre_vendor [18min 56s]
Starting >>> rviz_rendering
--- stderr: rviz_rendering
CMake Error at CMakeLists.txt:40 (find_package):
By not providing "Findresource_retriever.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"resource_retriever", but CMake did not find one.
Could not find a package configuration file provided by
"resource_retriever" with any of the following names:
resource_retrieverConfig.cmake
resource_retriever-config.cmake
Add the installation prefix of "resource_retriever" to CMAKE_PREFIX_PATH or
set "resource_retriever_DIR" to a directory containing one of the above
files. If "resource_retriever" provides a separate development package or
SDK, be sure it has been installed.
---
Failed <<< rviz_rendering [10.4s, exited with code 1]
Summary: 6 packages finished [19min 9s]
1 package failed: rviz_rendering
1 package had stderr output: rviz_rendering
5 packages not processed
克隆resource_retriever、interactive_markers、laser_geometry、navigation_msgs等源码,编译ros2。
cd /opt/ros/foxy/src
git clone -b foxy https://github.com/ros/resource_retriever
Cloning into 'resource_retriever'...
remote: Enumerating objects: 851, done.
remote: Counting objects: 100% (186/186), done.
remote: Compressing objects: 100% (129/129), done.
remote: Total 851 (delta 103), reused 110 (delta 54), pack-reused 665
Receiving objects: 100% (851/851), 136.08 KiB | 1.50 MiB/s, done.
Resolving deltas: 100% (472/472), done.
git clone -b foxy https://github.com/ros-visualization/interactive_markers
Cloning into 'interactive_markers'...
remote: Enumerating objects: 11211, done.
remote: Counting objects: 100% (85/85), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 11211 (delta 40), reused 37 (delta 20), pack-reused 11126
git clone -b foxy https://github.com/ros-perception/laser_geometry
Cloning into 'laser_geometry'...
remote: Enumerating objects: 835, done.
remote: Counting objects: 100% (70/70), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 835 (delta 30), reused 38 (delta 16), pack-reused 765
Receiving objects: 100% (835/835), 194.70 KiB | 1.37 MiB/s, done.
Resolving deltas: 100% (393/393), done.
git clone -b foxy https://github.com/ros-planning/navigation_msgs
Cloning into 'navigation_msgs'...
remote: Enumerating objects: 250, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 250 (delta 18), reused 37 (delta 11), pack-reused 200
Receiving objects: 100% (250/250), 35.25 KiB | 168.00 KiB/s, done.
Resolving deltas: 100% (99/99), done.
cd /opt/ros/foxy
colcon build --symlink-install
...
Summary: 206 packages finished [24min 33s]
2 packages had stderr output: libcurl_vendor resource_retriever
再次编译Rviz2
source /opt/ros/foxy/install/setup.bash
colcon build --symlink-install
|