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

Improve/launchstructure #2

Draft
wants to merge 6 commits into
base: cura
Choose a base branch
from
Draft
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
184 changes: 30 additions & 154 deletions launch/start.launch
Original file line number Diff line number Diff line change
@@ -1,176 +1,52 @@
<?xml version="1.0"?>
<launch>
<!-- Configurable Parameters -->

<!-- Robot and Load Naming -->
<arg name="robotName" default="ropod"/>
<!--arg name="robotName" default="ropod_tue_1"/-->
<arg name="robotCommonName" default="ropod"/>
<arg name="loadName" default="mobidik"/>
<arg name="LOAD_ATTACHED" default="false" />
<!-- Laser parameters -->
<arg name="laser" default="true"/>
<arg name="laser1_name" value ="laser"/>
<arg name="laser2_name" value ="laser_back"/>
<arg name="add_laser_back" value="false"/>
<!-- <arg name="laser1_name" value ="hokuyo_laser_ip"/>-->
<!-- Camera parameters -->
<arg name="asus_cam" default="false"/>
<arg name="asus_cam_name" value="asusxtion"/>
<arg name="asus_cam_calibration" default="false"/>
<!-- Application parameters -->
<arg name="gmapping" default="false"/>
<!--<arg name="floorplan" default="$(find ropod_demo_dec_2017)/config/shape/floorplan_ropod_demo"/>-->
<!-- <arg name="floorplan" default="$(find ed_object_models)/models/hospital_test_amcl/walls/shape/Floorplan_demo_ROPOD_amcl"/> -->
<arg name="floorplan" default="$(find ropod_maps)/onsite_generic_demo/map"/>
<arg name="ROBOT_REAL" default="$(optenv ROBOT_REAL)" />
<arg name="gui" default="true"/>
<!-- Path variables -->
<arg name="robot_path" default="$(env CATKIN_WORKSPACE)/src/platform"/>

<!-- <arg name="robot_bringup_path" default="$(arg robot_path)/$(arg robotName)"/>-->
<arg name="robotPackage" default="ropod_tue_2_bringup"/>
<arg name="robot_bringup_path" default="$(arg robot_path)/$(arg robotPackage)"/>

<!-- Include Launch files -->
<!-- Launch Simulator -->
<include unless="$(arg ROBOT_REAL)" file="$(arg robot_bringup_path)/launch/subfiles/launchsim.launch">
<arg name="robot" value="$(arg robotCommonName)"/>
<arg name="floorplan" default="$(arg floorplan)"/>
<arg name="gui" default="$(arg gui)" />
</include>
<!-- Include instance of robot -->
<include file="$(arg robot_bringup_path)/launch/startSingle.launch">
<!-- Robot and Load Naming -->
<arg name="robotName" value="$(arg robotName)"/>
<arg name="robotCommonName" value="$(arg robotCommonName)"/>
<arg name="LOAD_ATTACHED" value="$(arg LOAD_ATTACHED)"/>
<!-- Laser parameters -->
<arg name="laser" value="$(arg laser)"/>
<arg name="add_laser_back" value="$(arg add_laser_back)"/>
<!-- Camera parameters -->
<arg name="asus_cam" value="$(arg asus_cam)"/>
<arg name="asus_cam_calibration" value="$(arg asus_cam_calibration)"/>
<!-- Application parameters -->
<arg name="gmapping" value="$(arg gmapping)"/>
<arg name="ROBOT_REAL" value="$(arg ROBOT_REAL)"/>
</include>

<group ns="$(arg robotName)">
<!-- Start gmapping if required-->
<group if="$(arg gmapping)">
<include file="$(find robot_common)/launch/localization/gmapping.launch">
<arg name="robot" value="$(arg robotCommonName)" />
<arg name="sensor" value="$(arg laser1_name)"/>
</include>
</group>

<group if="$(arg ROBOT_REAL)">
<!-- Do for both: Simulator and Real Robot -->

<node name="ropod_low_level_control" pkg="ropod_low_level_control" type="ropod_low_level_control_ros" output="screen">

