Fixed the initial pose of the vehicle in Carla, and modified the initial map to town01 to solve the problem that the default map town10 crashes occasionally.

There are two methods, the first is to add parameters when the terminal starts; the second is to pass parameters in the launch file.
the first method
insert image description here

For the convenience of display, describe the above code in words:

#启动launch文件
roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch 
spawn_point:=“0,0,0.5,0,0,1”  车辆初始位姿
town:=“town01”  地图
ego_vehicle_role_name:=“ego_vehicle”   车辆种类
vehicle_filter:=“vehicle.audi.a2”  车辆滤波器

insert image description here

It can be seen that the vehicle pose has been fixed.
The second method is
to modify the launch file
insert image description here

The default map is town10, the rendering level is too high, it is easy to cause flashback problems, change it to town01, and modify the vehicle birth point

#固定车辆出生点
<arg name="spawn_point" default="0,0,0.5,0,0,1"/><!-- use comma separated format "x,y,z,roll,pitch,yaw" -->
<launch>
  <!-- CARLA connection -->
  <arg name='host' default='localhost'/>
  <arg name='port' default='2000'/>
  <arg name='timeout' default='10'/>

  <!-- Ego vehicle -->
  <arg name='role_name' default='ego_vehicle'/>
  <arg name="vehicle_filter" default='vehicle.*'/>
  <arg name="spawn_point" default="0,0,0.5,0,0,1"/><!-- use comma separated format "x,y,z,roll,pitch,yaw" -->

  <!-- Map to load on startup (either a predefined CARLA town (e.g. 'Town01'), or a OpenDRIVE map file) -->
  <arg name="town" default='Town01'/>

  <!-- Enable/disable passive mode -->
  <arg name='passive' default=''/>

  <!-- Synchronous mode-->
  <arg name='synchronous_mode_wait_for_vehicle_control_command' default='False'/>
  <arg name='fixed_delta_seconds' default='0.05'/>


  <include file="$(find carla_ros_bridge)/launch/carla_ros_bridge.launch">
    <arg name='host' value='$(arg host)'/>
    <arg name='port' value='$(arg port)'/>
    <arg name='town' value='$(arg town)'/>
    <arg name='timeout' value='$(arg timeout)'/>
    <arg name='passive' value='$(arg passive)'/>
    <arg name='synchronous_mode_wait_for_vehicle_control_command' value='$(arg synchronous_mode_wait_for_vehicle_control_command)'/>
    <arg name='fixed_delta_seconds' value='$(arg fixed_delta_seconds)'/>
  </include>

  <!-- the ego vehicle, that will be controlled by an agent (e.g. carla_ad_agent) -->
  <include file="$(find carla_spawn_objects)/launch/carla_example_ego_vehicle.launch">
    <arg name="objects_definition_file" value='$(find carla_spawn_objects)/config/objects.json'/>
    <arg name='role_name' value='$(arg role_name)'/>
    <arg name="spawn_point_ego_vehicle" value="$(arg spawn_point)"/>
    <arg name="spawn_sensors_only" value="false"/>
  </include>

  <include file="$(find carla_manual_control)/launch/carla_manual_control.launch">
    <arg name='role_name' value='$(arg role_name)'/>
  </include>

</launch>

Guess you like

Origin blog.csdn.net/justinyjf/article/details/131624448