[ros-users] Param from launch file: node vs nodelet

Patrick Bouffard bouffard at eecs.berkeley.edu
Tue Jan 25 22:02:36 UTC 2011


Ivan,

You need to use something like

    nh_private = getMTPrivateNodeHandle();

.. and this should be in void onInit().

hth,

Pat


On Tue, Jan 25, 2011 at 1:56 PM, Ivan Dryanovski
<ivan.dryanovski at gmail.com> wrote:
> Hi all,
>
> I am having some trouble with getting parameters from a launch file.
> The same bit of code worked well with a node driver, but when i
> switched to a nodelet driver, it fails. I am running on Ubuntu 10.10,
> ros unstable.
>
> Here are some more details:
>
> I have the following bit of code running to get a parameter:
>
>    ros::NodeHandle nh_private ("~");
>    if (!nh_private.getParam ("enable_IMU_CALCDATA", enable_IMU_CALCDATA_))
>      enable_IMU_CALCDATA_ = false;
>
> When I run that code with a node driver, everything works fine. I use
> the following launch file:
>
>  <node name="autopilot" pkg="asctec_autopilot" type="autopilot_node"
> respawn="false" required="true" output="screen">
>    <param name="enable_IMU_CALCDATA" type="bool" value="true"/>
>  </node>
>
> However, when I run the code with a nodelet driver, it fails to check
> the param, and assumes the default (false) value. This is the launch
> file for the nodelet:
>
>  <node pkg="nodelet" type="nodelet" name="pelican_manager"
> args="manager" output="screen" />
>  <node pkg="nodelet" type="nodelet" name="AutoPilotNodelet"
> args="load asctec_autopilot/AutoPilotNodelet pelican_manager"
> output="screen">
>    <param name="enable_IMU_CALCDATA" type="bool" value="true"/>
>  </node>
>
> Any help would be appreciated!
>
> Thanks,
> Ivan Dryanovski
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



More information about the ros-users mailing list