简体   繁体   中英

Passing Array of dict as parameter to ros launch

I want to pass an array of dict as parameter to launch file and retrieve these arrays at the node. How can I achieve this. Not finding any example or pseudo-code regarding this. Newbie ros user. Regards

For this, you should use rosparams . This will let you pass in data in a YAML format. If loading the params in a python node they will come in as a dict , if c++ they will come in as a std::map .

For example, if you wanted it to behave like:

my_dict = {key1: {iKey1: val1, iKey2: val2}, key2: [1,2,3], key3: something_else}

your launch file would look like this:

<rosparam>
    my_dict:
        key1:
            iKey1: val1
            iKey2: val2
        key2: [1,2,3]
        key3: something_else
</rosparam>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM