Skip to content

Commit

Permalink
fix return
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailChaikovskii committed Nov 1, 2023
1 parent e283233 commit 64c4bb4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/hyperparameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
TENDON_CONST = -5
TENDON_DISCRETE_FORCES = [10, 15, 20]

TIME_STEP_SIMULATION = 0.00001
TIME_STEP_SIMULATION = 0.0001
GRASP_TIME = 5
FORCE_TEST_TIME = 5
TIME_SIMULATION = 10
Expand Down
14 changes: 7 additions & 7 deletions rostok/criterion/simulation_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ def __init__(self, take_from_body: bool = False) -> None:
def build_event(self, event_list) -> EventContact:
event = self.find_event(event_list=event_list)
if event is None:
return EventContact(take_from_body=self.from_body)
return event_list.append(EventContact(take_from_body=self.from_body))
else:
raise Exception(
'Attempt to create two same events for a simulation')
'Attempt to create two same events for a simulation: EventContact')


class EventContactTimeOut(SimulationSingleEvent):
Expand Down Expand Up @@ -192,7 +192,7 @@ def build_event(self, event_list) -> EventContactTimeOut:
if contact_event is None:
raise Exception(
'Event requires another event prebuilt: EventContactTimeOut <- EventContact')
return EventContactTimeOut(ref_time=self.reference_time, contact_event=contact_event)
return event_list.append(EventContactTimeOut(ref_time=self.reference_time, contact_event=contact_event))


class EventFlyingApart(SimulationSingleEvent):
Expand Down Expand Up @@ -245,7 +245,7 @@ def __init__(self, max_distance) -> None:
def build_event(self, event_list) -> EventFlyingApart:
event = self.find_event(event_list=event_list)
if event is None:
return EventFlyingApart(max_distance=self.max_distance)
return event_list.append(EventFlyingApart(max_distance=self.max_distance))
else:
raise Exception(
'Attempt to create two same events for a simulation: EventFlyingApart')
Expand Down Expand Up @@ -317,7 +317,7 @@ def __init__(self, ref_time):
def build_event(self, event_list) -> EventSlipOut:
event = self.find_event(event_list=event_list)
if event is None:
return EventSlipOut(ref_time=self.reference_time)
return event_list.append(EventSlipOut(ref_time=self.reference_time))
else:
raise Exception(
'Attempt to create two same events for a simulation: EventSlipOut')
Expand Down Expand Up @@ -438,7 +438,7 @@ def build_event(self, event_list) -> EventGrasp:
if contact_event is None:
raise Exception(
'Event requires another event prebuilt: EventGrasp <- EventContact')
return EventGrasp(verbosity=self.verbosity, grasp_limit_time=self.grasp_limit_time, simulation_stop=self.simulation_stop, contact_event=contact_event)
return event_list.append(EventGrasp(verbosity=self.verbosity, grasp_limit_time=self.grasp_limit_time, simulation_stop=self.simulation_stop, contact_event=contact_event))


class EventStopExternalForce(SimulationSingleEvent):
Expand Down Expand Up @@ -481,4 +481,4 @@ def build_event(self, event_list) -> EventStopExternalForce:
if grasp_event is None:
raise Exception(
'Event requires another event prebuilt: EventStopExternalForce <- EventGrasp')
return EventStopExternalForce(force_test_time=self.force_test_time, grasp_event=grasp_event)
return event_list.append(EventStopExternalForce(force_test_time=self.force_test_time, grasp_event=grasp_event))
1 change: 1 addition & 0 deletions rostok/simulation_chrono/simulation_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def build_events(self):
event_list=[]
for event_builder in self.event_builder_container:
event_builder.build_event(event_list)
return event_list

def run_simulation(self,
graph: GraphGrammar,
Expand Down

0 comments on commit 64c4bb4

Please sign in to comment.