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

rosparam fails, rqt_reconfigure works with image_transport

asked 2020-10-12 04:52:07 -0500

KenYN gravatar image

This is a strange one on Kinetic; I have an image_transport topic being published in a nodelet, and if I do at the command-line (deleting compressedDepth and theora):

$ rosparam get /repub/front/image_raw/
compressed: {format: jpeg, jpeg_quality: 80, png_level: 9}
rosparam set -v /repub/front/image_raw/compressed/jpeg_quality 5
set parameter [/repub/front/image_raw/compressed/jpeg_quality] to [5]
$ rosparam get /repub/front/image_raw/
compressed: {format: jpeg, jpeg_quality: 5, png_level: 9}

But if I run rostopic bw /repub/front/image_raw/compressed, it reports around 100KB per frame, which is the same value as before running the rosparam set command.

If I then run rqt_configure, the value of jpeg_quality remains at 80. However, if I type in 9, the bandwidth drops down to about 16KB per frame, which reflects the lower quality value. If I then do:

$ rosparam get /repub/front/image_raw/
compressed: {format: jpeg, jpeg_quality: 9, png_level: 9}

I notice that the jpeg_quality reflects the value from rqt_configure, so it's not just a typo. Can anyone explain what might be going on?

One factor might be that I'm using a nodelet and as <remap> doesn't work out of the box, I do this to initialise:

std::string outTopic = ros::names::resolve(nh.getNamespace(), std::string("out_topic"));

auto const &outRemapped = getRemappingArgs().find(outTopic);
if (outRemapped != getRemappingArgs().end())
{
    ROS_INFO("Remapped %s to %s", outTopic.c_str(), outRemapped->second.c_str());
    outTopic = outRemapped->second.c_str();
}

image_transport::ImageTransport it(nh);
m_pub = it.advertise(outTopic, 1);

ROS2 seems to have the concept of both "namespace" and "effective namespace" - is there something similar going on here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-10-12 06:19:02 -0500

gvdhoorn gravatar image

Are you expecting node(let)s to be aware of parameter changes without using dynamic_reconfigure?

If so, that's not an assumption you can make. It's not good practice to read parameters after having started a node / initialised a nodelet, so I would not be surprised if your nodelet does not update its settings after changing them with rosparam set ...

edit flag offensive delete link more

Comments

I see what you mean! Yes, it looks like my misunderstanding here... Would it be best to close this?

KenYN gravatar image KenYN  ( 2020-10-12 06:25:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-10-12 04:52:07 -0500

Seen: 129 times

Last updated: Oct 12 '20