Skip to content

Conditional before_commands #48

Open
@nspielbau

Description

@nspielbau

As discussed previously in person there might be a benefit of having conditional before commands, due to reduced session maintenance to keep e.g. a simulation and non-simulation session config up to date.

Let's take a stack where a roscore is running on a different machine in the non-sim case. In addition to not launching our simulation, we might also need to adjust some environment variables such as ROS_IP and ROS_MASTER_URI or ROS_DOMAIN_ID in ROS 2.
As we don't want to adjust them in the simulation case, we would need to either:

  • Write a new session file for non-sim use, rendering the window conditionality useless
  • Write if/unless versions for each window, making the file much more vulnerable for errors in the future when window commands change and are not updated properly.

For this I would suggest adjusting the before_commands as follows:

before_commands:
  - if: parameter
    command: COMMAND

the command: before the actual command could also be dropped for ease of use if a command is not conditional.

For this we would need to change the parsing of the common attributes and rearrange the sequence of parsing in session creation so parameters is parsed before common. Also we should probably adjust the example session file and move common behind parameters to reflect the change in session creation to the user (It would be very confusing if the parameters could be used before they are defined)

Any opinions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions