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

I'm assuming that you mean

rospy.loginfo("Config set to {int_param}, {double_param}, {str_param}, {bool_param}, {size}".format(**config))

This is just plain Python. From the Python docs

format(format_string, *args, **kwargs)

The primary API method. It takes a format string and an arbitrary set of positional and keyword arguments. It is just a wrapper that calls vformat().

As for the **config, checkout this answer on StackOverlfow:

This is a shortcut that allows you to pass multiple arguments to a function directly using either a list/tuple or a dictionary.

As for using it with numpy, I'm not too familiar with numpy but I don't believe that you do. But, you should ask a new question about that specifically.

I'm assuming that you mean

rospy.loginfo("Config set to {int_param}, {double_param}, {str_param}, {bool_param}, {size}".format(**config))

This is just plain Python. From the Python docs

format(format_string, *args, str.format(*args, **kwargs)

Perform a string formatting operation. The primary API method. It takes a format string and an arbitrary set of string on which this method is called can contain literal text or replacement fields delimited by braces {}. Each replacement field contains either the numeric index of a positional and argument, or the name of a keyword arguments. It is just a wrapper that calls vformat(). argument. Returns a copy of the string where each replacement field is replaced with the string value of the corresponding argument.

As for the **config, checkout this answer on StackOverlfow:

This is a shortcut that allows you to pass multiple arguments to a function directly using either a list/tuple or a dictionary.

As for using it with numpy, I'm not too familiar with numpy but I don't believe that you do. But, you should ask a new question about that specifically.

I'm assuming that you mean

rospy.loginfo("Config set to {int_param}, {double_param}, {str_param}, {bool_param}, {size}".format(**config))

This is just plain Python. From the Python docs

str.format(*args, **kwargs)

Perform a string formatting operation. The string on which this method is called can contain literal text or replacement fields delimited by braces {}. {}. Each replacement field contains either the numeric index of a positional argument, or the name of a keyword argument. Returns a copy of the string where each replacement field is replaced with the string value of the corresponding argument.

As for the **config, checkout this answer on StackOverlfow:

This is a shortcut that allows you to pass multiple arguments to a function directly using either a list/tuple or a dictionary.

As for using it with numpy, I'm not too familiar with numpy but I don't believe that you do. But, you should ask a new question about that specifically.