Kazadhum / file_intro_plugin

0 stars 0 forks source link

Result File #2

Open Kazadhum opened 1 year ago

Kazadhum commented 1 year ago

Hi @rarrais and @MisterOwlPT! I was wondering something that might come up as an issue later. So this plugin would use as input the result file from a calibration using ATOM in our containers. My question is, how do we get the csv file from inside the containers to use in this introspection plugin? Does Rigel include a tool to extract such a file?

Thanks in advance!

MisterOwlPT commented 1 year ago

Hi @Kazadhum!

I just made some changes to Rigel to help you copy files from containers in a more standardized way.

Components in the rigel.plugins.core.TestPlugin now support a new optional field artifacts consisting of a list of absolute file paths inside the container (of type str). Use it to declare all the files you want to copy.

Consider the following example Rigelfile excerpt as a usage guide:

# ...
test:
  plugin: rigel.plugins.core.TestPlugin
  with:
    components:
      -
        name: robot
        artifacts:
          - /home/rigeluser/ros_workspace/log/latest/events.log
        # ...
# ...

Please keep in mind that files are only copied at the end of simulations (or whenever they are canceled)!

NOTE: invalid paths are ignored by Rigel.

NOTE: copied files always preserve their original names.

All copied files are placed in the following folder: ~/.rigel/archives/test/ (Rigel automatically creates it for you).

Inside the said folder Rigel will automatically create:

Look at the following directory tree. Based on the previous information I think you can understand its internal structure:

NOTE: the presented folder structure may change as Rigel is being developed, so you may have to change a thing or two in your plugin in the future. But don't worry I'll look to minimize inconveniences to your work as much as possible.

. (/home/pedro/.rigel/archives)
└── test
    ├── 16-03-2023-15-55-20
    │   └── robot
    │       └── events.log
    ├── 16-03-2023-15-56-19
    │   └── robot
    │       └── events.log
    └── latest -> /home/pedro/.rigel/archives/test/16-03-2023-15-56-19

Thus, to access the most updated copy of your target .csv file inside your plugin use the following path: ~/.rigel/archives/test/latest/<PLUGIN_COMPONENT_NAME>/<FILE_NAME>.csv.

If you need an older version replace latest with the simulation time as required.

DEVELOPMENT SUGGESTION: when developing your plugin, try to make things as "less verbose" as possible. If your .csv file has a constant name (or follows a naming pattern of some sort) make sure your plugin can fetch it automatically within the .rigel folder. No need for a mandatory extra line on the Rigelfile. Still, allow the users to pass a field path (for instance) if they so required.

I hope you find this message useful. Let me know if you have any doubts or questions. Good work! 😃

PS: don't forget to pull the changes I've made to Rigel.

Kazadhum commented 1 year ago

Thanks for the help @MisterOwlPT ! I've git pull-ed your changes and everything smoothly! I'll try implementing this as soon as I can get ATOM to run both the calibration and evaluation inside the container.