How to write proper launch file by passing arguments?
I trying to write launch file. But i could not find proper solution anywhere.
Python code:
parser = argparse.ArgumentParser(description='Script to run MobileNet-SSD object detection network ')
parser.add_argument("--prototxt", default="/home/user/catkin_ws/src/human_ssd/model/MobileNetSSD_deploy.prototxt",
help='Path to text network file: '
'MobileNetSSD_deploy.prototxt for Caffe model or '
)
parser.add_argument("--weights", default="/home/user/catkin_ws/src/human_ssd/model/MobileNetSSD_deploy.caffemodel",
help='Path to weights: '
'MobileNetSSD_deploy.caffemodel for Caffe model or '
)
parser.add_argument("--thr", default=0.5, type=float, help="confidence threshold to filter out weak detections")
args = parser.parse_args(rospy.myargv()[1:])
Launch fie:
<include file="$(find realsense2_camera)/launch/rs_camera.launch">
<arg name="filters" default="temporal,spatial,hole_filling,decimation"/>
<arg name="align_depth" default="true"/>
</include>
<arg name="--prototxt" default="$(find human_ssd)/model/MobileNetSSD_deploy.prototxt"/>
<arg name="--thr" default="0.3"/>
<arg name="--weights" default="$(find human_ssd)/model/MobileNetSSD_deploy.caffemodel"/>
<node pkg="human_ssd" type="detector.py" name="human_ssd_detector" output="screen">
<param name="--prototxt" value="$(arg --prototxt)"/>
<param name="--thr" value="$(arg --thr)"/>
<param name="--weights" value="$(arg --weights)"/>
</node>
So If i run command
roslaunch human_ssd detector.launch thr:=0.3
The thr takes the value of 0.5