-
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
1f38af0
commit 21d3d4a
Showing
7 changed files
with
339 additions
and
147 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,27 @@ | ||
import hyperparameters as hp | ||
from rostok.graph_generators.environments.design_environment import (SubStringDesignEnvironment) | ||
from rostok.graph_generators.mcts_manager import MCTSManager | ||
from rostok.graph_generators.search_algorithms.mcts import MCTS | ||
|
||
from rostok.library.rule_sets.rulset_simple_fingers import create_rules | ||
from rostok.graph_grammar.node import GraphGrammar | ||
import hyperparameters as hp | ||
from tendon_graph_evaluators import evaluator_tendon_standart, evaluator_tendon_standart_parallel | ||
import tendon_driven_cfg | ||
|
||
if __name__ == "__main__": | ||
rule_vocabulary = create_rules() | ||
|
||
init_graph = GraphGrammar() | ||
env = SubStringDesignEnvironment(rule_vocabulary, evaluator_tendon_standart_parallel, | ||
hp.MAX_NUMBER_RULES, init_graph, 0) | ||
|
||
mcts = MCTS(env, hp.MCTS_C) | ||
name_directory = input("enter directory name: ") | ||
mcts_manager = MCTSManager(mcts, name_directory, verbosity=2, use_date=True) | ||
#mcts_manager.save_information_about_search( | ||
# hp, tendon_driven_cfg.default_grasp_objective.object_list) | ||
|
||
for i in range(hp.FULL_LOOP_MCTS): | ||
mcts_manager.run_search(hp.BASE_ITERATION_LIMIT_TENDON, 1, 1, 2) | ||
mcts_manager.save_results() |
This file was deleted.
Oops, something went wrong.
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,32 +1,33 @@ | ||
MAX_NUMBER_RULES = 13 | ||
MAX_NUMBER_RULES = 13 | ||
|
||
BASE_ITERATION_LIMIT_TENDON = 10 | ||
FULL_LOOP_MCTS = 10 | ||
MCTS_C = 5 | ||
|
||
BASE_ITERATION_LIMIT = 30 | ||
BASE_ITERATION_LIMIT_GRAPH = 200 | ||
BASE_ITERATION_LIMIT_TENDON = 100 | ||
|
||
ITERATION_REDUCTION_TIME = 0.7 | ||
|
||
TIME_CRITERION_WEIGHT = 3 | ||
FORCE_CRITERION_WEIGHT = 1 | ||
FORCE_CRITERION_WEIGHT = 0.5 | ||
OBJECT_COG_CRITERION_WEIGHT = 1 | ||
INSTANT_FORCE_CRITERION_WEIGHT = 1 | ||
INSTANT_CONTACTING_LINK_CRITERION_WEIGHT = 1 | ||
INSTANT_CONTACTING_LINK_CRITERION_WEIGHT = 2 | ||
GRASP_TIME_CRITERION_WEIGHT = 1 | ||
FINAL_POSITION_CRITERION_WEIGHT = 5 | ||
REFERENCE_DISTANCE = 0.3 | ||
REFERENCE_DISTANCE = 0.1 | ||
|
||
CONTROL_OPTIMIZATION_BOUNDS = (3, 15) | ||
CONTROL_OPTIMIZATION_BOUNDS = (5, 15) | ||
CONTROL_OPTIMIZATION_BOUNDS_TENDON = (10, 20) | ||
CONTROL_OPTIMIZATION_ITERATION = 8 | ||
CONTROL_OPTIMIZATION_ITERATION_TENDON = 20 | ||
TENDON_CONST = -5 | ||
TENDON_DISCRETE_FORCES = [10, 15, 20] | ||
TENDON_DISCRETE_FORCES = [10, 15, 20] | ||
|
||
TIME_STEP_SIMULATION = 0.00001 | ||
GRASP_TIME = 5 | ||
FORCE_TEST_TIME = 5 | ||
TIME_SIMULATION = 10 | ||
TIME_STEP_SIMULATION = 0.0005 | ||
GRASP_TIME = 1.5 | ||
FORCE_TEST_TIME = 3 | ||
TIME_SIMULATION = 4.5 | ||
|
||
FLAG_TIME_NO_CONTACT = 2.5 | ||
FLAG_TIME_SLIPOUT = 1 | ||
FLAG_TIME_NO_CONTACT = 0.5 | ||
FLAG_TIME_SLIPOUT = 0.4 | ||
FLAG_FLYING_APART = 10 |
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,59 @@ | ||
from rostok.control_chrono.tendon_controller import TendonControllerParameters | ||
from rostok.library.obj_grasp.objects import get_object_parametrized_cuboctahedron, get_object_parametrized_dipyramid_3 | ||
from rostok.pipeline.generate_grasper_cfgs import MCTSCfg, SimulationConfig, GraspObjective, BruteForceRewardCfg | ||
from rostok.simulation_chrono.simulation_scenario import GraspScenario | ||
import rostok.control_chrono.external_force as f_ext | ||
from rostok.trajectory_optimizer.control_optimizer import TendonForceOptiVar | ||
from rostok.utils.numeric_utils import Offset | ||
|
||
|
||
HARD_OBJECT_SET = [ | ||
get_object_parametrized_cuboctahedron(0.05, mass=0.100), | ||
get_object_parametrized_dipyramid_3(0.05, mass=0.200) | ||
] | ||
HARD_OBJECT_SET_W = [1.0, 1.0] | ||
|
||
|
||
def get_random_force_with_null_grav(amp): | ||
obj_forces = [] | ||
obj_forces.append(f_ext.NullGravity(0)) | ||
obj_forces.append(f_ext.RandomForces(amp, 100, 0)) | ||
obj_forces = f_ext.ExternalForces(obj_forces) | ||
return obj_forces | ||
|
||
|
||
def get_default_tendon_params(): | ||
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)] | ||
return data | ||
|
||
|
||
rand_null_force = get_random_force_with_null_grav(10) | ||
default_simulation_config = SimulationConfig(0.0005, 4.5, GraspScenario, rand_null_force) | ||
default_grasp_objective = GraspObjective( | ||
# Objects setup | ||
HARD_OBJECT_SET, | ||
HARD_OBJECT_SET_W, | ||
# Event setup | ||
event_time_no_contact_param=0.5, | ||
event_flying_apart_time_param=10, | ||
event_slipout_time_param=0.4, | ||
event_grasp_time_param=1.5, | ||
event_force_test_time_param=3, | ||
# Weight setup | ||
time_criterion_weight=3, | ||
final_pos_criterion_weight=5, | ||
# Object pos setup | ||
refernece_distance=0.3) | ||
|
||
brute_force_opti_default_cfg = BruteForceRewardCfg([10, 15, 20]) | ||
|
||
hyperparams_mcts_default = MCTSCfg() |
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,33 @@ | ||
from copy import deepcopy | ||
from rostok.trajectory_optimizer.control_optimizer import TendonForceOptiVar | ||
import tendon_driven_cfg | ||
import rostok.pipeline.generate_grasper_cfgs as pipeline | ||
|
||
tendon_optivar_standart = TendonForceOptiVar(tendon_driven_cfg.get_default_tendon_params(), | ||
params_start_pos=-45) | ||
|
||
evaluator_tendon_standart = pipeline.create_reward_calulator( | ||
tendon_driven_cfg.default_simulation_config, tendon_driven_cfg.default_grasp_objective, | ||
tendon_optivar_standart, tendon_driven_cfg.brute_force_opti_default_cfg) | ||
|
||
brute_force_opti_default_cfg_parallel = deepcopy(tendon_driven_cfg.brute_force_opti_default_cfg) | ||
brute_force_opti_default_cfg_parallel.num_cpu_workers = 6 | ||
|
||
evaluator_tendon_standart_parallel = pipeline.create_reward_calulator( | ||
tendon_driven_cfg.default_simulation_config, tendon_driven_cfg.default_grasp_objective, | ||
tendon_optivar_standart, brute_force_opti_default_cfg_parallel) | ||
|
||
|
||
|
||
tendon_optivar_strong = TendonForceOptiVar(tendon_driven_cfg.get_default_tendon_params(), | ||
params_start_pos=-60) | ||
brute_force_opti_strong = deepcopy(tendon_driven_cfg.brute_force_opti_default_cfg) | ||
brute_force_opti_strong.variants = [30, 40, 50] | ||
|
||
simulation_config_strong = deepcopy(tendon_driven_cfg.default_simulation_config) | ||
simulation_config_strong.obj_disturbance_forces = tendon_driven_cfg.get_random_force_with_null_grav( | ||
150) | ||
|
||
evaluator_tendon_strong = pipeline.create_reward_calulator( | ||
simulation_config_strong, tendon_driven_cfg.default_grasp_objective, tendon_optivar_strong, | ||
brute_force_opti_strong) |
Oops, something went wrong.