Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all 40 articles
Browse latest View live

Dynamic reconfigure default parameters

0
0
I am writing a node which accepts certain parameters. I would like to be able to pass them through a launch file, as well as make them dynamically reconfigurable. What are the best practices regarding this? In particular: - What happens if the value in the launch file is not the same as the default value in the `.cfg` file? - Does it matter whether I register the dynamic reconfigure services before or after getting the parameters from the nodehandle using `getParam()`?

getParamCached in rospy?

0
0
is there a version of getParamCached() in rospy? In roscpp: "ros::NodeHandle::getParamCached() and ros::param::getCached() provide local caching of parameter data. Using these versions informs the Parameter Server that this node would like to be notified when the parameter is changed, and prevents the node from having to re-lookup the value with the parameter server on subsequent calls." If not, what would it take to implement it? I am calling rospy.get_param() in a tight loop. I get some exceptions from httplib (CannotSendRequest and ResponseNotReady). Is it because I am calling get_param() too often? What over exceptions should I look for?

multi-threaded rospy.get_param() crashes: CannotSendRequest and ResponseNotReady

0
0
Hi all, I work with the sushi repository from the [ICRA Mobile Manipulation Challenge](https://kforge.ros.org/Sushi/trac/wiki). When instantiating the *ArmMover* I get "CannotSendRequest" and "ResponseNotReady" exceptions. The *ArmMover* class creates multiple *ArmMoverWorker*, which run their own threads. The reason for the crash seems to be **requests to the parameter server from multiple threads**. Can the parameter server process multiple requests from different threads running on the same node? As a workaround I moved the parameter requests into the constructor of the *ArmMoverWorker* (before the thread is started) and then it works fine.

Difference between using dynamic_reconfigure and using getParam at runtime

0
0
I am trying to understand the benefits of the dynamic reconfigure package. From the [tutorials](http://www.ros.org/wiki/dynamic_reconfigure/Tutorials/SettingUpDynamicReconfigureForANode%28cpp%29), it seems like it creates a new server to handle a fixed number of changing parameters. What is the benefit of this (having a separate server) as opposed to using a getParam call in my code before using the parameter? For example if I have a parameter "publish_laser". In my node that publishes laser scans, I have a line that calls getParam("publish_laser") that retrieves the value from the parameter server, before deciding whether to publish the scan. Does using dynamic_reconfigure in this case make things run faster or show any performance benefits?

knowing when a parameter is updated

0
0
From http://www.ros.org/wiki/ROS/Parameter%20Server%20API or from the NodeHandle API (the getParamCached methods) we see that it is possible to have a parameter cached and updated locally on changes. Does the API provide a way to attach a callback function to these updates?

Repeated calls to rosjava parameter server produce unexpected results.

0
0
During repeated runs with a rosjava master mixing java and C++ nodes (all on Windows, compiled with MSVC), it appeared that a socket connection was dying within the Java code. After some period of time one or more of the C++ nodes would appear to block somewhere down in OS code. Was unable to debug effectively. However, it was noted that the C++ nodes affected were making multiple default parameter calls at 1HZ to the rosjava master: nh.param<:string>("default_param", default_param, "default_value"); After removing these calls, the nodes worked reliably. It seems like repeated calls to the java implementation of the parameter server was causing some kind of hang up. Anyone experienced this? I'll try to debug more and get a stack trace as time allows.

rosrun string parameter syntax

0
0
I am trying to read an integer parameter as string however ros::param::get() does not read it. std::string my_param; if (ros::param::get("~x", my_param)) { ROS_INFO("value=%s", my_param.c_str()); } rosrun planning planner _x:=12 rosrun planning planner _x:="12" It cannot read parameters either way.

rosparams vs. command line arguments for initialization

0
0
In my understanding, nodes can get initialization arguments in two ways: 1. rosrun or roslaunch xml files can pass command line arguments straight to the main method 2. the node can use the ros parameter server to get parameters that have been loaded by rosparam or roslaunch loading a yaml config file. Are there any benefits to one over the other? Perhaps in terms of performance (I plan to use ROS on embedded devices), flexibility, or some other way I'm not thinking of? Or is there a best practice? I see a clear case for yaml in the case of things like motor parameters, since you may want to tweak them while the node is running and save the value you ended up with for subsequent runs. But what about a parameter that will not change during execution such as a parameter that specifies whether a node is left or right handed? Or what about parameters that are not always used? For example, a node type could be 'tcp' or 'serial.' It then either needs an IP address or a port, but not both.

doubt about xacro

0
0
Hi everyone! I have a doubt about XACRO. Is possible from xacro to read a parameters in the Parameters Servers? Thanks!

Can't make "getParams" work in C++

0
0
I'm able to set params but when I get them, it returns success with the wrong value. double myDouble = 7.7; _node.setParam("/my_double", myDouble); double myDoubleFromRos; std::cout 7.7 So I'm successfully setting the parameter but I'm not able to get it. I'm fairly new to ROS so there must be some assumption I'm missing. Any advice would be greatly appreciated. Using fuerte-desktop-full latest.

openni_tracker has problem opening database/parameter File

0
0
I'm trying to use the openni_launch and openni_tracker packages. I made a package called kinect_hmi and a launch file which launches both the openni_launch file and openni_track. When I tested this previously I could view he PointCloud2 data and the tf data in RVIZ. However, today when I started up the code I get the following error. Error opening database/parameters file. The point cloud data still shows up in RVIZ, but the skeleton tracking does not seem to be working. I tried starting roscore, openni_launch, and openni_tracker separately to see if my launch file was the problem but it didn't help. I have no idea why it isn't working all of the sudden. Just in case here is my launch file The camera topics launch file is the following I thought maybe that the parameter server wasn't running so I tried the `rosparam list` command. However, the command returns a long list of things so I'm assuming that the parameter server is running. My question is: Why is this happening and how do I fix it? Thanks in advance

Programatically load yaml config file to the Parameter Server

0
0
How should I do that? I've looked up along the roslaunch and dynamic reconfigure code but I don't find it. Do you know any standard function to do it? By the momment I've done this (but I understand that should exist another way):
config = yaml.load(open(custom_configuration_file))
rospy.loginfo(config)
self.recursive_set_param(config)
...

def recursive_set_param(self, config, key_path=""):
        for k in config.keys():
            data = config[k]
            
            full_qualified_key = key_path + "/" + k
            if data.__class__ == dict:
                self.recursive_set_param(data, full_qualified_key)
            else:
                rospy.set_param(full_qualified_key, config[k])
                rospy.loginfo("SETTING PARAM %s -> %s", full_qualified_key, data)

Sharing a matrix/graph, maybe with the parameter server?

0
0
For a range of experiments I need to be able to define the adjacency matrix for the various robots to define a connected graph. What is the best way to have such a graph/matrix be available to all the robots?

dynamic reconfigure: How explicity fetch data from parameter server?

0
0
I have a dynamic reconfigure server. In my application, eventually an update of the parameter server is done. However these changes are not notified to the dynamic reconfigure server. I would love to force programatically to the dynamic reconfigure server to fetch again the data from the paramter server. I haven't found any function that do that in the cpp API (I think that there exist something in the python api, but it is not my case). I've also tried to remove the parameter server and later build a new parameter server on the same address. It looks like the master meta-information gets messy and the new parameter server does not appear even if the old is not active anymnore. Any idea?

Best practice for online re-configuration between nodes

0
0
Dear all, I'm looking for the best way to achieve the following (in cpp on Fuerte). At the moment, I have one node which should be dynamically reconfigurable (i.e.: start, stop, set camera frame rate). In the long run, there will be many nodes that should be configurable by other nodes, often by one node switching the system into different states. The current state of each node should be accessible by all other nodes. What's the best design to achieve this? My ideas so far: 1. Use dynamic_reconfigure in each node. 2. Provide services for all configurations in each node. 3. Use the parameter_server for exchange of parameters and offer an updateFromServer()-service in each node. Other nodes set the new parameters on the server and then trigger the service to reconfigure accordingly. Probably not very clever as there can be inconsistencies / false assumptions about the current configurations. 4. Use the parameter server with different parameters for the desired (new) configuration and the actual one, again coupled with a updateFromServer()-service. Other nodes set the desired parameter and call the service for starting the reconfiguration. After reconfiguring, the node updates the actual values on the parameter server (where the caller can check, if needed). In case of three and four, I could probably use a regular *getParamCached()* call instead of the service (?). Do any of these seem reasonable? Do you have comments on possible benefits/downsides of using on or another, e.g. in terms of performance, manageability of code (including n services of different other nodes), best practices? Or is there some other method that I didn't discover yet? I'd appreciate your comments or recommendations! Regards, Philip P.S.: If there's any changes between Fuerte and Groovy that may benefit my use-case, I'd probably consider upgrading. --- *EDIT (in reply to comments):* I am not looking for setting and reading a configuration state for the whole system, for which a nice solution was already [given here](http://answers.ros.org/question/43341/project-structure-question-concerning-dynamic-reconfigure-and-the-parameter-server/). I'm rather looking for a way to be able to access and configure each node's parameters on their own during runtime. Thanks for all your input! --- *EDIT (out of curiosity):* In [this tutorial](http://www.ros.org/wiki/ROS/Tutorials/UnderstandingServicesParams), turtlesim is re-configured at runtime via something like method 3 as described above (this is probably where I got that idea in the first place). Does anybody know a specific reason why it is done this way?

How to find out if Rosmaster is running yet?

0
0
I am trying to debug a node that is supposed to publish a "shutdown message" to a topic. Since I am running rostests on my nodes, this message is supposed to get published fairly early after I launch my nodes. Unfortunately, sometimes the message-sending happens and sometimes it doesn't. I am even using the "latch" option on my publisher (so that a subscriber can still receive a message that was sent before the subscriber started). My current suspicion is that the Rosmaster sometimes doesn't have time to initialize. I've been hunting around for a way to check on the Master's status, but I can't seem to find it. Is there a way to make sure the Rosmaster is running? (as an addendum: I'm not looking for a terminal command. I'm looking for some kind of code that would let my node know that rosmaster is reachable.)

String parameter is ignored if numeric, why?

0
0
I am requesting a string parameter from the parameter server in ROS Groovy like this: ros::NodeHandle node_ns("~"); std::string rotations; node_ns.param<:string>("rotations", rotations, std::string("0")); When I run my ROS node with the following command line, everything works fine: ./bin/testnode _rotations:='90 -90 0' i.e. if I check the value of the string "rotations", it is "90 -90 0". However, if I only input a single numeric value as the string's value, ./bin/testnode _rotations:='270' the supplied value is ignored and "rotations" has its default value of "0". I think this occurs because the single value is treated as an integer instead of a string. Is this a bug? This can have pretty nasty consequences! I was debugging my code for over an hour trying to figure out why my supplied parameter value was being ignored although it had worked perfectly in other cases...

Random Node Crashes Over The Network

0
0
I am currently running into a problem that only occurs when trying to run nodes over the network. Let me explain the use case I have. I am currently using Groovy. I start a roscore on my local machine (a Mac for what it's worth). Then, I have generated a set of launch files that will each load a significant number of parameters to the Parameter Server (this input defines how the node constructs its objects and the initialization values for them.) The number of these files is quite large (about 100). I then start these nodes by roslaunching the launch files on 4 other machines (Ubuntu 12.04.3 LTS). The problem I am having is that if I start all these nodes at once, a small percentage of them will not execute(2-5%). The process is terminated before the node even starts. I suspect this has to do with the massive amount of data being processed and served by the parameter server, but I am not certain. My question is, is there a maximum number of nodes that can be ran under the same roscore? Furthermore, are there restrictions on the amount of parameters that can be stored at any given time on the parameter server? Thanks EDIT: Here is the master's log file: [http://www.filedropper.com/master_5](http://www.filedropper.com/master_5) EDIT 2: It might be of relevance to say that each node will need to load on the order of 400 parameters upon launching. So for 100 nodes, this can result in 40000 parameters. UPDATE: I tried running the same situation above, except this time I ran the roscore on an Ubuntu 12.04 machine. The amount of crashed nodes is almost zero in my original test case. When I ran a larger experiment, (many more parameters), 3% of my nodes crashed. (15 out of 500). I also noticed that a mutex is being used in the master.cpp execute function on OSX and not on Linux machines (There are include guards around it). Is this behavior expected when communicating between an OSX machine and a Linux machine?

Getting hirachy level of yaml parameter

0
0
Hi, I want to use ros param to traverse files like this: pcl_filter: filter: filter_cascade_1: in: cloud_in out: cloud_out filter: first_applied_filter: - config_for_filter_1 - config_for_filter_2 second_applied_filter: - config_for_filter_1 - config_for_filter_2 filter_cascade_2: in: other_cloud_in out: other_cloud_out filter: first_applied_filter: - config_for_filter_1 - config_for_filter_2 second_applied_filter: - config_for_filter_1 - config_for_filter_2 There I would like to get all cascades of the param "filter". In the node pcl_filter I search for something like std::vector<:string> param; getParam("filter", param); But this just seems to work with something like: pcl_filter: filter: - filter_cascade_1 - filter_cascade_1 And: std::map<:string std::string> param; getParam("filter", param); just workes with: pcl_filter: filter: filter_cascade_1: a filter_cascade_1: b Does somebody know a way to get all of these parameter? Thanks for your help

Best way to pass parameters to a service

0
0
Hi, It may seem a trivial question, but I couldn't find a good answer in the internet. I would like to write a service (NOT a node) that receives some parameters in input, but I couldn't find a way to pass them that is similar to what you could do with a node (where you retrieve the parameters through the node handler). The only way seems to use the parameter server, but if possible I would prefer to avoid using those kind of "global variables". Any suggestions?
Viewing all 40 articles
Browse latest View live




Latest Images