How to get list element from rosparam parameter from the cmd? [closed]

asked 2018-10-19 11:13:49 -0500

Hakaishin gravatar image

I loaded this yaml file:

num_boxes: 1
boxes: [[x: 0.349, y: 0.213, z: 0.117]]

with rosparam load my_config.yaml then I can do rosparam get boxes and get:

- - {x: 0.349}
  - {y: 0.213}
  - {z: 0.117}

But how can I access only the first list or elements in the second list? I tried boxes[0], boxes(0) and boxes{0} but nothing worked. I'm sure this must be possible it is such a basic functionality.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Hakaishin
close date 2021-08-25 03:07:05.686751

Comments

boxes: [[x: 0.349, y: 0.213, z: 0.117]]

did you intentionally nest two lists here? And then put key-value pairs in the innermost list as elements?

Because now you have a list, inside a list and the inner list contains dictionaries with only a single key:value pair each.

gvdhoorn gravatar image gvdhoorn  ( 2018-10-19 11:26:16 -0500 )edit

Yes that is on purpose

Hakaishin gravatar image Hakaishin  ( 2018-10-22 04:56:06 -0500 )edit