<remap from="/$(arg robotName)/ropod_low_level_control/odom" to="/$(arg robotName)/odom_incomplete"/>
<param name="platform_dxdy_cntr/Kgain" value="350.0"/>
<param name="platform_dxdy_cntr/I_fhz" value="0.25"/>
<param name="platform_dxdy_cntr/LPF_fhz" value="50.0"/>
<param name="platform_dxdy_cntr/LL_wz_fhz" value="20.0"/>
<param name="platform_dxdy_cntr/LL_wp_fhz" value="20.0"/>
<param name="platform_dtheta_cntr/Kgain" value="200.0"/>
<param name="platform_dtheta_cntr/I_fhz" value="0.3"/>
<param name="platform_dtheta_cntr/LPF_fhz" value="50.0"/>
<param name="platform_dtheta_cntr/LL_wz_fhz" value="20.0"/>
<param name="platform_dtheta_cntr/LL_wp_fhz" value="20.0"/>
<param name="platform_dvarphi_cntr/Kgain" value="0.10"/>
<param name="platform_dvarphi_cntr/I_fhz" value="0.0"/>
<param name="platform_dvarphi_cntr/LPF_fhz" value="50.0"/>
<param name="platform_dvarphi_cntr/LL_wz_fhz" value="2.0"/>
<param name="platform_dvarphi_cntr/LL_wp_fhz" value="10.0"/>
</node>

<!-- dynamic tf broadcaster -->
<group unless="$(arg LOAD_ATTACHED)">
<!-- <node pkg="$(arg robotName)_bringup" type="ropod_mobidik_tf_broadcaster_only_ropod" name="ropod_mobidik_tf_broadcaster_only_ropod">-->
<node pkg="$(arg robotPackage)" type="ropod_mobidik_tf_broadcaster_only_ropod" name="ropod_mobidik_tf_broadcaster_only_ropod">
<remap from="/ropod/cmd_vel" to="/$(arg robotName)/cmd_vel"/>
<remap from="/ropod/odom" to="/$(arg robotName)/odom"/>
<!-- <remap from="/ropod/odom_incomplete" to="/$(arg robotName)/odom_incomplete"/>-->
</node>
</group>

<group if="$(arg LOAD_ATTACHED)">
<node pkg="$(arg robotName)_bringup" type="ropod_mobidik_tf_broadcaster" name="ropod_mobidik_tf_broadcaster" />
</group>

<!-- Specify static transforms -->
<include file="$(arg robot_bringup_path)/parameters/hardware/static_tf.launch">
<!-- <arg name="robot" value="$(arg robotCommonName)" /> -->
<arg name="robot" value="$(arg robotName)" />
<arg name="laser1" value="$(arg laser1_name)"/>
</include>

<!-- Laser publishing -->
<group if="$(arg laser)">
<!-- <include file="$(find robot_common)/launch/hardware/hokuyo_laser.launch">
<arg name="bringup_path" value="$(arg robot_bringup_path)"/>
<arg name="name" value="$(arg laser1_name)"/>
<arg name="robot" value="$(arg robotCommonName)"/>
</include> -->




<group ns="$(arg laser1_name)">
<node pkg="urg_node" type="urg_node" name="urg_node" output="screen">
<rosparam command="load" file="$(arg robot_bringup_path)/parameters/hardware/hokuyo_laser_front.yaml"/>
<remap from="/diagnostics" to="diagnostics_back"/>
</node>

<!--
<node name="urg_node" pkg="urg_node" type="urg_node" output="screen">
<param name="ip_address" value="192.168.44.127"/>
<param name="serial_port" value="/dev/ttyACM0"/>
<param name="serial_baud" value="115200"/>
<param name="frame_id" value="laser"/>
<param name="calibrate_time" value="true"/>
<param name="publish_intensity" value="false"/>
<param name="publish_multiecho" value="false"/>
<param name="angle_min" value="-1.5707963"/>
<param name="angle_max" value="1.5707963"/>
<remap from="scan" to="/ropod/laser/scan" />
</node>
-->


<node name="laserBack_NoiseReduction" pkg="ropod_tue_2_bringup" type="laserBack_NoiseReduction" output="screen">

</node>

</group>

</group>
</group>
</group>

<group unless="$(arg ROBOT_REAL)">
<!-- SIMULATION -->
<param name="/use_sim_time" value="true" />
<group unless="$(arg LOAD_ATTACHED)">
<include file="$(find ropod_sim_model)/launch/simulator/gazebo_simulator.launch">
<arg name="robot" value="$(arg robotCommonName)" />
<arg name="model_name" value="$(arg robotCommonName)_$(arg loadName)" />
<arg name="model_path" value="$(arg robot_path)/$(arg robotCommonName)_sim_model" />
<arg name="movingObjects" value="false" />
<!-- <arg name="doubleLaser" value="false"/>-->
</include>

<!-- Launch tf broadcaster for ropod robot -->
<node pkg="$(arg robotPackage)" type="ropod_mobidik_tf_broadcaster_only_ropod" name="ropod_mobidik_tf_broadcaster_only_ropod" />

</group>


<group if="$(arg LOAD_ATTACHED)">

<include file="$(find ropod_sim_model)/launch/simulator/gazebo_simulator.launch">
<arg name="robot" value="$(arg robotCommonName)" />
<arg name="model_name" value="$(arg robotCommonName)_$(arg loadName)" />
<arg name="model_path" value="$(arg robot_path)/$(arg robotCommonName)_model" />
<!-- <arg name="doubleLaser" value="false"/>-->
</include>

<!-- Launch tf broadcaster for ropod robot -->
<node pkg="$(arg robotPackage)" type="ropod_mobidik_tf_broadcaster_simulator" name="ropod_mobidik_tf_broadcaster_simulator" />

</group>

<!-- Specify static transforms -->
<include file="$(arg robot_bringup_path)/parameters/hardware/static_tf.launch">
<!-- arg name="robot" value="$(arg robotCommonName)" /> -->
<arg name="robot" value="$(arg robotName)" />
<arg name="laser1" value="$(arg laser1_name)"/>
</include>
<node pkg="tf" type="static_transform_publisher" name="base2LRFBack" args="-0.285 0.0 0.27 3.14 0 0 /$(arg robotName)/base_link /$(arg robotName)/$(arg laser2_name)/scan 100" />


<!-- Add floorplan. -->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(arg floorplan).urdf -urdf -z 1 -model floorplan -x -4.5 -y 2.0 -z 0.0 -Y 0.0" />

<!-- Launch RVIZ -->
<include file="$(arg robot_bringup_path)/launch/tools/rviz.launch">
<arg name="robot_bringup" value="$(arg robot_bringup_path)"/>
</include>

</group>

