Simulation Module

class SimulationStepOptimization

class rostok.virtual_experiment.simulation_step.SimulationStepOptimization(control_trajectory, graph_mechanism: GraphGrammar, grasp_object: BlockWrapper)

Wrapper class of simulation robot with control on pychrono physical engine.

Before starting the simulation with the SimulationStepOptimization.simulate_system() method, recommended set stopping flag

of simulation with SimulationStepOptimization.set_flags_stop_simulation().

Otherwise, the simulation time has no limits and lasts until the end of the program or until the visualization window is closed, if it is set. There are flags in module flags_simualtions

Parameters:
  • control_trajectory – Array arries of control trajectory for each joints. Control trajectory of one joint have to have format [[time, value], …]. Array must be same shape as array of joints.

  • graph_mechanism (GraphGrammar) – Graph of the robot to be simulated

  • grasp_object (BlockWrapper) – Wrapper of ChronoBodyEnv. This is the object that the robot grabs.

bind_trajectory(control_trajectory)

Create the controller joint from the control trajectory

Parameters:

control_trajectory (list) – Array arries of control trajectory for each joints. Control trajectory of one joint have to have format [[time, value], …]. Array must be same shape as array of joints.

Raises:

IndexError – Exception in the case of a mismatch between the control and the joints

change_config_system(dict_config: dict)

The method is for changing parameters of pychrono simulation system.

Parameters:

dict_config (dict) – The dictionary which contains the configuration parameters simulation system. The format is {“<name_of_method>”: <method_arguments>}. For example, {“Set_G_acc”:chrono.ChVectorD(0,0,0)}

Raises:

AttributeError – Exception in case the system does not have a specified method

set_flags_stop_simulation(flags_stop_simulation: list[rostok.criterion.flags_simualtions.FlagStopSimualtions])

Setter flags of stop simulation

Parameters:

flags_stop_simulation (list[FlagStopSimualtions]) – List of desired checking flags. You can see flags in module flags_simualtions. Or create yours, that subclasses FlagStopSimualtions

simulate_system(time_step, visualize=False) dict[int, rostok.virtual_experiment.simulation_step.SimulationDataBlock]

Start the simulation and return data from it

Parameters:
  • time_step (float) – Width of time step the simulation

  • visualize (bool, optional) – Flag to enable visualization. Defaults to False.

Returns:

Dictionary of simulation data of each block. The keys are block id, and the values dataclasses with data.

Return type:

SimOut(dict[int, SimulationDataBlock])