0
$\begingroup$

Rosanswers logo

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


Originally posted by lochlomond on ROS Answers with karma: 61 on 2019-08-06

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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>

Originally posted by ct2034 with karma: 862 on 2019-08-07

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by lochlomond on 2019-08-07:
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?

Comment by ct2034 on 2019-08-07:
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?

Comment by lochlomond on 2019-08-07:
It is possible. See the tutorial example here: http://wiki.ros.org/ROS/Tutorials/Roslaunch%20tips%20for%20larger%20projects#roslaunch.2BAC8-Tutorials.2BAC8-Roslaunch_tips_for_larger_projects.Parameters.2C_namespaces.2C_and_yaml_files

Actually I am trying to finish the exercise 2 of the online class: http://www.rsl.ethz.ch/education-students/lectures/ros.html, what I am trying to do is the requirement of the exercise.

Comment by ct2034 on 2019-08-09:
okay, can you maybe post the section of launch file as an answer yourself, then?

Comment by lochlomond on 2019-08-10:
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.

Comment by ct2034 on 2019-08-12:
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>

Comment by lochlomond on 2019-08-13:
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.

Comment by ct2034 on 2019-08-13:
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.

Comment by Pallav on 2019-08-18:
Could you please state, what is your application and what do you want to achieve? It's a little bit confusing. Serms like you are trying to transfer global variables from two separate scripts in a launch file? Am I right?

Comment by lochlomond on 2019-08-18:
I just want to put the "true" in this line in to a yaml file, and read the true value from it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.