Data Visualization with Java and VTK

本文介绍如何利用Java和The Visualization Toolkit (VTK)开发一个简单的应用程序来可视化科学数据。VTK是一个强大的C++库,用于处理和渲染数据,并且支持Java接口。通过Java Swing库创建GUI,可以实现与数据的交互,如旋转、平移和缩放。文章详细阐述了配置VTK Java包装器的过程,并讨论了VTK的可视化管道概念。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

官方地址连接
在这里插入图片描述
Introduction
In this post we’ll show you how to develop a simple Java application for visualizing scientific data. We will use The Visualization Toolkit (VTK) for the actual data analysis and rendering and Java Swing libraries for a simple GUI that will allow us to modify the plotted output.

Scientific Data Visualization
The typical output from a simulation code is a large file full of numbers. By itself, such a result is rather meaningless. These numbers correspond to the results at various spatial locations. Scientific visualization is the art of converting these numbers into a graphical format that can be understood and aid us in obtaining a new understanding about some physical problem. For example, consider a CAD/flow simulation of a rocket plume. The simulation grid may consist of millions of nodes and on each node we will have a value corresponding to the local plume density. But we may only be interested in the shape of the plume. We can easily visualize the plume by plotting the isosurface of some critical minimum value.

There are both commercial and open-source solutions for performing data visualization. Of the commercial kind, a popular program is Tecplot. The free alternatives include VisIt from Livermore, and Paraview from Kitware, Inc., the creators of the Visualization Toolkit, VTK. However, sometimes these options may not be quite adequate. For instance, you may be developing your own simulation software and would like to bundle the solver with a simple visualization output that will allow the user to study the results in real-time. This is where VTK comes in. The Visualization Toolkit is an amazing collection of C++ classes for processing and visualizing data. It is the engine that does the actual work. VTK is built on the concept of a visualization pipeline. The pipeline starts at one end with the source data and ends at the other end with an actor that correspond to the data’s visual representation. Along the way, in the pipeline, various operations are applied to obtain the output of interest. In order to add visualization to your program, you simply need to provide the algorithm to build the pipeline. The actual data processing and plotting is performed within the VTK library.

VTK provides a simple graphical window that can be used for plotting and interacting with the data (rotation, panning, zoom, etc…). Such an approach may be sufficient for simple console-based applications. But in order to develop an interactive end-user program, you’ll need to incorporate VTK within the GUI of your application. Luckily for us, VTK ships with a built-in support for both QT and Java. The QT/VTK combination was the basis for our simple visualization program, capVTE. Developed in 2003, capVTE attempted to merge a simplified user interface with the open-source nature of VTK, while at the same time supporting new concepts such as immersed and collaborative visualization. You can read more about capVTE here and here (the latter is the draft version but has color pictures). We are currently rewriting the software, however this time we are developing the code in Java. As discussed previously in our article on Java multithreading, the great benefit of Java is that it comes bundled with a large API. Instead of downloading, configuring, and compiling QT (a task for multiple hours), GUI support is natively built into Java via the Swing library.

VTK JAVA Wrappers
So how do you couple VTK with Java? It’s very easy. VTK comes with support for Java in the form of Java wrappers. In the following sections we show you how to install and configure the VTK / Java development environment and how to use it to build a simple Java GUI-driven application.

We are assuming you already have JDK and a Java development environment such as Netbeans or Eclipse installed. In addition you will need to download the VTK source and build it. This requires a working C++ compiler. On Windows, you can obtain the Microsoft Visual Studio Express Edition for free. Then follow these steps to get started:

  1. Download CMake from cmake.org. CMake is a cross-platform configuration tool for VTK. It will query your system for the available compilers and settings, and will generate the appropriate project files needed to build VTK.
  2. Download VTK source from vtk.org. Make sure to download the Source package and not the Windows Installer.
  3. Unzip the source to some temporary directory.
  4. Configure your project files by running CMake. Specify the location to the source files you just unzipped and also a different directory where to build the files. This build folder is used during the compilation stage, however at the end, files will be installed into the appropriate system folders. Click Configure to start the process. CMake will run for a while performing various system tests. It will finish with another screen with additional options highlighted in red.、
  5. Enable Java Wrapping by selecting the appropriate check box (see Figure 1). You will also need to enable the shared libraries. I generally uncheck build tests / examples to reduce the compilation time. Press Configure again. If everything went well, you will see the Generate button become available. Press this button to generate the project files.
    在这里插入图片描述
    Figure 1. Enable “VTK_WRAP_JAVA” during the CMake Configure process
  6. Compile VTK by launching the solution file located in the build folder. If you are using Visual Studio on Microsoft Windows, right click on ALL_BUILD and then select Build. The compiler with churn for a while. Depending on your machine, this may take multiple hours. If you are using make, use the appropriate make command (most likely make all but this was not tested).
  7. Install the system libraries, assuming no errors were encountered, by right clicking on INSTALL and selecting Build. Make sure you run Visual Studio as an administrator for this step. If you do encounter linker errors in the Java wrappers, make sure you are linking against the correct version of Java. My machine is running a 64-bit version of Windows 7. However, I only have the 32-bit C++ compilers. My default Java JDK is the 64-bit version, which resulted in an unresolved symbol “__imp__JAWT_GetAWT@8” linker error in vtkRenderingJava. If you do encounter these types of errors, make sure to download the 32-bit version of Java JDK and link against it by adjusting the input path under Linker->Input property page for the appropriate project.
  8. Check your PATH. The final piece, and likely the biggest headache, is making sure that your Java program can find the required VTK DLLs. These may in turn depend on other DLLs that may not be in the path. Great tool for checking DLL dependencies is Dependency Walker. It took me a while to get everything set up, and in the end, the following directories did the trick. Of course, your setup will likely differ.
    C:WindowsSystem32;C:Program Files (x86)VTKbin;C:Program Files (x86)Javajdk1.6.0_30lib;C:Program Files (x86)Javajre6bin;C:Program Files (x86)Javajre6binclient;C:Program Files (x86)Microsoft Visual Studio 9.0VCredistx86Microsoft.VC90.CRT;
  9. Copy vtk.jar to somewhere safe. This file is located in the bin directory in your VTK build folder. It is better to move it out of here in case you later decide to delete the build directory. It is over 1Gb after all and you don’t need it post Install unless you actually plan to modify the VTK libraries themselves.
