Method: Roby::Application#setup

Defined in:
lib/roby/app.rb

#setupObject

Does basic setup of the Roby environment. It loads configuration files and sets up singleton objects.

After a call to #setup, the Roby services that do not require an execution loop to run should be available

Plugins that define a setup(app) method will see their method called at this point

The #cleanup method is the reverse of #setup



1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
# File 'lib/roby/app.rb', line 1118

def setup
    apply_argv_set

    base_setup
    # Set up the loaded plugins
    call_plugins(:setup, self)
    # And run the setup handlers
    setup_handlers.each(&:call)
    # Re-apply configuration parameters from the command line
    apply_argv_set

    require_models

    # Main is always included in the planner list
    self.planners << app_module::Actions::Main

    # Attach the global fault tables to the plan
    self.planners.each do |planner|
        if planner.respond_to?(:each_fault_response_table)
            planner.each_fault_response_table do |table, arguments|
                plan.use_fault_response_table table, arguments
            end
        end
    end
rescue Exception # rubocop:disable Lint/RescueException
    begin cleanup
    rescue Exception => e # rubocop:disable Lint/RescueException
        Roby.warn "failed to cleanup after #setup raised"
        Roby.log_exception_with_backtrace(e, Roby, :warn)
    end
    raise
end