diff --git a/Makefile b/Makefile index 469fbbe..ee4b1e1 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ nav2: @cd deploy && docker build --no-cache --tag go2py_nav2:latest -f docker/Dockerfile.nav2 . nav2_start: - @ ./scripts/nav2_start + @ ./scripts/run_nav2.sh messages: @cd scripts && ./make_msgs.sh diff --git a/deploy/docker/Dockerfile.nav2 b/deploy/docker/Dockerfile.nav2 index a3bcebe..024aff6 100644 --- a/deploy/docker/Dockerfile.nav2 +++ b/deploy/docker/Dockerfile.nav2 @@ -22,10 +22,10 @@ git clone https://github.com/ros2/rmw_cyclonedds -b humble && git clone https:// cd .. && colcon build --packages-select cyclonedds && source /opt/ros/humble/setup.bash && colcon build # copy the go2py ros2 nodes -COPY ros2_nodes/sportmode_nav2 /nav2_ws/src/sportmode_nav2 -COPY ros2_nodes/m-explore-ros2 /nav2_ws/src/m-explore-ros2 -COPY ros2_nodes/go2py_messages /nav2_ws/src/go2py_messages -RUN cd /nav2_ws && source /opt/ros/humble/setup.bash && source /unitree_ros2/cyclonedds_ws/install/setup.bash && colcon build --symlink-install +COPY ros2_nodes/sportmode_nav2 /home/nav2_ws/src/sportmode_nav2 +COPY ros2_nodes/m-explore-ros2 /home/nav2_ws/src/m-explore-ros2 +COPY ros2_nodes/go2py_messages /home/nav2_ws/src/go2py_messages +RUN cd /home/nav2_ws && source /opt/ros/humble/setup.bash && source /unitree_ros2/cyclonedds_ws/install/setup.bash && colcon build --symlink-install # set the entrypoint to bash ENTRYPOINT ["/bin/bash"] diff --git a/deploy/launch_files/realsense-h264.launch.py b/deploy/launch_files/realsense-h264.launch.py index 8ca78ea..5e33179 100644 --- a/deploy/launch_files/realsense-h264.launch.py +++ b/deploy/launch_files/realsense-h264.launch.py @@ -9,33 +9,6 @@ from launch_ros.descriptions import ComposableNode def generate_launch_description(): - # RealSense - # realsense_config_file_path = os.path.join( - # get_package_share_directory('isaac_ros_h264_encoder'), - # 'config', 'realsense.yaml' - # ) - realsense_config_file_path = 'realsense.yaml' - realsense_node = ComposableNode( - package='realsense2_camera', - plugin='realsense2_camera::RealSenseNodeFactory', - parameters=[realsense_config_file_path], - remappings=[ - ('infra1/image_rect_raw', 'go2/realsense/left/image_rect_raw_mono'), - ('infra2/image_rect_raw', 'go2/realsense/right/image_rect_raw_mono'), - ('color/image_raw', 'go2/realsense/color/image_raw_mono'), - ('infra1/camera_info', 'go2/realsense/left/camera_info'), - ('infra2/camera_info', 'go2/realsense/right/camera_info'), - ('color/camera_info', 'go2/realsense/color/camera_info'), - ('depth/camera_info', 'go2/realsense/depth/camera_info'), - ('depth/color/points', 'go2/realsense/depth/color/points'), - ('depth/image_rect_raw', 'go2/realsense/depth/image_rect_raw'), - ('extrinsics/depth_to_accel', 'go2/realsense/extrinsics/depth_to_accel'), - ('extrinsics/depth_to_color', 'go2/realsense/extrinsics/depth_to_color'), - ('extrinsics/depth_to_gyro', 'go2/realsense/extrinsics/depth_to_gyro'), - ('imu', 'go2/realsense/imu'), - - ] - ) color_format_converter_node = ComposableNode( package='isaac_ros_image_proc', plugin='nvidia::isaac_ros::image_proc::ImageFormatConverterNode', @@ -44,8 +17,8 @@ def generate_launch_description(): 'encoding_desired': 'rgb8', }], remappings=[ - ('image_raw', 'go2/realsense/color/image_raw_mono'), - ('image', 'go2/realsense/color/image_raw')] + ('image_raw', '/go2/d455/color/image_raw'), + ('image', '/go2/d455/color/image_raw_mono')] ) color_encoder_node = ComposableNode( @@ -66,9 +39,10 @@ def generate_launch_description(): namespace='encoder', package='rclcpp_components', executable='component_container_mt', - composable_node_descriptions=[realsense_node, + composable_node_descriptions=[ color_format_converter_node, - color_encoder_node], + # color_encoder_node + ], output='screen' ) diff --git a/deploy/launch_files/realsense.launch.py b/deploy/launch_files/realsense.launch.py index 95088b5..95c1990 100644 --- a/deploy/launch_files/realsense.launch.py +++ b/deploy/launch_files/realsense.launch.py @@ -8,16 +8,16 @@ from launch_ros.actions import Node def generate_launch_description(): return LaunchDescription([ Node( - name='go2_cam', - namespace='go2/cam', + name='d455', + namespace='go2', package='realsense2_camera', executable='realsense2_camera_node', parameters=[{ - 'enable_infra1': True, - 'enable_infra2': True, + 'enable_infra1': False, + 'enable_infra2': False, 'enable_color': True, - 'enable_depth': False, - 'depth_module.emitter_enabled': 0, + 'enable_depth': True, + 'depth_module.emitter_enabled': 1, 'rgb_camera.profile':'640x480x30', 'depth_module.profile': '640x480x30', 'enable_gyro': True, @@ -25,6 +25,7 @@ def generate_launch_description(): 'gyro_fps': 400, 'accel_fps': 200, 'unite_imu_method': 2, + 'pointcloud.enable': True # 'tf_publish_rate': 0.0 }] ) diff --git a/deploy/launch_files/realsense.yaml b/deploy/launch_files/realsense.yaml index e3a6bd9..46e880e 100644 --- a/deploy/launch_files/realsense.yaml +++ b/deploy/launch_files/realsense.yaml @@ -34,3 +34,5 @@ align_depth: false unite_imu_method: 2 gyro_fps: 400 accel_fps: 200 +camera_namespace: "" +namespace: "" diff --git a/docker/Dockerfile.go2py b/docker/Dockerfile.go2py index 0bc6416..5654b60 100644 --- a/docker/Dockerfile.go2py +++ b/docker/Dockerfile.go2py @@ -18,6 +18,6 @@ RUN --mount=type=cache,target=/var/cache/apt \ --mount=type=bind,source=scripts/install-unitree-ros2.sh,target=/tmp/install-unitree-ros2.sh \ bash /tmp/install-unitree-ros2.sh -RUN apt install -y ros-humble-isaac-ros-h264-decoder ros-humble-isaac-ros-h264-encoder ros-humble-realsense2-camera +RUN apt install -y ros-humble-isaac-ros-h264-decoder ros-humble-isaac-ros-h264-encoder USER $USERNAME \ No newline at end of file diff --git a/docs/nav2.md b/docs/nav2.md new file mode 100644 index 0000000..485eb85 --- /dev/null +++ b/docs/nav2.md @@ -0,0 +1,7 @@ +# Nav2 with Go2 +This notes describe the process getting an exploration and mapping sytem running on the robot using the Go2Py docker and configuration files. In this setup we use the following components: +- **ROS Robot Localization:** We use the EKF node of the ROS robot localization package to generate the odometry TF transformations based on the robot's buildin leg inertial odometry systm (`/utlidar/robot_odom`). The go2py_bridge listens to this topic and publishes `/go2/odom` messages re-stamped with dock's internal clock. The configuraiton parameters for this node are [here](). + +- **ROS SLAM Toolbox:** FOR SLAM, we use the ROS SLAM toobox that takes the odometry frames from the localization node alongside the laser scan topics from the hesai LiDAR (`/go2/scan`) to make a 2D occupancy map of the environment and the transformation between the `odom` and `map` frame. + +- **ROS2 Navigation:** Finally we use the ROS navigation2 to diff --git a/scripts/.isaac_ros_common-config b/scripts/.isaac_ros_common-config index aa035c6..ec4e466 100644 --- a/scripts/.isaac_ros_common-config +++ b/scripts/.isaac_ros_common-config @@ -1,2 +1,2 @@ -CONFIG_IMAGE_KEY="ros2_humble.go2py" +CONFIG_IMAGE_KEY="ros2_humble.go2py.realsense" CONFIG_DOCKER_SEARCH_DIRS=(../docker) diff --git a/scripts/nav2_docker_start.sh b/scripts/nav2_docker_start.sh deleted file mode 100755 index 2f09e3e..0000000 --- a/scripts/nav2_docker_start.sh +++ /dev/null @@ -1 +0,0 @@ -docker run --rm -it --privileged --network host -v $(pwd)/deploy/ros2_nodes/sportmode_nav2:/home/nav2_ws/src/sportmode_nav2 -v /dev/*:/dev/* -v /etc/localtime:/etc/localtime:ro --runtime nvidia go2py_nav2:latest \ No newline at end of file