It seems that when we attempt to integrate our own robot model with a map and execute "ros2 run turtlebot3_drl gazebo_goals," the initial position is being altered. We have adjusted the values in drl_gazebo.py as follows:
Is it possible that there is an error in our launch file causing this issue?
this is our robot launch file
import os
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription
from launch.conditions import IfCondition, UnlessCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import Command, LaunchConfiguration, PythonExpression
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
declare_use_namespace_cmd = DeclareLaunchArgument(
name='use_namespace',
default_value='false',
description='Whether to apply a namespace to the navigation stack')
58 self.prev_x, self.prev_y = 0.0, 0.0 59 self.goal_x, self.goal_y = 0.8, 0.0
Is it possible that there is an error in our launch file causing this issue? this is our robot launch file
import os from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition, UnlessCondition from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import Command, LaunchConfiguration, PythonExpression from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
gazebo_models_path = 'models' package_name = 'turtlebot3_gazebo' robot_name_in_model = 'AMR' sdf_model_path = '/home/jamesho5055/model_editor_models/amr_trailer/model.sdf' world_file_path = '/home/jamesho5055/at_one/src/articubot_one/worlds/factory.world'
spawn_x_val = '0.0' spawn_y_val = '0.0' spawn_z_val = '0.0' spawn_yaw_val = '0.0'
pkg_gazebo_ros = FindPackageShare(package='gazebo_ros').find('gazebo_ros')
pkg_share = FindPackageShare(package=package_name).find(package_name) world_path = os.path.join(pkg_share, world_file_path) gazebo_models_path = os.path.join(pkg_share, gazebo_models_path) os.environ["GAZEBO_MODEL_PATH"] = gazebo_models_path sdf_model_path = os.path.join(pkg_share, sdf_model_path)
gui = LaunchConfiguration('gui') headless = LaunchConfiguration('headless') namespace = LaunchConfiguration('namespace') sdf_model = LaunchConfiguration('sdf_model') use_namespace = LaunchConfiguration('use_namespace') use_sim_time = LaunchConfiguration('use_sim_time') use_simulator = LaunchConfiguration('use_simulator') world = LaunchConfiguration('world')
declare_namespace_cmd = DeclareLaunchArgument( name='namespace', default_value='', description='Top-level namespace')
declare_use_namespace_cmd = DeclareLaunchArgument( name='use_namespace', default_value='false', description='Whether to apply a namespace to the navigation stack')
declare_sdf_model_path_cmd = DeclareLaunchArgument( name='sdf_model', default_value=sdf_model_path, description='Absolute path to robot sdf file')
declare_simulator_cmd = DeclareLaunchArgument( name='headless', default_value='False', description='Whether to execute gzclient')
declare_use_sim_time_cmd = DeclareLaunchArgument( name='use_sim_time', default_value='true', description='Use simulation (Gazebo) clock if true')
declare_use_simulator_cmd = DeclareLaunchArgument( name='use_simulator', default_value='True', description='Whether to start the simulator')
declare_world_cmd = DeclareLaunchArgument( name='world', default_value=world_path, description='Full path to the world model file to load')
start_gazebo_server_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')), condition=IfCondition(use_simulator), launch_arguments={'world': world}.items())
start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzclient.launch.py')), condition=IfCondition(PythonExpression([use_simulator, ' and not ', headless])))
spawn_entity_cmd = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-entity', robot_name_in_model, '-file', sdf_model,
'-x', spawn_x_val,
joint_state_publisher_node = Node( package='joint_state_publisher', executable='joint_state_publisher', name='joint_state_publisher', ) ld = LaunchDescription()
ld.add_action(declare_namespace_cmd) ld.add_action(declare_use_namespace_cmd) ld.add_action(declare_sdf_model_path_cmd) ld.add_action(declare_simulator_cmd) ld.add_action(declare_use_sim_time_cmd) ld.add_action(declare_use_simulator_cmd) ld.add_action(declare_world_cmd)
ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(spawn_entity_cmd) ld.add_action(joint_state_publisher_node)
return ld
However, this did not change the initial position. Is there a solution to this issue?