-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
871099d
commit 0e0e8ee
Showing
5 changed files
with
298 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from rostok.block_builder_api.block_blueprints import EnvironmentBodyBlueprint | ||
from rostok.control_chrono.tendon_controller import TendonControllerParameters, TendonController_2p | ||
from rostok.criterion.criterion_calculation import SimulationReward, TimeCriterion | ||
from rostok.library.rule_sets.simple_designs import get_three_link_one_finger, get_two_link_three_finger | ||
from rostok.simulation_chrono.simulation_scenario import GraspScenario | ||
from rostok.trajectory_optimizer.control_optimizer import MockOptiVar, BruteForceOptimisation1D, TendonForceOptiVar | ||
from rostok.library.obj_grasp import objects | ||
from rostok.utils.numeric_utils import Offset | ||
|
||
|
||
if __name__ == '__main__': | ||
data = TendonControllerParameters() | ||
data.amount_pulley_in_body = 2 | ||
data.pulley_parameters_for_body = { | ||
0: [Offset(-0.14, True), Offset(0.005, False, True), | ||
Offset(0, True)], | ||
1: [Offset(-0.14, True), Offset(-0.005, False, True), | ||
Offset(0, True)] | ||
} | ||
data.starting_point_parameters = [Offset(-0.02, False), Offset(0.025, False), Offset(0, True)] | ||
data.tip_parameters = [Offset(-0.3, True), Offset(-0.005, False, True), Offset(0, True)] | ||
|
||
gpesk1 = GraspScenario(0.001, 1, TendonController_2p) | ||
gpesk1.grasp_object_callback = objects.get_object_box(0.1, 0.1, 0.1, 0) | ||
|
||
gpesk2 = GraspScenario(0.001, 1, TendonController_2p) | ||
gpesk2.grasp_object_callback = objects.get_object_box(0.1, 0.1, 0.1, 1) | ||
|
||
|
||
simulation_rewarder = SimulationReward(verbosity=0) | ||
|
||
|
||
|
||
graph = get_three_link_one_finger() | ||
ttt = TendonForceOptiVar(data, simulation_rewarder, -45) | ||
|
||
kukish = BruteForceOptimisation1D([10, 10, 11, 12, 13], [gpesk1, gpesk2], ttt, num_cpu_workers=1) | ||
sosik = kukish.parallel_calculate_reward(graph) | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,45 @@ | ||
from rostok.simulation_chrono.simulation_scenario import GraspScenario | ||
from dataclasses import dataclass, field | ||
from typing import Type | ||
from rostok.block_builder_api.block_blueprints import EnvironmentBodyBlueprint | ||
from rostok.simulation_chrono.simulation_scenario import GraspScenario, ParametrizedSimulation | ||
import rostok.control_chrono.external_force as f_ext | ||
|
||
|
||
def create_simulator(): | ||
pass | ||
#return simulation_manager | ||
simulation_manager = GraspScenario(hp.TIME_STEP_SIMULATION, hp.TIME_SIMULATION, obj_external_forces=obj_forces) | ||
@dataclass | ||
class SimulationConfig: | ||
time_step: float = 0.0001 | ||
time_simulation: float = 10 | ||
scenario_cls: Type[ParametrizedSimulation] = GraspScenario | ||
obj_disturbance_forces: list[f_ext.ABCForceCalculator] = field(default_factory=list) | ||
|
||
def | ||
|
||
# From tis stuff generates sim_manager | ||
|
||
|
||
@dataclass | ||
class GraspObjective: | ||
object_list: list[EnvironmentBodyBlueprint] = field(default_factory=list) | ||
weight_list: list[float] = field(default_factory=list) | ||
event_time_no_contact: float = 2 | ||
event_flying_apart_time: float = 2 | ||
event_slipout_time: float = 1 | ||
event_grasp_time: float = 5 | ||
event_force_test_time: float = 5 | ||
|
||
time_criterion_weight: float = 1 | ||
instant_contact_link_criterion_weight: float = 1 | ||
instant_force_criterion_weight: float = 1 | ||
instant_cog_criterion_weight: float = 1 | ||
grasp_time_criterion_weight: float = 1 | ||
final_pos_criterion_weight: float = 1 | ||
|
||
@dataclass | ||
class ControlOptimizationParams: | ||
optimisation_bound: tuple = field(default_factory=tuple) | ||
optimisation_iter: int = field(default_factory=int) | ||
|
||
@dataclass | ||
class ControlBruteForceParams: | ||
force_list: list[float] = field(default_factory=list) | ||
staring_angle: float = field(default_factory=float) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.