From efb99ed9cd846c0fda4cb453bcb6c5eceddbbbb2 Mon Sep 17 00:00:00 2001 From: Muhammad Hamd Azam <155443855+mazam32@users.noreply.github.com> Date: Sun, 24 Nov 2024 16:48:15 -0500 Subject: [PATCH] [sensors] Launch `vectornav` in `bringup.launch.py` (#229) * imu node * fix submodule * added angular velocity and linear acceleration * change topic * edited launch file * Launch file fully functional now * removed the build, install and log files from the src folder * removed redundant line * removed imu parser, removed unncessary enu file * Fixed linting errors * bugfixes on launch file * final merge fixes --------- Signed-off-by: David Calderon Co-authored-by: davidcalderon03 Co-authored-by: Mrinal Jain <2mrinaljain@gmail.com> --- .gitmodules | 4 ++ documents/installation/vectornav_imu.md | 62 +++++++++++++++++++++++++ external/vectornav | 1 + urc_bringup/launch/bringup.launch.py | 47 +++++++------------ urc_platform/CMakeLists.txt | 2 + urc_platform/package.xml | 1 + 6 files changed, 88 insertions(+), 29 deletions(-) create mode 100644 documents/installation/vectornav_imu.md create mode 160000 external/vectornav diff --git a/.gitmodules b/.gitmodules index cb7af4c3..941bb121 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,3 +21,7 @@ path = external/articubot_one url = https://github.com/joshnewans/articubot_one.git branch = humble +[submodule "external/vectornav"] + path = external/vectornav + url = https://github.com/dawonn/vectornav.git + branch = ros2 diff --git a/documents/installation/vectornav_imu.md b/documents/installation/vectornav_imu.md new file mode 100644 index 00000000..0a61dd84 --- /dev/null +++ b/documents/installation/vectornav_imu.md @@ -0,0 +1,62 @@ +# Launch Instructions for VectorNav with Permission Issues + +This document explains how to resolve permission issues for serial devices (like `/dev/ttyUSB0`) and launch the VectorNav package on Linux. + +## Prerequisites + +1. **Install Necessary Packages**: Ensure all required packages are installed in your workspace and that the workspace is correctly sourced. + +2. **Device Permissions**: You’ll need permission to access the device files (e.g., `/dev/ttyUSB0`). + +## Steps + +### Step 1: Check Device Permissions + +1. First, identify the device port: + ```bash + ls /dev/ttyUSB* + ``` +2. Verify your user has permission to access the device. If you see an error or permission denied, proceed with the steps below. + +### Step 2: Add User to the `dialout` Group + +The `dialout` group typically has access to serial devices. Add your user to this group: + +```bash +sudo usermod -aG dialout $USER +``` + +**Note**: Log out and log back in for the group change to take effect. Alternatively, you can restart the system to apply these changes immediately. + +### Step 3: Verify Permissions + +After re-logging or rebooting, check that you have read and write permissions on the device: + +```bash +ls -l /dev/ttyUSB0 +``` + +If permissions are set correctly, the output should show that `dialout` has `rw` (read/write) access for `/dev/ttyUSB0`. + +### Step 4: Launch VectorNav + +Source your ROS workspace, then launch the VectorNav nodes with the appropriate configurations: + +```bash +source ~/Documents/urc/rover-colcon/install/setup.bash +ros2 launch vectornav vectornav.launch.py +``` + +**Note**: Replace the workspace path with the correct path if it’s different on your system. + +### Troubleshooting + +If you continue to experience issues with permissions, consider checking `dmesg` logs to ensure the device is recognized: + +```bash +dmesg | grep ttyUSB +``` + +This command shows messages related to the USB connection and may help diagnose connectivity issues. + +--- diff --git a/external/vectornav b/external/vectornav new file mode 160000 index 00000000..2859fe18 --- /dev/null +++ b/external/vectornav @@ -0,0 +1 @@ +Subproject commit 2859fe18a3c4a5e6d3dafcef9923df9a854a2660 diff --git a/urc_bringup/launch/bringup.launch.py b/urc_bringup/launch/bringup.launch.py index 8f0d6f7d..f1edf1e8 100644 --- a/urc_bringup/launch/bringup.launch.py +++ b/urc_bringup/launch/bringup.launch.py @@ -29,6 +29,8 @@ def generate_launch_description(): ) pkg_urc_platform = get_package_share_directory("urc_platform") + pkg_vectornav = get_package_share_directory("vectornav") + controller_config_file_dir = os.path.join( pkg_urc_bringup, "config", "controller_config.yaml" ) @@ -67,7 +69,7 @@ def generate_launch_description(): load_joint_state_broadcaster = Node( package="controller_manager", executable="spawner", - arguments=["-p", controller_config_file_dir, "joint_state_broadcaster"], + arguments=["-p", controller_config_file_dir, "joint_state_broadcaster"] ) load_drivetrain_controller = Node( @@ -79,27 +81,9 @@ def generate_launch_description(): load_status_light_controller = Node( package="controller_manager", executable="spawner", - arguments=["-p", controller_config_file_dir, "status_light_controller"], + arguments=["-p", controller_config_file_dir, "status_light_controller"] ) - # load_arm_controller = Node( - # package="controller_manager", - # executable="spawner", - # arguments=["-p", controller_config_file_dir, "arm_controller"], - # ) - - # load_gripper_controller_left = Node( - # package="controller_manager", - # executable="spawner", - # arguments=["-p", controller_config_file_dir, "gripper_controller_left"], - # ) - - # load_gripper_controller_right = Node( - # package="controller_manager", - # executable="spawner", - # arguments=["-p", controller_config_file_dir, "gripper_controller_right"], - # ) - twist_mux_node = Node( package="urc_platform", executable="urc_platform_TwistMux", @@ -109,16 +93,22 @@ def generate_launch_description(): launch_gps = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join( - pkg_nmea_navsat_driver, "launch", "nmea_serial_driver.launch.py" + pkg_nmea_navsat_driver, + "launch", "nmea_serial_driver.launch.py" ) ) ) launch_gps = Node( - package="nmea_navsat_driver", - executable="nmea_serial_driver", - output="screen", - parameters=[gps_config], + package='nmea_navsat_driver', + executable='nmea_serial_driver', + output='screen', + parameters=[gps_config]) + + launch_vectornav = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(pkg_vectornav, "launch", "vectornav.launch.py") + ) ) rosbridge_server_node = Node( @@ -138,7 +128,8 @@ def generate_launch_description(): ) odom_frame_node = Node( - package="urc_tf", executable="urc_tf_WorldFrameBroadcaster", output="screen" + package="urc_tf", executable="urc_tf_WorldFrameBroadcaster", + output="screen" ) return LaunchDescription( @@ -159,11 +150,9 @@ def generate_launch_description(): load_drivetrain_controller, load_status_light_controller, twist_mux_node, - # load_arm_controller, - # load_gripper_controller_left, - # load_gripper_controller_right, launch_gps, rosbridge_server_node, odom_frame_node, + launch_vectornav, ] ) diff --git a/urc_platform/CMakeLists.txt b/urc_platform/CMakeLists.txt index 98245311..aff4685b 100644 --- a/urc_platform/CMakeLists.txt +++ b/urc_platform/CMakeLists.txt @@ -11,6 +11,7 @@ find_package(std_msgs REQUIRED) find_package(sensor_msgs REQUIRED) find_package(diagnostic_updater REQUIRED) find_package(usb_cam REQUIRED) +find_package(vectornav_msgs REQUIRED) include_directories( include @@ -29,6 +30,7 @@ set(dependencies sensor_msgs diagnostic_updater usb_cam + vectornav_msgs ) ament_target_dependencies(${PROJECT_NAME} diff --git a/urc_platform/package.xml b/urc_platform/package.xml index faef788f..f8fb5cab 100644 --- a/urc_platform/package.xml +++ b/urc_platform/package.xml @@ -21,6 +21,7 @@ usb_cam image_transport image_transport_plugins + vectornav_msgs ament_lint_auto ament_lint_common