ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You have two options:

  1. use private parameters: those are relative to the node itself.

    You'd have to move your rosparam element and make it a child of each node element (so you'd have two of them, loading different parameter files)

  2. move the rosparam element inside the group you've created. So again, you'd create two files, one for each node

In either case, you can't do this:

ros::param::get("/read_attempt",loop);

as the / there makes the parameter name a fully resolved one, which can't be namespaced and will always look at the global parameter space.

You have two options:

  1. use private parameters: those are relative to the node itself.

    You'd have to move your rosparam element and make it a child of each node element (so you'd have two of them, loading different parameter files)

  2. move the rosparam element inside the group you've created. So again, you'd create two files, one for each node

In either case, you can't do this:

ros::param::get("/read_attempt",loop);

as the / there makes the parameter name a fully resolved one, which can't be namespaced and will always look at the global parameter space.

Remove the / and it would immediately become a relative parameter, which will be resolved against the current 'active' namespace.

Note that your question is almost a duplicate of #q146486, but I've answered it again, as your title specifically mentions "with different parameters".


You have two options:

  1. use private parameters: those are relative to the node itself.itself. This is also suggested in #q146486.

    You'd have to move your rosparam element and make it a child of each node element (so you'd have two of them, loading different parameter files)

  2. move the rosparam element inside the group you've created. So again, you'd create two files, one for each node

In either case, you can't do this:

ros::param::get("/read_attempt",loop);

as the / there makes the parameter name a fully resolved one, which can't be namespaced and will always look at the global parameter space.

Remove the / and it would immediately become a relative parameter, which will be resolved against the current 'active' namespace.