</launch>
81 changes: 81 additions & 0 deletions launch/startSingle.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0"?>
<launch>
<!-- Configurable Parameters -->
<!-- Robot and Load Naming -->
<arg name="robotName" default="ropod"/>
<arg name="robotCommonName" default="ropod"/>
<arg name="loadName" default="mobidik"/>
<arg name="LOAD_ATTACHED" default="false" />
<!-- Laser parameters -->
<arg name="laser" default="true"/>
<arg name="laser1_name" default ="laser"/>
<arg name="laser2_name" default ="laser_back"/>
<arg name="add_laser_back" default="false"/>
<!-- Camera parameters -->
<arg name="asus_cam" default="false"/>
<arg name="asus_cam_name" default="asusxtion"/>
<arg name="asus_cam_calibration" default="false"/>
<!-- Application parameters -->
<arg name="gmapping" default="false"/>
<arg name="floorplan" default="$(find ropod_maps)/onsite_generic_demo/map"/>
<arg name="ROBOT_REAL" default="$(optenv ROBOT_REAL)" />
<!-- Path variables -->
<arg name="robot_path" default="$(env CATKIN_WORKSPACE)/src/platform"/>
<arg name="robotPackage" default="ropod_tue_2_bringup"/>
<arg name="robot_bringup_path" default="$(arg robot_path)/$(arg robotPackage)"/>
<!-- Launch these nodes in the robot namespace -->
<group ns="$(arg robotName)">
<!-- Launch these nodes if we are working on the real robot hardware -->
<group if="$(arg ROBOT_REAL)">
<!-- #TODO check if we need to include gmapping, and which files.
Currently removed due to reliance on outdated files -->
<!-- Launch the lowlevelcontrol node -->
<include file="$(arg robot_bringup_path)/launch/subfiles/lowlevelcontrol.launch">
<arg name="robotName" value="$(arg robotName)"/>
</include>
<!-- Launch the transformation publishing nodes -->
<include file="$(arg robot_bringup_path)/launch/subfiles/transforms.launch">
<arg name="robotName" value="$(arg robotName)"/>
<arg name="robotPackage" value="$(arg robotPackage)"/>
<arg name="robot_path" value="$(arg robot_path)"/>
<arg name="robot_bringup_path" value="$(arg robot_bringup_path)"/>
<arg name="LOAD_ATTACHED" value="$(arg LOAD_ATTACHED)"/>
<arg name="ROBOT_REAL" value="$(arg ROBOT_REAL)"/>
<arg name="laser1_name" value="$(arg laser1_name)"/>
<arg name="add_laser_back" value="$(arg add_laser_back)"/>
<arg name="laser2_name" value ="$(arg laser2_name)"/>
</include>
<!-- Launch the laser nodes -->
<include file="$(arg robot_bringup_path)/launch/subfiles/laser.launch">
<arg name="laser" value="$(arg laser)"/>
<arg name="laser1_name" value="$(arg laser1_name)"/>
<arg name="robot_path" value="$(arg robot_path)"/>
<arg name="robotPackage" value="$(arg robotPackage)"/>
<arg name="robot_bringup_path" value="$(arg robot_bringup_path)"/>
</include>
</group>
<!-- Launch these nodes if we are working in simulation -->
<group unless="$(arg ROBOT_REAL)">
<!-- Launch the transformation publishing nodes -->
<include file="$(arg robot_bringup_path)/launch/subfiles/transforms.launch">
<arg name="robotName" value="$(arg robotName)"/>
<arg name="robotPackage" value="$(arg robotPackage)"/>
<arg name="robot_path" value="$(arg robot_path)"/>
<arg name="robot_bringup_path" value="$(arg robot_bringup_path)"/>
<arg name="LOAD_ATTACHED" value="$(arg LOAD_ATTACHED)"/>
<arg name="ROBOT_REAL" value="$(arg ROBOT_REAL)"/>
<arg name="laser1_name" value="$(arg laser1_name)"/>
<arg name="add_laser_back" value="$(arg add_laser_back)"/>
<arg name="laser2_name" value ="$(arg laser2_name)"/>
</include>
<!-- Spawn the Robot -->
<include file="$(arg robot_bringup_path)/launch/subfiles/spawn_robot.launch">
<arg name="robot" value="$(arg robotName)"/>
<arg name="model_name" if="$(arg LOAD_ATTACHED)" value="$(arg robotCommonName)_$(arg loadName)"/>
<arg name="model_name" unless="$(arg LOAD_ATTACHED)" value="$(arg robotCommonName)"/>
</include>
</group>
</group>


</launch>
17 changes: 17 additions & 0 deletions launch/subfiles/laser.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<launch>
<arg name="laser" default="true"/>
<arg name="laser1_name" default="laser"/>
<arg name="robotPackage" default="ropod_tue_2_bringup"/>
<arg name="robot_path" default="$(env CATKIN_WORKSPACE)/src/platform"/>
<arg name="robot_bringup_path" default="$(arg robot_path)/$(arg robotPackage)"/>

<group if="$(arg laser)" ns="$(arg laser1_name)">
<node pkg="urg_node" type="urg_node" name="urg_node" output="screen">
<rosparam command="load" file="$(arg robot_bringup_path)/parameters/hardware/hokuyo_laser_front.yaml"/>
<remap from="/diagnostics" to="diagnostics_back"/>
</node>
<node name="laserBack_NoiseReduction" pkg="ropod_tue_2_bringup" type="laserBack_NoiseReduction" output="screen"/>
</group>

</launch>
30 changes: 30 additions & 0 deletions launch/subfiles/launchsim.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<launch>
<!-- Gazebo enviroment variables -->
<env name="GAZEBO_MODEL_PATH" value="$(find ropod_sim_model)/simulator/models:$(optenv GAZEBO_MODEL_PATH)"/>
<env name="GAZEBO_RESOURCE_PATH" value="$(find ropod_sim_model)/simulator:$(optenv GAZEBO_RESOURCE_PATH)"/>
<env name="GAZEBO_PLUGIN_PATH" value="$(env CATKIN_WORKSPACE)/devel/lib:$(optenv GAZEBO_PLUGIN_PATH)"/>

<!-- Configurable Parameters -->
<arg name="robot" default="ropod"/>
<arg name="floorplan" default="$(find ropod_maps)/onsite_generic_demo/map"/>
<arg name="gui" default="true" />
<param name="/use_sim_time" value="true" />
<!-- Path parameters -->
<arg name="robot_path" default="$(env CATKIN_WORKSPACE)/src/platform"/>
<arg name="robotPackage" default="ropod_tue_2_bringup"/>
<arg name="robot_bringup_path" default="$(arg robot_path)/$(arg robotPackage)"/>

<!-- Launch Gazebo with an empty world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="gui" value ="true"/>
</include>

<!-- Add floorplan. -->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(arg floorplan).urdf -urdf -z 1 -model floorplan -x -4.5 -y 2.0 -z 0.0 -Y 0.0" />

<!-- Launch RVIZ -->
<include file="$(arg robot_bringup_path)/launch/tools/rviz.launch">
<arg name="robot_bringup" value="$(arg robot_bringup_path)"/>
</include>
</launch>
23 changes: 23 additions & 0 deletions launch/subfiles/lowlevelcontrol.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<launch>
<arg name="robotName" default="ropod"/>

<node name="ropod_low_level_control" pkg="ropod_low_level_control" type="ropod_low_level_control_ros" output="screen">
<remap from="/$(arg robotName)/ropod_low_level_control/odom" to="/$(arg robotName)/odom_incomplete"/>
<param name="platform_dxdy_cntr/Kgain" value="350.0"/>
<param name="platform_dxdy_cntr/I_fhz" value="0.25"/>
<param name="platform_dxdy_cntr/LPF_fhz" value="50.0"/>
<param name="platform_dxdy_cntr/LL_wz_fhz" value="20.0"/>
<param name="platform_dxdy_cntr/LL_wp_fhz" value="20.0"/>
<param name="platform_dtheta_cntr/Kgain" value="200.0"/>
<param name="platform_dtheta_cntr/I_fhz" value="0.3"/>
<param name="platform_dtheta_cntr/LPF_fhz" value="50.0"/>
<param name="platform_dtheta_cntr/LL_wz_fhz" value="20.0"/>
<param name="platform_dtheta_cntr/LL_wp_fhz" value="20.0"/>
<param name="platform_dvarphi_cntr/Kgain" value="0.10"/>
<param name="platform_dvarphi_cntr/I_fhz" value="0.0"/>
<param name="platform_dvarphi_cntr/LPF_fhz" value="50.0"/>
<param name="platform_dvarphi_cntr/LL_wz_fhz" value="2.0"/>
<param name="platform_dvarphi_cntr/LL_wp_fhz" value="10.0"/>
</node>
</launch>
18 changes: 18 additions & 0 deletions launch/subfiles/spawn_robot.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<launch>
<!-- Configurable Parameters -->
<arg name="robot" default="ropod"/>
<arg name="model_name" default="ropod"/>

<!-- Spawn a robot entitiy -->
<node name="ropod_spawn" pkg="gazebo_ros" type="spawn_model" output="screen" args="-sdf
-file $(find ropod_sim_model)/simulator/models/$(arg model_name)/$(arg model_name).sdf
-model $(arg robot)
-x 0
-y 0
-z 0
-R 0 -P 0 -Y 0"/>
<!-- Throttle laser output -->
<node name="throttle_laser_front" pkg="topic_tools" type="throttle" args="messages /$(arg robot)/laser_sim 20.0 /$(arg robot)/laser/scan" />
<node name="throttle_laser_back" pkg="topic_tools" type="throttle" args="messages /$(arg robot)/laser_back_sim 20.0 /$(arg robot)/laser/scan_back"/>
</launch>
Loading