Please explain the following snippet

Hi,
Could somebody please explain the following piece of code from the course project?

might be wrong but looks to me like

  1. changes directory to where the spots.yaml file is
  2. loads the spots.yaml file and saves it in paramlist
  3. goes through all the params and ns in paramlist
  4. goes through all the key, value pairs in the params dictionary
  5. if the key == request.label the parameter is uploaded

So this all looks like we only load the parameters defined in request.label from the spots.yaml file

Hi Simon,
I wanted to understand what params and ns were in for params, ns in paramlist:, so I tried printing the values and it returned params as the dictionaries stored in list paramlist but ns just returned “/”. What does this mean?

Also, where are the parameters uploaded in rosparam.upload_params(ns, params)? Like when returning the outcome of a service or action, we assign it to “response.variable_name” or “result.variable_name”, what exactly is happening in the above mentioned line of code?

Hi @shiruraditya, hope you are having a good day. Well the params are the parameter server. You can get a better understanding of this topic in the end of the course ROS Basics in 5 days and after following and reading up on that I would recommend you to read in depth using the following link: http://wiki.ros.org/Parameter%20Server

Let me know if you want any other help regarding this. I will be more then happy to help out. Cheers. :slight_smile: