# Cannot read parameters from file in launch file

For example, I just changed the launch file from

<include file="$(find husky_gazebo)/launch/spawn_husky.launch"> <arg name="laser_enabled" value="true"/> </include  into <include file="$(find husky_gazebo)/launch/spawn_husky.launch">
<rosparam command="load" file="$(find husky_highlevel_controller)/config/laser_enable_param.yaml"/> </include  the yaml is only one line: laser_enabled: true  Then it turns out that the parameter fails to be loaded. May someone tell me which part is not right? Thank you. then the parameter edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted The command <rosparam command="load" file="$(find husky_highlevel_controller)/config/laser_enable_param.yaml"/> puts the parameters on the parameter server. The launchfile spawn_husky.launch expects the data as a launch file argument, though.

This is a different concept. Think of it as an argument of a function (launch file argument) versus global variables (rosparam server).

You can just put it in your launchfile, tough:

<include file="$(find husky_gazebo)/launch/spawn_husky.launch"> <arg name="laser_enabled" value="true"/> </include>  more ## Comments Thank you. But why can the argument of a function not take value from global variables? And what should I do if I want to read the parameter from file here? ( 2019-08-07 07:44:25 -0500 )edit I am not entirely sure if this is possible. Args are something that is read by roslaunch when you start the launch file and influence what nodes are started and how. Params are to be read by the node, later when they are started. I think there is no easy way to do this. Maybe you can add some more details about why you want to do this? ( 2019-08-07 10:20:51 -0500 )edit It is possible. See the tutorial example here: http://wiki.ros.org/ROS/Tutorials/Ros... Actually I am trying to finish the exercise 2 of the online class: http://www.rsl.ethz.ch/education-stud..., what I am trying to do is the requirement of the exercise. ( 2019-08-07 20:32:37 -0500 )edit okay, can you maybe post the section of launch file as an answer yourself, then? ( 2019-08-09 10:45:20 -0500 )edit Sorry, I havn't got an answer yet. I was saying I am trying to solve it, but got stuck at this point. I said possible because the official tutorial said so, and the homework requirement said so. ( 2019-08-10 23:14:21 -0500 )edit okay, so you mean Pass the argument laser_enabled from your launch file to the husky_empty_world.launch file with value true. (from the exercise) This does not mean, you need a parameter file. You can just put it in your launchfile <include file="$(find husky_gazebo)/launch/spawn_husky.launch"> <arg name="laser_enabled" value="true"/> </include>

( 2019-08-12 04:23:17 -0500 )edit

you are not the only one who think so. I think the exercise itself does not make it very clear enough. do you see the sentence one line above ? "add loading the parameter file to the launch file", i thinsk it means transfer the true value from file.

( 2019-08-13 09:40:55 -0500 )edit

Do you mean Nr 7? No. this refers to the parameters required husky_highlevel_controller. What you think is still not possible. ;-) The parameter server is explained in the lecture slides on slide 20.

( 2019-08-13 09:58:40 -0500 )edit