xyg@xyg-T6AD:~$ sudo apt install ros-humble-hardware-interface [sudo] xyg 的密码: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 下列软件包是自动安装的并且现在不需要了: fonts-lyx libaom-dev libarmadillo-dev libarpack2-dev libblas-dev libblosc-dev libcfitsio-dev libcfitsio-doc libcharls-dev libdav1d-dev libde265-dev libdouble-conversion-dev libfontconfig-dev libfontconfig1-dev libfreexl-dev libfyba-dev libgdal-dev libgeos-dev libgeotiff-dev libgif-dev libgl2ps-dev libheif-dev libjson-c-dev libjsoncpp-dev libkml-dev libkmlconvenience1 libkmlregionator1 libkmlxsd1 liblapack-dev liblbfgsb0 libnetcdf-c++4 libnetcdf-cxx-legacy-dev libogdi-dev libogg-dev libopenjp2-7-dev libopenni-dev libopenni-sensor-pointclouds0 libopenni0 libopenni2-0 libopenni2-dev libpcl-apps1.12 libpcl-common1.12 libpcl-dev libpcl-features1.12 libpcl-filters1.12 libpcl-io1.12 libpcl-kdtree1.12 libpcl-keypoints1.12 libpcl-ml1.12 libpcl-octree1.12 libpcl-outofcore1.12 libpcl-people1.12 libpcl-recognition1.12 libpcl-registration1.12 libpcl-sample-consensus1.12 libpcl-search1.12 libpcl-segmentation1.12 libpcl-stereo1.12 libpcl-surface1.12 libpcl-tracking1.12 libpcl-visualization1.12 libpoppler-dev libpoppler-private-dev libproj-dev libqt5designercomponents5 libqt5qmlworkerscript5 libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5webkit5-dev librttopo-dev libspatialite-dev libsuperlu-dev libtheora-dev liburiparser-dev libutfcpp-dev libvtk9-dev libvtk9-java libvtk9-qt-dev libvtk9.1-qt libwebp-dev libx265-dev libxerces-c-dev libxft-dev libxml2-dev libxsimd-dev openni-utils pydocstyle pyflakes3 python-matplotlib-data python3-appdirs python3-beniget python3-brotli python3-cycler python3-decorator python3-flake8 python3-fonttools python3-fs python3-gast python3-kiwisolver python3-lz4 python3-matplotlib python3-mccabe python3-mpi4py python3-mpmath python3-ply python3-psutil python3-pycodestyle python3-pydocstyle python3-pyflakes python3-pythran python3-scipy python3-snowballstemmer python3-sympy python3-ufolib2 python3-unicodedata2 python3-vtk9 qdoc-qt5 qhelpgenerator-qt5 qt5-assistant qtattributionsscanner-qt5 qtdeclarative5-dev qtdeclarative5-dev-tools qttools5-dev qttools5-dev-tools qttools5-private-dev ros-humble-action-tutorials-cpp ros-humble-action-tutorials-interfaces ros-humble-action-tutorials-py ros-humble-ament-cmake-auto ros-humble-ament-cmake-copyright ros-humble-ament-cmake-flake8 ros-humble-ament-cmake-lint-cmake ros-humble-ament-cmake-pep257 ros-humble-ament-cmake-xmllint ros-humble-ament-flake8 ros-humble-ament-lint-auto ros-humble-ament-lint-cmake ros-humble-ament-lint-common ros-humble-ament-pep257 ros-humble-ament-xmllint ros-humble-composition ros-humble-demo-nodes-cpp ros-humble-demo-nodes-cpp-native ros-humble-demo-nodes-py ros-humble-depthimage-to-laserscan ros-humble-dummy-map-server ros-humble-dummy-robot-bringup ros-humble-dummy-sensors ros-humble-example-interfaces ros-humble-examples-rclcpp-minimal-action-client ros-humble-examples-rclcpp-minimal-action-server ros-humble-examples-rclcpp-minimal-client ros-humble-examples-rclcpp-minimal-composition ros-humble-examples-rclcpp-minimal-publisher ros-humble-examples-rclcpp-minimal-service ros-humble-examples-rclcpp-minimal-subscriber ros-humble-examples-rclcpp-minimal-timer ros-humble-examples-rclcpp-multithreaded-executor ros-humble-examples-rclpy-executors ros-humble-examples-rclpy-minimal-action-client ros-humble-examples-rclpy-minimal-action-server ros-humble-examples-rclpy-minimal-client ros-humble-examples-rclpy-minimal-publisher ros-humble-examples-rclpy-minimal-service ros-humble-examples-rclpy-minimal-subscriber ros-humble-geometry2 ros-humble-image-geometry ros-humble-image-tools ros-humble-intra-process-demo ros-humble-keyboard-handler ros-humble-lifecycle ros-humble-logging-demo ros-humble-pcl-conversions ros-humble-pcl-msgs ros-humble-pendulum-control ros-humble-pendulum-msgs ros-humble-qt-gui-cpp ros-humble-qt-gui-py-common ros-humble-quality-of-service-demo-cpp ros-humble-quality-of-service-demo-py ros-humble-ros-environment ros-humble-ros2action ros-humble-ros2bag ros-humble-ros2component ros-humble-ros2interface ros-humble-ros2launch ros-humble-ros2lifecycle ros-humble-ros2multicast ros-humble-ros2topic ros-humble-rosbag2 ros-humble-rosbag2-compression ros-humble-rosbag2-compression-zstd ros-humble-rosbag2-cpp ros-humble-rosbag2-interfaces ros-humble-rosbag2-py ros-humble-rosbag2-storage ros-humble-rosbag2-storage-default-plugins ros-humble-rosbag2-transport ros-humble-rosidl-default-generators ros-humble-rqt-action ros-humble-rqt-bag ros-humble-rqt-bag-plugins ros-humble-rqt-common-plugins ros-humble-rqt-console ros-humble-rqt-gui-cpp ros-humble-rqt-image-view ros-humble-rqt-msg ros-humble-rqt-plot ros-humble-rqt-publisher ros-humble-rqt-py-common ros-humble-rqt-py-console ros-humble-rqt-reconfigure ros-humble-rqt-service-caller ros-humble-rqt-shell ros-humble-rqt-srv ros-humble-rqt-topic ros-humble-rttest ros-humble-shared-queues-vendor ros-humble-sros2 ros-humble-sros2-cmake ros-humble-teleop-twist-joy ros-humble-teleop-twist-keyboard ros-humble-tf2-bullet ros-humble-tf2-sensor-msgs ros-humble-tf2-tools ros-humble-tlsf ros-humble-tlsf-cpp ros-humble-topic-monitor ros-humble-turtlesim ros-humble-zstd-vendor tcl-dev tcl8.6-dev tk-dev tk8.6-dev unicode-data vtk9 使用'sudo apt autoremove'来卸载它(它们)。 下列软件包将被升级: ros-humble-hardware-interface 升级了 1 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 305 个软件包未被升级。 需要下载 228 kB 的归档。 解压缩后会消耗 0 B 的额外空间。 获取:1 https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy/main amd64 ros-humble-hardware-interface amd64 2.51.0-1jammy.20250617.223440 [228 kB] 已下载 228 kB,耗时 11秒 (21.7 kB/s) (正在读取数据库 ... 系统当前共安装有 322880 个文件和目录。) 准备解压 .../ros-humble-hardware-interface_2.51.0-1jammy.20250617.223440_amd64.d eb ... 正在解压 ros-humble-hardware-interface (2.51.0-1jammy.20250617.223440) 并覆盖 (2 .50.0-1jammy.20250429.212517) ... 正在设置 ros-humble-hardware-interface (2.51.0-1jammy.20250617.223440) ... xyg@xyg-T6AD:~$ sudo apt install ros-humble-control-msgs 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 下列软件包是自动安装的并且现在不需要了: fonts-lyx libaom-dev libarmadillo-dev libarpack2-dev libblas-dev libblosc-dev libcfitsio-dev libcfitsio-doc libcharls-dev libdav1d-dev libde265-dev libdouble-conversion-dev libfontconfig-dev libfontconfig1-dev libfreexl-dev libfyba-dev libgdal-dev libgeos-dev libgeotiff-dev libgif-dev libgl2ps-dev libheif-dev libjson-c-dev libjsoncpp-dev libkml-dev libkmlconvenience1 libkmlregionator1 libkmlxsd1 liblapack-dev liblbfgsb0 libnetcdf-c++4 libnetcdf-cxx-legacy-dev libogdi-dev libogg-dev libopenjp2-7-dev libopenni-dev libopenni-sensor-pointclouds0 libopenni0 libopenni2-0 libopenni2-dev libpcl-apps1.12 libpcl-common1.12 libpcl-dev libpcl-features1.12 libpcl-filters1.12 libpcl-io1.12 libpcl-kdtree1.12 libpcl-keypoints1.12 libpcl-ml1.12 libpcl-octree1.12 libpcl-outofcore1.12 libpcl-people1.12 libpcl-recognition1.12 libpcl-registration1.12 libpcl-sample-consensus1.12 libpcl-search1.12 libpcl-segmentation1.12 libpcl-stereo1.12 libpcl-surface1.12 libpcl-tracking1.12 libpcl-visualization1.12 libpoppler-dev libpoppler-private-dev libproj-dev libqt5designercomponents5 libqt5qmlworkerscript5 libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5webkit5-dev librttopo-dev libspatialite-dev libsuperlu-dev libtheora-dev liburiparser-dev libutfcpp-dev libvtk9-dev libvtk9-java libvtk9-qt-dev libvtk9.1-qt libwebp-dev libx265-dev libxerces-c-dev libxft-dev libxml2-dev libxsimd-dev openni-utils pydocstyle pyflakes3 python-matplotlib-data python3-appdirs python3-beniget python3-brotli python3-cycler python3-decorator python3-flake8 python3-fonttools python3-fs python3-gast python3-kiwisolver python3-lz4 python3-matplotlib python3-mccabe python3-mpi4py python3-mpmath python3-ply python3-psutil python3-pycodestyle python3-pydocstyle python3-pyflakes python3-pythran python3-scipy python3-snowballstemmer python3-sympy python3-ufolib2 python3-unicodedata2 python3-vtk9 qdoc-qt5 qhelpgenerator-qt5 qt5-assistant qtattributionsscanner-qt5 qtdeclarative5-dev qtdeclarative5-dev-tools qttools5-dev qttools5-dev-tools qttools5-private-dev ros-humble-action-tutorials-cpp ros-humble-action-tutorials-interfaces ros-humble-action-tutorials-py ros-humble-ament-cmake-auto ros-humble-ament-cmake-copyright ros-humble-ament-cmake-flake8 ros-humble-ament-cmake-lint-cmake ros-humble-ament-cmake-pep257 ros-humble-ament-cmake-xmllint ros-humble-ament-flake8 ros-humble-ament-lint-auto ros-humble-ament-lint-cmake ros-humble-ament-lint-common ros-humble-ament-pep257 ros-humble-ament-xmllint ros-humble-composition ros-humble-demo-nodes-cpp ros-humble-demo-nodes-cpp-native ros-humble-demo-nodes-py ros-humble-depthimage-to-laserscan ros-humble-dummy-map-server ros-humble-dummy-robot-bringup ros-humble-dummy-sensors ros-humble-example-interfaces ros-humble-examples-rclcpp-minimal-action-client ros-humble-examples-rclcpp-minimal-action-server ros-humble-examples-rclcpp-minimal-client ros-humble-examples-rclcpp-minimal-composition ros-humble-examples-rclcpp-minimal-publisher ros-humble-examples-rclcpp-minimal-service ros-humble-examples-rclcpp-minimal-subscriber ros-humble-examples-rclcpp-minimal-timer ros-humble-examples-rclcpp-multithreaded-executor ros-humble-examples-rclpy-executors ros-humble-examples-rclpy-minimal-action-client ros-humble-examples-rclpy-minimal-action-server ros-humble-examples-rclpy-minimal-client ros-humble-examples-rclpy-minimal-publisher ros-humble-examples-rclpy-minimal-service ros-humble-examples-rclpy-minimal-subscriber ros-humble-geometry2 ros-humble-image-geometry ros-humble-image-tools ros-humble-intra-process-demo ros-humble-keyboard-handler ros-humble-lifecycle ros-humble-logging-demo ros-humble-pcl-conversions ros-humble-pcl-msgs ros-humble-pendulum-control ros-humble-pendulum-msgs ros-humble-qt-gui-cpp ros-humble-qt-gui-py-common ros-humble-quality-of-service-demo-cpp ros-humble-quality-of-service-demo-py ros-humble-ros-environment ros-humble-ros2action ros-humble-ros2bag ros-humble-ros2component ros-humble-ros2interface ros-humble-ros2launch ros-humble-ros2lifecycle ros-humble-ros2multicast ros-humble-ros2topic ros-humble-rosbag2 ros-humble-rosbag2-compression ros-humble-rosbag2-compression-zstd ros-humble-rosbag2-cpp ros-humble-rosbag2-interfaces ros-humble-rosbag2-py ros-humble-rosbag2-storage ros-humble-rosbag2-storage-default-plugins ros-humble-rosbag2-transport ros-humble-rosidl-default-generators ros-humble-rqt-action ros-humble-rqt-bag ros-humble-rqt-bag-plugins ros-humble-rqt-common-plugins ros-humble-rqt-console ros-humble-rqt-gui-cpp ros-humble-rqt-image-view ros-humble-rqt-msg ros-humble-rqt-plot ros-humble-rqt-publisher ros-humble-rqt-py-common ros-humble-rqt-py-console ros-humble-rqt-reconfigure ros-humble-rqt-service-caller ros-humble-rqt-shell ros-humble-rqt-srv ros-humble-rqt-topic ros-humble-rttest ros-humble-shared-queues-vendor ros-humble-sros2 ros-humble-sros2-cmake ros-humble-teleop-twist-joy ros-humble-teleop-twist-keyboard ros-humble-tf2-bullet ros-humble-tf2-sensor-msgs ros-humble-tf2-tools ros-humble-tlsf ros-humble-tlsf-cpp ros-humble-topic-monitor ros-humble-turtlesim ros-humble-zstd-vendor tcl-dev tcl8.6-dev tk-dev tk8.6-dev unicode-data vtk9 使用'sudo apt autoremove'来卸载它(它们)。 下列软件包将被升级: ros-humble-control-msgs 升级了 1 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 304 个软件包未被升级。 需要下载 441 kB 的归档。 解压缩后会消耗 0 B 的额外空间。 获取:1 https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy/main amd64 ros-humble-control-msgs amd64 4.8.0-1jammy.20250617.205352 [441 kB] 已下载 441 kB,耗时 1秒 (634 kB/s) (正在读取数据库 ... 系统当前共安装有 322880 个文件和目录。) 准备解压 .../ros-humble-control-msgs_4.8.0-1jammy.20250617.205352_amd64.deb ... 正在解压 ros-humble-control-msgs (4.8.0-1jammy.20250617.205352) 并覆盖 (4.8.0-1j ammy.20250325.185909) ... 正在设置 ros-humble-control-msgs (4.8.0-1jammy.20250617.205352) ... 正在处理用于 libc-bin (2.35-0ubuntu3.10) 的触发器 ... xyg@xyg-T6AD:~$ sudo apt install ros-humble-control-toolbox 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 ros-humble-control-toolbox 已经是最新版 (3.6.1-1jammy.20250617.230904)。 ros-humble-control-toolbox 已设置为手动安装。 下列软件包是自动安装的并且现在不需要了: fonts-lyx libaom-dev libarmadillo-dev libarpack2-dev libblas-dev libblosc-dev libcfitsio-dev libcfitsio-doc libcharls-dev libdav1d-dev libde265-dev libdouble-conversion-dev libfontconfig-dev libfontconfig1-dev libfreexl-dev libfyba-dev libgdal-dev libgeos-dev libgeotiff-dev libgif-dev libgl2ps-dev libheif-dev libjson-c-dev libjsoncpp-dev libkml-dev libkmlconvenience1 libkmlregionator1 libkmlxsd1 liblapack-dev liblbfgsb0 libnetcdf-c++4 libnetcdf-cxx-legacy-dev libogdi-dev libogg-dev libopenjp2-7-dev libopenni-dev libopenni-sensor-pointclouds0 libopenni0 libopenni2-0 libopenni2-dev libpcl-apps1.12 libpcl-common1.12 libpcl-dev libpcl-features1.12 libpcl-filters1.12 libpcl-io1.12 libpcl-kdtree1.12 libpcl-keypoints1.12 libpcl-ml1.12 libpcl-octree1.12 libpcl-outofcore1.12 libpcl-people1.12 libpcl-recognition1.12 libpcl-registration1.12 libpcl-sample-consensus1.12 libpcl-search1.12 libpcl-segmentation1.12 libpcl-stereo1.12 libpcl-surface1.12 libpcl-tracking1.12 libpcl-visualization1.12 libpoppler-dev libpoppler-private-dev libproj-dev libqt5designercomponents5 libqt5qmlworkerscript5 libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5webkit5-dev librttopo-dev libspatialite-dev libsuperlu-dev libtheora-dev liburiparser-dev libutfcpp-dev libvtk9-dev libvtk9-java libvtk9-qt-dev libvtk9.1-qt libwebp-dev libx265-dev libxerces-c-dev libxft-dev libxml2-dev libxsimd-dev openni-utils pydocstyle pyflakes3 python-matplotlib-data python3-appdirs python3-beniget python3-brotli python3-cycler python3-decorator python3-flake8 python3-fonttools python3-fs python3-gast python3-kiwisolver python3-lz4 python3-matplotlib python3-mccabe python3-mpi4py python3-mpmath python3-ply python3-psutil python3-pycodestyle python3-pydocstyle python3-pyflakes python3-pythran python3-scipy python3-snowballstemmer python3-sympy python3-ufolib2 python3-unicodedata2 python3-vtk9 qdoc-qt5 qhelpgenerator-qt5 qt5-assistant qtattributionsscanner-qt5 qtdeclarative5-dev qtdeclarative5-dev-tools qttools5-dev qttools5-dev-tools qttools5-private-dev ros-humble-action-tutorials-cpp ros-humble-action-tutorials-interfaces ros-humble-action-tutorials-py ros-humble-ament-cmake-auto ros-humble-ament-cmake-copyright ros-humble-ament-cmake-flake8 ros-humble-ament-cmake-lint-cmake ros-humble-ament-cmake-pep257 ros-humble-ament-cmake-xmllint ros-humble-ament-flake8 ros-humble-ament-lint-auto ros-humble-ament-lint-cmake ros-humble-ament-lint-common ros-humble-ament-pep257 ros-humble-ament-xmllint ros-humble-composition ros-humble-demo-nodes-cpp ros-humble-demo-nodes-cpp-native ros-humble-demo-nodes-py ros-humble-depthimage-to-laserscan ros-humble-dummy-map-server ros-humble-dummy-robot-bringup ros-humble-dummy-sensors ros-humble-example-interfaces ros-humble-examples-rclcpp-minimal-action-client ros-humble-examples-rclcpp-minimal-action-server ros-humble-examples-rclcpp-minimal-client ros-humble-examples-rclcpp-minimal-composition ros-humble-examples-rclcpp-minimal-publisher ros-humble-examples-rclcpp-minimal-service ros-humble-examples-rclcpp-minimal-subscriber ros-humble-examples-rclcpp-minimal-timer ros-humble-examples-rclcpp-multithreaded-executor ros-humble-examples-rclpy-executors ros-humble-examples-rclpy-minimal-action-client ros-humble-examples-rclpy-minimal-action-server ros-humble-examples-rclpy-minimal-client ros-humble-examples-rclpy-minimal-publisher ros-humble-examples-rclpy-minimal-service ros-humble-examples-rclpy-minimal-subscriber ros-humble-geometry2 ros-humble-image-geometry ros-humble-image-tools ros-humble-intra-process-demo ros-humble-keyboard-handler ros-humble-lifecycle ros-humble-logging-demo ros-humble-pcl-conversions ros-humble-pcl-msgs ros-humble-pendulum-control ros-humble-pendulum-msgs ros-humble-qt-gui-cpp ros-humble-qt-gui-py-common ros-humble-quality-of-service-demo-cpp ros-humble-quality-of-service-demo-py ros-humble-ros-environment ros-humble-ros2action ros-humble-ros2bag ros-humble-ros2component ros-humble-ros2interface ros-humble-ros2launch ros-humble-ros2lifecycle ros-humble-ros2multicast ros-humble-ros2topic ros-humble-rosbag2 ros-humble-rosbag2-compression ros-humble-rosbag2-compression-zstd ros-humble-rosbag2-cpp ros-humble-rosbag2-interfaces ros-humble-rosbag2-py ros-humble-rosbag2-storage ros-humble-rosbag2-storage-default-plugins ros-humble-rosbag2-transport ros-humble-rosidl-default-generators ros-humble-rqt-action ros-humble-rqt-bag ros-humble-rqt-bag-plugins ros-humble-rqt-common-plugins ros-humble-rqt-console ros-humble-rqt-gui-cpp ros-humble-rqt-image-view ros-humble-rqt-msg ros-humble-rqt-plot ros-humble-rqt-publisher ros-humble-rqt-py-common ros-humble-rqt-py-console ros-humble-rqt-reconfigure ros-humble-rqt-service-caller ros-humble-rqt-shell ros-humble-rqt-srv ros-humble-rqt-topic ros-humble-rttest ros-humble-shared-queues-vendor ros-humble-sros2 ros-humble-sros2-cmake ros-humble-teleop-twist-joy ros-humble-teleop-twist-keyboard ros-humble-tf2-bullet ros-humble-tf2-sensor-msgs ros-humble-tf2-tools ros-humble-tlsf ros-humble-tlsf-cpp ros-humble-topic-monitor ros-humble-turtlesim ros-humble-zstd-vendor tcl-dev tcl8.6-dev tk-dev tk8.6-dev unicode-data vtk9 使用'sudo apt autoremove'来卸载它(它们)。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 304 个软件包未被升级。 xyg@xyg-T6AD:~$ sudo apt install ros-humble-ros2-control 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 ros-humble-ros2-control 已经是最新版 (2.51.0-1jammy.20250617.234359)。 下列软件包是自动安装的并且现在不需要了: fonts-lyx libaom-dev libarmadillo-dev libarpack2-dev libblas-dev libblosc-dev libcfitsio-dev libcfitsio-doc libcharls-dev libdav1d-dev libde265-dev libdouble-conversion-dev libfontconfig-dev libfontconfig1-dev libfreexl-dev libfyba-dev libgdal-dev libgeos-dev libgeotiff-dev libgif-dev libgl2ps-dev libheif-dev libjson-c-dev libjsoncpp-dev libkml-dev libkmlconvenience1 libkmlregionator1 libkmlxsd1 liblapack-dev liblbfgsb0 libnetcdf-c++4 libnetcdf-cxx-legacy-dev libogdi-dev libogg-dev libopenjp2-7-dev libopenni-dev libopenni-sensor-pointclouds0 libopenni0 libopenni2-0 libopenni2-dev libpcl-apps1.12 libpcl-common1.12 libpcl-dev libpcl-features1.12 libpcl-filters1.12 libpcl-io1.12 libpcl-kdtree1.12 libpcl-keypoints1.12 libpcl-ml1.12 libpcl-octree1.12 libpcl-outofcore1.12 libpcl-people1.12 libpcl-recognition1.12 libpcl-registration1.12 libpcl-sample-consensus1.12 libpcl-search1.12 libpcl-segmentation1.12 libpcl-stereo1.12 libpcl-surface1.12 libpcl-tracking1.12 libpcl-visualization1.12 libpoppler-dev libpoppler-private-dev libproj-dev libqt5designercomponents5 libqt5qmlworkerscript5 libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5webkit5-dev librttopo-dev libspatialite-dev libsuperlu-dev libtheora-dev liburiparser-dev libutfcpp-dev libvtk9-dev libvtk9-java libvtk9-qt-dev libvtk9.1-qt libwebp-dev libx265-dev libxerces-c-dev libxft-dev libxml2-dev libxsimd-dev openni-utils pydocstyle pyflakes3 python-matplotlib-data python3-appdirs python3-beniget python3-brotli python3-cycler python3-decorator python3-flake8 python3-fonttools python3-fs python3-gast python3-kiwisolver python3-lz4 python3-matplotlib python3-mccabe python3-mpi4py python3-mpmath python3-ply python3-psutil python3-pycodestyle python3-pydocstyle python3-pyflakes python3-pythran python3-scipy python3-snowballstemmer python3-sympy python3-ufolib2 python3-unicodedata2 python3-vtk9 qdoc-qt5 qhelpgenerator-qt5 qt5-assistant qtattributionsscanner-qt5 qtdeclarative5-dev qtdeclarative5-dev-tools qttools5-dev qttools5-dev-tools qttools5-private-dev ros-humble-action-tutorials-cpp ros-humble-action-tutorials-interfaces ros-humble-action-tutorials-py ros-humble-ament-cmake-auto ros-humble-ament-cmake-copyright ros-humble-ament-cmake-flake8 ros-humble-ament-cmake-lint-cmake ros-humble-ament-cmake-pep257 ros-humble-ament-cmake-xmllint ros-humble-ament-flake8 ros-humble-ament-lint-auto ros-humble-ament-lint-cmake ros-humble-ament-lint-common ros-humble-ament-pep257 ros-humble-ament-xmllint ros-humble-composition ros-humble-demo-nodes-cpp ros-humble-demo-nodes-cpp-native ros-humble-demo-nodes-py ros-humble-depthimage-to-laserscan ros-humble-dummy-map-server ros-humble-dummy-robot-bringup ros-humble-dummy-sensors ros-humble-example-interfaces ros-humble-examples-rclcpp-minimal-action-client ros-humble-examples-rclcpp-minimal-action-server ros-humble-examples-rclcpp-minimal-client ros-humble-examples-rclcpp-minimal-composition ros-humble-examples-rclcpp-minimal-publisher ros-humble-examples-rclcpp-minimal-service ros-humble-examples-rclcpp-minimal-subscriber ros-humble-examples-rclcpp-minimal-timer ros-humble-examples-rclcpp-multithreaded-executor ros-humble-examples-rclpy-executors ros-humble-examples-rclpy-minimal-action-client ros-humble-examples-rclpy-minimal-action-server ros-humble-examples-rclpy-minimal-client ros-humble-examples-rclpy-minimal-publisher ros-humble-examples-rclpy-minimal-service ros-humble-examples-rclpy-minimal-subscriber ros-humble-geometry2 ros-humble-image-geometry ros-humble-image-tools ros-humble-intra-process-demo ros-humble-keyboard-handler ros-humble-lifecycle ros-humble-logging-demo ros-humble-pcl-conversions ros-humble-pcl-msgs ros-humble-pendulum-control ros-humble-pendulum-msgs ros-humble-qt-gui-cpp ros-humble-qt-gui-py-common ros-humble-quality-of-service-demo-cpp ros-humble-quality-of-service-demo-py ros-humble-ros-environment ros-humble-ros2action ros-humble-ros2bag ros-humble-ros2component ros-humble-ros2interface ros-humble-ros2launch ros-humble-ros2lifecycle ros-humble-ros2multicast ros-humble-ros2topic ros-humble-rosbag2 ros-humble-rosbag2-compression ros-humble-rosbag2-compression-zstd ros-humble-rosbag2-cpp ros-humble-rosbag2-interfaces ros-humble-rosbag2-py ros-humble-rosbag2-storage ros-humble-rosbag2-storage-default-plugins ros-humble-rosbag2-transport ros-humble-rosidl-default-generators ros-humble-rqt-action ros-humble-rqt-bag ros-humble-rqt-bag-plugins ros-humble-rqt-common-plugins ros-humble-rqt-console ros-humble-rqt-gui-cpp ros-humble-rqt-image-view ros-humble-rqt-msg ros-humble-rqt-plot ros-humble-rqt-publisher ros-humble-rqt-py-common ros-humble-rqt-py-console ros-humble-rqt-reconfigure ros-humble-rqt-service-caller ros-humble-rqt-shell ros-humble-rqt-srv ros-humble-rqt-topic ros-humble-rttest ros-humble-shared-queues-vendor ros-humble-sros2 ros-humble-sros2-cmake ros-humble-teleop-twist-joy ros-humble-teleop-twist-keyboard ros-humble-tf2-bullet ros-humble-tf2-sensor-msgs ros-humble-tf2-tools ros-humble-tlsf ros-humble-tlsf-cpp ros-humble-topic-monitor ros-humble-turtlesim ros-humble-zstd-vendor tcl-dev tcl8.6-dev tk-dev tk8.6-dev unicode-data vtk9 使用'sudo apt autoremove'来卸载它(它们)。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 304 个软件包未被升级。 xyg@xyg-T6AD:~$ colcon build --cmake-clean-cache --packages-select pca9685_hardware Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.10/distutils/core.py", line 215, in run_setup exec(f.read(), g) File "<string>", line 8, in <module> AttributeError: 'NoneType' object has no attribute 'split' [2.803s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'rpi_kernel/linux-rpi-6.12.y/tools/perf/util': Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1. Traceback (most recent call last): File "/usr/lib/python3/dist-packages/colcon_core/package_identification/__init__.py", line 144, in _identify retval = extension.identify(_reused_descriptor_instance) File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 48, in identify config = get_setup_information(setup_py) File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 249, in get_setup_information _setup_information_cache[hashable_env] = _get_setup_information( File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 296, in _get_setup_information result = subprocess.run( File "/usr/lib/python3.10/subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1. WARNING: Package name "yahboomcar_KCFTracker" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes. [3.734s] WARNING:colcon.colcon_core.prefix_path.colcon:The path '/home/xyg/ros2_ws/install' in the environment variable COLCON_PREFIX_PATH doesn't exist [3.734s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/xyg/ros2_ws/install' in the environment variable AMENT_PREFIX_PATH doesn't exist [3.734s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/xyg/ros2_ws/install' in the environment variable CMAKE_PREFIX_PATH doesn't exist [3.759s] ERROR:colcon:colcon build: Duplicate package names not supported: - pca9685_hardware: - ros2_ws/src/pca9685_hardware - ros_env_backup/ros2_ws/src/pca9685_hardware - 下载/ros2_ws/src/pca9685_hardware xyg@xyg-T6AD:~$ colcon build --symlink-install --packages-select pca9685_hardware \ --cmake-args -DCMAKE_BUILD_TYPE=Release Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.10/distutils/core.py", line 215, in run_setup exec(f.read(), g) File "<string>", line 8, in <module> AttributeError: 'NoneType' object has no attribute 'split' [2.007s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'rpi_kernel/linux-rpi-6.12.y/tools/perf/util': Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1. Traceback (most recent call last): File "/usr/lib/python3/dist-packages/colcon_core/package_identification/__init__.py", line 144, in _identify retval = extension.identify(_reused_descriptor_instance) File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 48, in identify config = get_setup_information(setup_py) File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 249, in get_setup_information _setup_information_cache[hashable_env] = _get_setup_information( File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 296, in _get_setup_information result = subprocess.run( File "/usr/lib/python3.10/subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist.__dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata.__dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1. WARNING: Package name "yahboomcar_KCFTracker" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes. [2.822s] WARNING:colcon.colcon_core.prefix_path.colcon:The path '/home/xyg/ros2_ws/install' in the environment variable COLCON_PREFIX_PATH doesn't exist [2.822s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/xyg/ros2_ws/install' in the environment variable AMENT_PREFIX_PATH doesn't exist [2.822s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/xyg/ros2_ws/install' in the environment variable CMAKE_PREFIX_PATH doesn't exist [2.846s] ERROR:colcon:colcon build: Duplicate package names not supported: - pca9685_hardware: - ros2_ws/src/pca9685_hardware - ros_env_backup/ros2_ws/src/pca9685_hardware - 下载/ros2_ws/src/pca9685_hardware xyg@xyg-T6AD:~$ dpkg -L ros-humble-hardware-interface-types | grep cmake dpkg-query: 软件包 ros-humble-hardware-interface-types 没有被安装 通过 dpkg --contents (= dpkg-deb --contents) 来列出档案文件清单。
06-25
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值