Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code refactor #24

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ find_package(catkin REQUIRED COMPONENTS
rospy
sensor_msgs
std_msgs
std_srvs
tf
tf2
tf2_ros
message_generation
)

Expand Down Expand Up @@ -118,6 +121,8 @@ catkin_package(
sensor_msgs
std_msgs
tf
tf2
tf2_ros
message_runtime
# DEPENDS system_lib
)
Expand Down
25 changes: 0 additions & 25 deletions launch/car_1.access

This file was deleted.

25 changes: 0 additions & 25 deletions launch/car_2.access

This file was deleted.

25 changes: 0 additions & 25 deletions launch/car_3.access

This file was deleted.

35 changes: 35 additions & 0 deletions launch/car_controller.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version='1.0'?>

<launch>

<!-- global variables -->
<arg name='car_name' default='car_1' />
<arg name='listen_offboard' default='true' />
<arg name='keyboard_control' default='false'/>
<arg name='visualize' default='false'/>

<!-- launch rviz with mapping configuration -->
<group if='$(arg visualize)'>
<node name='remote_visualization' pkg='rviz' type='rviz' args='-d $(find f1tenth-sim)/rviz/$(arg car_name).rviz' />
</group>
<group ns='$(arg car_name)'>
<!-- keyboard teleop -->
<group if='$(arg keyboard_control)'>
<node name = 'keyboard_teleop' pkg = 'f1tenth-sim' type = 'keyboard_teleop.py'
args = '$(arg car_name)' output = 'screen'/>
</group>

<!-- joy_node using F310/F710 -->
<group unless='$(arg keyboard_control)'>
<node name='joy_node' pkg='joy' type='joy_node'>
<param name='autorepeat_rate' value='20.0' />
</node>
</group>

<!-- bring up command multiplexer -->
<node name='command_multiplexer' pkg='f1tenth-sim' type='command_multiplexer.py' args='$(arg car_name)
$(arg listen_offboard) $(arg keyboard_control)' output='screen' />

</group>

</launch>
19 changes: 11 additions & 8 deletions config/one_car.launch.xml → launch/car_gazebo.launch
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
<arg name='remote_control' default='false' />
<arg name='keyboard_control' default='false' />
<arg name='world_name' default='bahrain_track' />
<arg name='mapping_tf' default='false' />

<!-- launch map to odom tf -->
<group unless='$(arg mapping_tf)'>
<node name='map_$(arg car_name)_odom_link' pkg='tf' type='static_transform_publisher' args='$(arg x_pos) $(arg y_pos) 0.0
0.0 0.0 0.0
map
$(arg car_name)_odom
100' />
</group>

<!-- run gazebo by default only once -->
<group if='$(arg run_gazebo)'>
Expand All @@ -23,13 +33,6 @@
<arg name='gui' default='true' />
<arg name='run_camera' default='false' />

<!-- launch map to odom tf -->
<node name='map_odom_link' pkg='tf' type='static_transform_publisher' args='0.0 0.0 0.0
0.0 0.0 0.0
map
odom
100' />

<!-- launch gazebo with track -->
<include file='$(find gazebo_ros)/launch/empty_world.launch'>
<arg name='world_name' value='$(find f1tenth-sim)/world/$(arg world_name).world' />
Expand All @@ -54,7 +57,7 @@
<node name='$(arg car_name)_pit_stop_reset' pkg='f1tenth-sim' type='set_racecar_state.py' args='$(arg car_name)' />

<!-- spawn car using the set global parameters -->
<include file='$(find f1tenth-sim)/config/vehicle_class.launch.xml'>
<include file='$(find f1tenth-sim)/launch/car_spawner.launch'>
<arg name='car_name' value='$(arg car_name)' />
<arg name='x_pos' value='$(arg x_pos)' />
<arg name='y_pos' value='$(arg y_pos)' />
Expand Down
13 changes: 11 additions & 2 deletions config/vehicle_class.launch.xml → launch/car_spawner.launch
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@
<param name='/$(arg car_name)/left_steering_hinge_position_controller/joint' value='$(arg car_name)_left_steering_hinge_joint' />
<param name='/$(arg car_name)/right_steering_hinge_position_controller/joint' value='$(arg car_name)_right_steering_hinge_joint' />

<!-- Publish spawn pose to define origin/offset -->
<param name='/$(arg car_name)/init_pose' value='[$(arg x_pos), $(arg y_pos), $(arg z_pos)]'/>

<!-- urdf xml robot description loaded on the Parameter Server, converting the xacro into a proper urdf file-->
<param name='$(arg car_name)/robot_description' command='$(find xacro)/xacro
"$(find f1tenth-sim)/urdf/macros.xacro" robot_name:=$(arg car_name) robot_skin:=$(arg paint)' />

<!-- Robot state publisher -->
<!-- <node pkg="robot_state_publisher" type="robot_state_publisher" name="$(arg car_name)_state" >
<remap from="robot_description" to="$(arg car_name)/robot_description" />
<remap from="joint_states" to="$(arg car_name)/joint_states" />
</node> -->

<!-- push robot_description to factory and spawn robot in gazebo -->
<node name='$(arg car_name)_spawn_model' pkg='gazebo_ros' type='spawn_model' output='screen' args='-urdf -param $(arg car_name)/robot_description
-model $(arg car_name)
Expand All @@ -41,14 +50,14 @@

<group ns='$(arg car_name)'>
<!-- static base_laser_link -->
<node name='base_laser_link' pkg='tf' type='static_transform_publisher' args='0.0 0.0 0.0
<node name='base_laser_link' pkg='tf' type='static_transform_publisher' args='0.125 0.0 0.160
0.0 0.0 0.0
$(arg car_name)_base_link
$(arg car_name)_laser
20' />

<!-- launch base controller -->
<node name='control_plugin' pkg='f1tenth-sim' type='control_plugin.py' args='$(arg car_name) $(arg x_pos) $(arg y_pos)' output='screen' />
<node name='control_plugin' pkg='f1tenth-sim' type='control_plugin.py' args='$(arg car_name)' output='screen' />
</group>

</launch>
46 changes: 46 additions & 0 deletions launch/interlagos.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version='1.0'?>

<launch>

<!-- global variables -->
<arg name='multi_car' default='false' />
<arg name='world_name' default='interlagos_track' />
<arg name='mapping_tf' default='false' />

<!-- global map server -->
<!--
<node name='global_map_server' pkg='map_server' type='map_server' args='$(find f1tenth-sim)/map/race_track.yaml' output='screen'>
<param name='frame_id' value='map' />
</node>
<remap from='map' to='/map' /> -->

<!-- spawn car_1 and launch Gazebo -->
<include file='$(find f1tenth-sim)/launch/car_gazebo.launch'>
<arg name='car_name' value='car_1' />
<arg name='x_pos' value='-6.75' />
<arg name='y_pos' value='-43.0' />
<arg name='paint' value='Yellow' />
<arg name='run_gazebo' value='true' />
<arg name='world_name' value='$(arg world_name)' />
<arg name='mapping_tf' value='$(arg mapping_tf)' />
</include>

<group if="$(arg multi_car)">
<!-- spawn car_2 -->
<include file='$(find f1tenth-sim)/launch/car_gazebo.launch'>
<arg name='car_name' value='car_2' />
<arg name='x_pos' value='-7.75' />
<arg name='y_pos' value='-43.5' />
<arg name='paint' value='Green' />
</include>

<!-- spawn car_3 -->
<include file='$(find f1tenth-sim)/launch/car_gazebo.launch'>
<arg name='car_name' value='car_3' />
<arg name='x_pos' value='-8.75' />
<arg name='y_pos' value='-44.0' />
<arg name='paint' value='Red' />
</include>
</group>

</launch>
43 changes: 0 additions & 43 deletions launch/interlagos.master

This file was deleted.

46 changes: 46 additions & 0 deletions launch/monza.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version='1.0'?>

<launch>

<!-- global variables -->
<arg name='multi_car' default='false' />
<arg name='world_name' default='monza_track' />
<arg name='mapping_tf' default='false' />

<!-- global map server -->
<!--
<node name='global_map_server' pkg='map_server' type='map_server' args='$(find f1tenth-sim)/map/race_track.yaml' output='screen'>
<param name='frame_id' value='map' />
</node>
<remap from='map' to='/map' /> -->

<!-- spawn car_1 and launch Gazebo -->
<include file='$(find f1tenth-sim)/launch/car_gazebo.launch'>
<arg name='car_name' value='car_1' />
<arg name='x_pos' value='-25.25' />
<arg name='y_pos' value='-42.25' />
<arg name='paint' value='Yellow' />
<arg name='run_gazebo' value='true' />
<arg name='world_name' value='$(arg world_name)' />
<arg name='mapping_tf' value='$(arg mapping_tf)' />
</include>

<group if="$(arg multi_car)">
<!-- spawn car_2 -->
<include file='$(find f1tenth-sim)/launch/car_gazebo.launch'>
<arg name='car_name' value='car_2' />
<arg name='x_pos' value='-25.25' />
<arg name='y_pos' value='-41.25' />
<arg name='paint' value='Green' />
</include>

<!-- spawn car_3 -->
<include file='$(find f1tenth-sim)/launch/car_gazebo.launch'>
<arg name='car_name' value='car_3' />
<arg name='x_pos' value='-25.25' />
<arg name='y_pos' value='-40.25' />
<arg name='paint' value='Red' />
</include>
</group>

</launch>
43 changes: 0 additions & 43 deletions launch/monza.master

This file was deleted.

Loading