diff --git a/launch/upload_rexrov.launch b/launch/upload_sub.launch similarity index 85% rename from launch/upload_rexrov.launch rename to launch/upload_sub.launch index a3a8865..53e3001 100644 --- a/launch/upload_rexrov.launch +++ b/launch/upload_sub.launch @@ -9,11 +9,11 @@ - + - + diff --git a/launch/upload_rexrov_default.launch b/launch/upload_sub_default.launch similarity index 76% rename from launch/upload_rexrov_default.launch rename to launch/upload_sub_default.launch index 2f9dada..dbedeee 100644 --- a/launch/upload_rexrov_default.launch +++ b/launch/upload_sub_default.launch @@ -9,17 +9,17 @@ - + - - + - @@ -49,9 +49,6 @@ - - diff --git a/launch/upload_rexrov_default_noisy_pose.launch b/launch/upload_sub_default_noisy_pose.launch similarity index 88% rename from launch/upload_rexrov_default_noisy_pose.launch rename to launch/upload_sub_default_noisy_pose.launch index c9c654c..f5260f5 100644 --- a/launch/upload_rexrov_default_noisy_pose.launch +++ b/launch/upload_sub_default_noisy_pose.launch @@ -9,14 +9,14 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch/upload_sub_imu.launch.py b/launch/upload_sub_imu.launch.py new file mode 100644 index 0000000..3d22fb1 --- /dev/null +++ b/launch/upload_sub_imu.launch.py @@ -0,0 +1,63 @@ +import os + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node +import xacro + + +def generate_launch_description(): + # Get the model to load + if 'SUB_MODEl' in os.environ: + model = os.environ['SUB_MODEL'] + else: + model = 'sub_imu' + print('Using model: ' + model) + + # Get the launch directory + br_description_dir = get_package_share_directory('sub_descriptions') + + # Create the launch configuration variables + use_sim_time = LaunchConfiguration('use_sim_time', default='false') + + declare_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') + + namespace = DeclareLaunchArgument('namespace', default_value='sub', description='node namespace of sub') + x_arg = DeclareLaunchArgument('x', default_value=0., description='x coordinate of sub') + y_arg = DeclareLaunchArgument('y', default_value=0., description='y coordinate of sub') + z_arg = DeclareLaunchArgument('z', default_value=0., description='z coordinate of sub') + + xacro_file = os.path.join(br_description_dir, 'robots', model + '.xacro') + doc = xacro.process_file(xacro_file) + robot_desc = doc.toprettyxml(indent=' ') + URDF_FILE = '/tmp/sub.urdf' + with open(URDF_FILE, 'w') as f: + f.write(robot_desc) + params = {'use_sim_time': use_sim_time} + + upload_gazebo_node = Node( + package='gazebo_ros', + node_executable='spawn_entity.py', + node_name='urdf_spawner', + output='screen', + arguments=[f"-gazebo_namespace /gazebo -x {LaunchConfiguration('x')} -y {LaunchConfiguration('x')} -z {LaunchConfiguration('x')} -entity {LaunchConfiguration('namespace')} -file {URDF_FILE}"] + ) + + run_state_publisher_node = Node( + package='robot_state_publisher', + node_executable='robot_state_publisher', + node_name='robot_state_publisher', + output='screen', + parameters=[params], + arguments=[URDF_FILE] + ) + + # Create the launch description and populate + ld = LaunchDescription([upload_gazebo_node, run_state_publisher_node, declare_sim_time_cmd, namespace, x_arg, y_arg, z_arg]) + + return ld diff --git a/package.xml b/package.xml index 693f0bc..57a272a 100644 --- a/package.xml +++ b/package.xml @@ -30,6 +30,7 @@ xacro + ament_cmake diff --git a/robots/rexrov_default.xacro b/robots/sub_default.xacro similarity index 82% rename from robots/rexrov_default.xacro rename to robots/sub_default.xacro index 12bc2d2..7b48ccf 100644 --- a/robots/rexrov_default.xacro +++ b/robots/sub_default.xacro @@ -21,16 +21,16 @@ limitations under the License. --> - + - + - - + + - - + - + - + diff --git a/robots/rexrov_default_noisy_pose.xacro b/robots/sub_default_noisy_pose.xacro similarity index 85% rename from robots/rexrov_default_noisy_pose.xacro rename to robots/sub_default_noisy_pose.xacro index 0c867d8..e02c011 100644 --- a/robots/rexrov_default_noisy_pose.xacro +++ b/robots/sub_default_noisy_pose.xacro @@ -21,18 +21,18 @@ limitations under the License. --> - + - + - - + + - - + - + - + diff --git a/robots/sub_imu.xacro b/robots/sub_imu.xacro new file mode 100644 index 0000000..307cf3d --- /dev/null +++ b/robots/sub_imu.xacro @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + 1028.0 + hydrodynamics/current_velocity + $(arg debug) + + + + + true + base_footprint + imu + imu_service + 0.1 + 20.0 + + + + + + + + diff --git a/urdf/rexrov.gazebo.xacro b/urdf/sub.gazebo.xacro similarity index 97% rename from urdf/rexrov.gazebo.xacro rename to urdf/sub.gazebo.xacro index a78591c..60e8566 100644 --- a/urdf/rexrov.gazebo.xacro +++ b/urdf/sub.gazebo.xacro @@ -32,7 +32,7 @@ - + 0 ${volume} diff --git a/urdf/rexrov_actuators.xacro b/urdf/sub_actuators.xacro similarity index 97% rename from urdf/rexrov_actuators.xacro rename to urdf/sub_actuators.xacro index 814752d..fb114bb 100644 --- a/urdf/rexrov_actuators.xacro +++ b/urdf/sub_actuators.xacro @@ -22,7 +22,7 @@ --> - + - + - - - + + + - + @@ -92,8 +92,8 @@ --> - - + + diff --git a/urdf/rexrov_sensors.xacro b/urdf/sub_sensors.xacro similarity index 90% rename from urdf/rexrov_sensors.xacro rename to urdf/sub_sensors.xacro index 3984315..bef69c0 100644 --- a/urdf/rexrov_sensors.xacro +++ b/urdf/sub_sensors.xacro @@ -22,20 +22,20 @@ --> - - + --> - + @@ -63,9 +63,6 @@ - - -