Difference between revisions of "Launch files"

From Bike Wiki
Jump to navigation Jump to search
(Created page with "Bruh")
 
Line 1: Line 1:
Bruh
+
<code>
 +
<?xml version="1.0"?>
 +
//Tag to indicate the start of a launch file.  Should be included in every launch file
 +
<launch>
 +
  //"arg name=" sets up variable names that can be referenced later in the launch file by using $(arg [given arg name]). 
 +
  //See corresponding documentation to determine what to set the default value to
 +
    <arg name="camera_name"          default="zed" />
 +
    <arg name="zed_nodelet_name"      default="zed_nodelet" />
 +
    <arg name="svo_file"              default="" /><!-- <arg name="svo_file" default="path/to/svo/file.svo"> -->
 +
    <arg name="stream"                default="" /> <!-- <arg name="stream" default="<ip_address>:<port>"> -->
 +
    <arg name="base_frame"            default="base_link" />
 +
    <arg name="publish_urdf"          default="true" />
 +
    <arg name="camera_id"            default="0" />
 +
    <arg name="gpu_id"                default="-1" />
 +
    <arg name="cam_pos_x"            default="0.0" />
 +
    <arg name="cam_pos_y"            default="0.0" />
 +
    <arg name="cam_pos_z"            default="0.0" />
 +
    <arg name="cam_roll"              default="0.0" />
 +
    <arg name="cam_pitch"            default="0.0" />
 +
    <arg name="cam_yaw"              default="0.0" />
 +
  //Here is the portion of the launch file where the a nodlet manager is created
 +
    <arg name="nodelet_manager_name"  default="$(arg camera_name)_nodelet_manager" />
 +
  //"group ns=" is used to create aliases to prevent collision in larger projects.  You can reference the group by
 +
  writing "groupname/param_to_be_referenced"
 +
    <group ns="$(arg camera_name)">
 +
        //"node pkg=" initializes a node with the given parameters
 +
        //nodelets are groups of nodes that are grouped together for efficiency purposes
 +
        <node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager_name)"  args="manager" output="screen" />
 +
      //"include file=" is how you reference args declared in a different launch file
 +
        <include file="$(find zed_wrapper)/launch/include/zed_camera_nodelet.launch">
 +
            <arg name="nodelet_manager_name"            value="$(arg nodelet_manager_name)" />
 +
            <arg name="camera_name"                    value="$(arg camera_name)" />
 +
            <arg name="svo_file"                        value="$(arg svo_file)" />
 +
            <arg name="stream"                          value="$(arg stream)" />
 +
            <arg name="node_name"                      value="$(arg zed_nodelet_name)" />
 +
            <arg name="camera_model"                    value="$(arg camera_model)" />
 +
            <arg name="base_frame"                      value="$(arg base_frame)" />
 +
            <arg name="publish_urdf"                    value="$(arg publish_urdf)" />
 +
            <arg name="cam_pos_x"                      value="$(arg cam_pos_x)" />
 +
            <arg name="cam_pos_y"                      value="$(arg cam_pos_y)" />
 +
            <arg name="cam_pos_z"                      value="$(arg cam_pos_z)" />
 +
            <arg name="cam_roll"                        value="$(arg cam_roll)" />
 +
            <arg name="cam_pitch"                      value="$(arg cam_pitch)" />
 +
            <arg name="cam_yaw"                        value="$(arg cam_yaw)" />
 +
        </include>
 +
        <node pkg="nodelet" type="nodelet" name="depthimage_to_laserscan" args="load depthimage_to_laserscan/DepthImageToLaserScanNodelet $(arg nodelet_manager_name)">
 +
            //similar to "arg name =" "param name=" sets values needed for a node to function"
 +
            <param name="scan_height" value="10"/>
 +
            <param name="output_frame_id" value="$(arg camera_name)_left_camera_frame"/>
 +
            <param name="range_min" value="0.1"/>
 +
            <remap from="image" to="$(arg zed_nodelet_name)/depth/depth_registered"/>
 +
        </node>
 +
    </group>
 +
</launch>
 +
</code>

Revision as of 18:26, 9 May 2020

<?xml version="1.0"?> //Tag to indicate the start of a launch file. Should be included in every launch file <launch>

  //"arg name=" sets up variable names that can be referenced later in the launch file by using $(arg [given arg name]).  
  //See corresponding documentation to determine what to set the default value to
   <arg name="camera_name"           default="zed" />
   <arg name="zed_nodelet_name"      default="zed_nodelet" />
   <arg name="svo_file"              default="" />
   <arg name="stream"                default="" /> 
   <arg name="base_frame"            default="base_link" />
   <arg name="publish_urdf"          default="true" />
   <arg name="camera_id"             default="0" />
   <arg name="gpu_id"                default="-1" />
   <arg name="cam_pos_x"             default="0.0" />
   <arg name="cam_pos_y"             default="0.0" />
   <arg name="cam_pos_z"             default="0.0" />
   <arg name="cam_roll"              default="0.0" />
   <arg name="cam_pitch"             default="0.0" />
   <arg name="cam_yaw"               default="0.0" />
  //Here is the portion of the launch file where the a nodlet manager is created
   <arg name="nodelet_manager_name"  default="$(arg camera_name)_nodelet_manager" />
  //"group ns=" is used to create aliases to prevent collision in larger projects.  You can reference the group by
  writing "groupname/param_to_be_referenced"
   <group ns="$(arg camera_name)">
       //"node pkg=" initializes a node with the given parameters
       //nodelets are groups of nodes that are grouped together for efficiency purposes
       <node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager_name)"  args="manager" output="screen" />
      //"include file=" is how you reference args declared in a different launch file
       <include file="$(find zed_wrapper)/launch/include/zed_camera_nodelet.launch">
           <arg name="nodelet_manager_name"            value="$(arg nodelet_manager_name)" />
           <arg name="camera_name"                     value="$(arg camera_name)" />
           <arg name="svo_file"                        value="$(arg svo_file)" />
           <arg name="stream"                          value="$(arg stream)" />
           <arg name="node_name"                       value="$(arg zed_nodelet_name)" />
           <arg name="camera_model"                    value="$(arg camera_model)" />
           <arg name="base_frame"                      value="$(arg base_frame)" />
           <arg name="publish_urdf"                    value="$(arg publish_urdf)" />
           <arg name="cam_pos_x"                       value="$(arg cam_pos_x)" />
           <arg name="cam_pos_y"                       value="$(arg cam_pos_y)" />
           <arg name="cam_pos_z"                       value="$(arg cam_pos_z)" />
           <arg name="cam_roll"                        value="$(arg cam_roll)" />
           <arg name="cam_pitch"                       value="$(arg cam_pitch)" />
           <arg name="cam_yaw"                         value="$(arg cam_yaw)" />
       </include>
       <node pkg="nodelet" type="nodelet" name="depthimage_to_laserscan" args="load depthimage_to_laserscan/DepthImageToLaserScanNodelet $(arg nodelet_manager_name)">
            //similar to "arg name =" "param name=" sets values needed for a node to function"
            <param name="scan_height" value="10"/>
            <param name="output_frame_id" value="$(arg camera_name)_left_camera_frame"/>
            <param name="range_min" value="0.1"/>
            <remap from="image" to="$(arg zed_nodelet_name)/depth/depth_registered"/>
       </node>
   </group>

</launch>