From 110c8955867522e6b67411b254eb75eb7a3acc83 Mon Sep 17 00:00:00 2001 From: Mikhail Chaikovskii Date: Wed, 1 Nov 2023 19:54:37 +0300 Subject: [PATCH] simulation with external force --- app/mcts_run_setup.py | 9 ++++++--- app/one_graph_simulation.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/mcts_run_setup.py b/app/mcts_run_setup.py index 8c24870d..fa712b40 100644 --- a/app/mcts_run_setup.py +++ b/app/mcts_run_setup.py @@ -91,8 +91,11 @@ def config_independent_torque(grasp_object_blueprint): def config_tendon(grasp_object_blueprint): - - simulation_manager = GraspScenario(hp.TIME_STEP_SIMULATION, hp.TIME_SIMULATION, TendonController_2p) + obj_forces = [] + obj_forces.append(f_ext.RandomForces(1e6, 100, 20)) + obj_forces.append(f_ext.NullGravity(0)) + obj_forces = f_ext.ExternalForces(obj_forces) + simulation_manager = GraspScenario(hp.TIME_STEP_SIMULATION, hp.TIME_SIMULATION, TendonController_2p, obj_external_forces=obj_forces) simulation_manager.grasp_object_callback = grasp_object_blueprint event_contact_builder = EventContactBuilder() @@ -136,7 +139,7 @@ def config_tendon(grasp_object_blueprint): hp.FINAL_POSITION_CRITERION_WEIGHT) tendon_controller_cfg = get_tendon_cfg() tendon_optivar = TendonForceOptiVar(tendon_controller_cfg, simulation_rewarder, -45) - tendon_optivar.is_vis = False + tendon_optivar.is_vis = True brute_tendon = BruteForceOptimisation1D(hp.TENDON_DISCRETE_FORCES, [simulation_manager], tendon_optivar, num_cpu_workers=1) diff --git a/app/one_graph_simulation.py b/app/one_graph_simulation.py index ff21e0e7..110dfb2a 100644 --- a/app/one_graph_simulation.py +++ b/app/one_graph_simulation.py @@ -5,7 +5,7 @@ get_three_link_one_finger, get_three_link_one_finger_independent, get_two_link_three_finger, ) # create blueprint for object to grasp -grasp_object_blueprint = get_object_sphere(0.05) +grasp_object_blueprint = get_object_sphere(0.05, mass=0.2) # create reward counter using run setup function # control_optimizer = config_with_const_troques(grasp_object_blueprint)