hbp_nrp_cleserver.server.ROSCLESimulationFactory module

Advertise a ROS service to start new simulations.

class ROSCLESimulationFactory[source]

Bases: object

The purpose of this class is to start simulation thread and to provide a ROS service for that. Only one simulation can run at a time.

create_new_simulation(service_request)[source]

Handler for the ROS service. Spawn a new simulation. Warning: Multiprocesses can not be used: https://code.ros.org/trac/ros/ticket/972

Param

service_request: ROS service message (defined in hbp ROS packages)

except_hook(e)[source]

Gets called when the simulation server has to shut down due to an exception

Parameters

e – The exception that caused the simulation server to give up

static get_version(service_request)[source]

Handler for the ROS service. Retrieve the CLE version. Warning: Multiprocesses can not be used: https://code.ros.org/trac/ros/ticket/972

Param

service_request: ROS service message (defined in hbp ROS packages)

initialize()[source]

Initializes the Simulation factory

is_simulation_running(request)[source]

Handler for the ROS service to retrieve information whether there is a simulation running

Parameters

request – The ROS Service message

Returns

True, if a simulation is running, otherwise False

static run()[source]

Start the factory and wait indefinitely. (see rospy.spin documentation)

main()[source]

Main function of ROSCLESimulationFactory

print_full_stack_trace(sig, frame)[source]

Log the stack trace of all the threads

Parameters
  • sig – The received signal

  • frame – The current stack frame

set_up_logger(logfile_name, verbose=False)[source]

Configure the root logger of the CLE application

Param

logfile_name: name of the file created to collect logs

Param

verbose: increase logging verbosity