➜ turtlebot3_demo git:(master) ✗ ros2 bag record -a [INFO 1660520472.608949340] [rcl]: Found security directory: /home/kevin/turtlebot3_demo/test_keystore/enclaves (rcl_get_security_options_from_environment() at /tmp/binarydeb/ros-galactic-rcl-3.1.2/src/rcl/security.c:56) 1660520472.617346 [0] ros2: using network interface wlp109s0 (udp/192.168.31.206) selected arbitrarily from: wlp109s0, anbox0, br-1f67ea43b642, br-fc22da249d2c, br-14287a178700, docker0 [INFO 1660520472.625432594] [rosbag2_storage]: Opened database 'rosbag2_2022_08_15-07_41_12/rosbag2_2022_08_15-07_41_12_0.db3'for READ_WRITE. (open() at /tmp/binarydeb/ros-galactic-rosbag2-storage-default-plugins-0.9.1/src/rosbag2_storage_default_plugins/sqlite/sqlite_storage.cpp:216) [INFO 1660520472.625510286] [rosbag2_recorder]: Listening for topics... (record() at /tmp/binarydeb/ros-galactic-rosbag2-transport-0.9.1/src/rosbag2_transport/recorder.cpp:97) [INFO 1660520472.626160066] [rosbag2_recorder]: Subscribed to topic '/rosout' (subscribe_topic() at /tmp/binarydeb/ros-galactic-rosbag2-transport-0.9.1/src/rosbag2_transport/recorder.cpp:214) [INFO 1660520472.626445742] [rosbag2_recorder]: Subscribed to topic '/parameter_events' (subscribe_topic() at /tmp/binarydeb/ros-galactic-rosbag2-transport-0.9.1/src/rosbag2_transport/recorder.cpp:214) [INFO 1660520472.829706666] [rosbag2_recorder]: Subscribed to topic '/chatter' (subscribe_topic() at /tmp/binarydeb/ros-galactic-rosbag2-transport-0.9.1/src/rosbag2_transport/recorder.cpp:214) ^C[INFO 1660520503.667573993] [rclcpp]: signal_handler(signal_value=2) (signal_handler() at /tmp/binarydeb/ros-galactic-rclcpp-9.2.0/src/rclcpp/signal_handler.cpp:202) [INFO 1660520503.747822482] [rosbag2_cpp]: Writing remaining messages from cache to the bag. It may take a while (close() at /tmp/binarydeb/ros-galactic-rosbag2-cpp-0.9.1/src/rosbag2_cpp/cache/cache_consumer.cpp:44)
播放包的打印信息:
1 2 3 4 5 6
➜ turtlebot3_demo git:(master) ✗ ros2 bag play rosbag2_2022_08_15-07_41_12/rosbag2_2022_08_15-07_41_12_0.db3 [INFO 1660520560.981193069] [rcl]: Found security directory: /home/kevin/turtlebot3_demo/test_keystore/enclaves (rcl_get_security_options_from_environment() at /tmp/binarydeb/ros-galactic-rcl-3.1.2/src/rcl/security.c:56) 1660520560.990039 [0] ros2: using network interface wlp109s0 (udp/192.168.31.206) selected arbitrarily from: wlp109s0, anbox0, br-1f67ea43b642, br-fc22da249d2c, br-14287a178700, docker0 [INFO 1660520560.996492289] [rosbag2_storage]: Opened database 'rosbag2_2022_08_15-07_41_12/rosbag2_2022_08_15-07_41_12_0.db3'for READ_ONLY. (open() at /tmp/binarydeb/ros-galactic-rosbag2-storage-default-plugins-0.9.1/src/rosbag2_storage_default_plugins/sqlite/sqlite_storage.cpp:216) [INFO 1660520561.000216516] [rosbag2_storage]: Opened database 'rosbag2_2022_08_15-07_41_12/rosbag2_2022_08_15-07_41_12_0.db3'for READ_ONLY. (open() at /tmp/binarydeb/ros-galactic-rosbag2-storage-default-plugins-0.9.1/src/rosbag2_storage_default_plugins/sqlite/sqlite_storage.cpp:216)
可以发现,只要多了一条下面的打印信息。说明消息传输已经加密了。
1
[rcl]: Found security directory: /home/kevin/turtlebot3_demo/test_keystore/enclaves (rcl_get_security_options_from_environment() at /tmp/binarydeb/ros-galactic-rcl-3.1.2/src/rcl/security.c:56)
optional arguments: -h, --help show this help message and exit
Commands: create_enclave Create enclave create_key DEPRECATED: Create enclave. Use create_enclave instead create_keystore Create keystore create_permission Create permission generate_artifacts Generate keys and permission files from a list of identities and policy files generate_policy Generate XML policy file from ROS graph data list_enclaves List enclaves in keystore list_keys DEPRECATED: List enclaves in keystore. Use list_enclaves instead
Call `ros2 security <command> -h` for more detailed usage.