hbp_nrp_cleserver.server.ROSCLEServer module¶
ROS wrapper around the CLE
- 
class ROSCLEServer(sim_id, timeout, timeout_type, gzserver, notificator)[source]¶
- Bases: - hbp_nrp_cleserver.server.SimulationServer.SimulationServer- A ROS server wrapper around the Closed Loop Engine. - 
static change_transfer_function_for_population(change_population_mode, old_population_name, new_population_name, transfer_functions)[source]¶
- Modifies a single population name. Returns a value if needs user input. - Parameters
- change_population_mode – The change population mode (as defined in SetPopulationsRequest) 
- old_population_name – The old name of the population 
- new_population_name – The new name of the population 
- transfer_functions – The transfer functions to which the population change should be applied to. 
 
 
 - 
change_transfer_functions(change_population, old_changed, new_added, transfer_functions)[source]¶
- Modifies population names. Returns a value if needs user input. - Parameters
- change_population – The change population mode (as defined in SetPopulationsRequest) 
- old_changed – A list of old population names 
- new_added – A list of new population names 
- transfer_functions – The transfer functions to which the changes should be applied 
 
 
 - 
property cle¶
- Gets the Closed Loop Engine referenced by this server 
 - 
static get_tf_name(source)[source]¶
- Check whether the function has a single definition name - Parameters
- source – Transfer function source code 
- Returns
- True and Function name if found, False and error message if none or multiple found 
 
 - 
prepare_simulation(except_hook=None)[source]¶
- The CLE will be initialized within this method and ROS services for starting, pausing, stopping and resetting are setup here. - Parameters
- cle – the closed loop engine 
- except_hook – A handler method for critical exceptions 
 
 
 - 
publish_error(source_type, error_type, message, severity=1, function_name='', line_number=- 1, offset=- 1, line_text='', file_name='', do_log=True)[source]¶
- Publishes an error and takes appropriate action if necessary - Parameters
- source_type – The module the error message comes from, e.g. “Transfer Function” 
- error_type – The error type, e.g. “Compile” 
- message – The error message description, e.g. unexpected indent 
- severity – The severity of the error 
- function_name – The function name, if available 
- line_number – The line number where the error occurred 
- offset – The offset 
- line_text – The text of the line causing the error 
- file_name – 
- do_log – log the error on the default logger, do not log otherwise 
 
 
 - 
reset_simulation(request)[source]¶
- Handler for the CLE reset() call. - Parameters
- request – the ROS service request message (cle_ros_msgs.srv.ResetSimulation). 
 
 - 
setup_handlers(assembly)[source]¶
- Sets up different call handlers for the current assembly. - Parameters
- assembly – CLE assembly of the current simulation 
- Returns
 
 - 
property simulation_time¶
- Gets the simulation time 
 
- 
static