Skip to content

Commit 438c18a

Browse files
committed
DEBUGGING: Implementing MPC computation analysis: saving the computation data (max/avg times, num of iterations) into a csv file.
1 parent 3db0cab commit 438c18a

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

igibson/envs/igibson_env_jackalJaco.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,12 +1752,16 @@ def take_action(self, action):
17521752
action = 104 # Whole-body goal
17531753
elif self.config_mobiman.action_type == 1 and self.drl_mode == "testing" and self.config_mobiman.testing_benchmark_name == "ocs2wb":
17541754
if self.config_mobiman.testing_mode == 4:
1755+
# print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::take_action] Model mode: Base")
17551756
action[0] = 0.0 # Model mode: Base
17561757
elif self.config_mobiman.testing_mode == 5:
1758+
# print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::take_action] Model mode: Arm")
17571759
action[0] = 0.5 # Model mode: Arm
17581760
else:
1761+
# print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::take_action] Model mode: Whole-body")
17591762
action[0] = 1.0 # Model mode: Whole-body
17601763
action[1] = 1.0 # Target mode: Goal
1764+
# print(f"[{self.ns}][igibson_env_jackalJaco::iGibsonEnv::take_action] action[1]: {action[1]}")
17611765

17621766
self.step_action = action
17631767
self.current_step += 1
@@ -2750,15 +2754,15 @@ def initialize_testing_domain(self):
27502754
testing_range_agent1_pos_y_max = 0.0
27512755
testing_range_agent1_n_points_y = 2
27522756

2753-
elif self.config_mobiman.testing_mode == 4 and self.config_mobiman.testing_mode == 5:
2757+
elif self.config_mobiman.testing_mode == 4 or self.config_mobiman.testing_mode == 5:
27542758

27552759
## Parameters for robot pose
27562760
testing_range_robot_pos_x_min = 0.0
27572761
testing_range_robot_pos_x_max = 0.0
27582762
testing_range_robot_n_points_x = 1
27592763

2760-
testing_range_robot_pos_y_min = 2.0
2761-
testing_range_robot_pos_y_max = 2.0
2764+
testing_range_robot_pos_y_min = -1.0
2765+
testing_range_robot_pos_y_max = -1.0
27622766
testing_range_robot_n_points_y = 1
27632767

27642768
testing_range_robot_yaw_min = 0.0 # -0.5 * math.pi
@@ -2794,13 +2798,13 @@ def initialize_testing_domain(self):
27942798
testing_range_box_n_points_y = 1
27952799
testing_range_box_n_points_z = 1
27962800

2801+
else:
2802+
print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::initialize_testing_domain] ERROR :Invalid testing_mode: " + str(self.config_mobiman.testing_mode) + str("!"))
2803+
27972804
# print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::initialize_testing_domain] DEBUG_INF")
27982805
# while 1:
27992806
# continue
28002807

2801-
else:
2802-
print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::initialize_testing_domain] ERROR :Invalid testing_mode: " + str(self.config_mobiman.testing_mode) + str("!"))
2803-
28042808
## Initialize robot pose configurations
28052809
robot_pos_x_lin = np.linspace(testing_range_robot_pos_x_min, testing_range_robot_pos_x_max, testing_range_robot_n_points_x)
28062810
robot_pos_y_lin = np.linspace(testing_range_robot_pos_y_min, testing_range_robot_pos_y_max, testing_range_robot_n_points_y)
@@ -2855,8 +2859,16 @@ def initialize_testing_domain(self):
28552859
box_pos_x_mesh.flatten(), box_pos_y_mesh.flatten(), box_pos_z_mesh.flatten(),
28562860
agent0_pos_x_mesh.flatten(), agent0_pos_y_mesh.flatten(),
28572861
agent1_pos_x_mesh.flatten(), agent1_pos_y_mesh.flatten()))
2862+
2863+
elif self.config_mobiman.testing_mode == 4:
2864+
## Format: [robot_pos_x, robot_pos_y, robot_yaw, box_pos_x, box_pos_y, box_pos_z]
2865+
robot_pos_x_mesh, robot_pos_y_mesh, robot_pos_theta, box_pos_x_mesh, box_pos_y_mesh, box_pos_z_mesh = np.meshgrid(robot_pos_x_lin, robot_pos_y_lin, yaw_lin,
2866+
box_pos_x_lin, box_pos_y_lin, box_pos_z_lin)
28582867

2859-
if self.config_mobiman.testing_mode == 6:
2868+
self.testing_samples = np.column_stack((robot_pos_x_mesh.flatten(), robot_pos_y_mesh.flatten(), robot_pos_theta.flatten(),
2869+
box_pos_x_mesh.flatten(), box_pos_y_mesh.flatten(), box_pos_z_mesh.flatten()))
2870+
2871+
elif self.config_mobiman.testing_mode == 6:
28602872
## Format: [robot_pos_x, robot_pos_y, robot_yaw, box_pos_x, box_pos_y, box_pos_z]
28612873
robot_pos_x_mesh, robot_pos_y_mesh, robot_pos_theta, box_pos_x_mesh, box_pos_y_mesh, box_pos_z_mesh = np.meshgrid(robot_pos_x_lin, robot_pos_y_lin, yaw_lin,
28622874
box_pos_x_lin, box_pos_y_lin, box_pos_z_lin)
@@ -4156,7 +4168,7 @@ def save_oar_data(self):
41564168
self.oars_data['testing_state'].append(self.testing_samples[self.testing_idx])
41574169
self.oars_data['testing_eval_index'].append(self.testing_eval_idx)
41584170

4159-
print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::save_oar_data] testing result: " + str(self.termination_reason))
4171+
# print("[" + self.ns + "][igibson_env_jackalJaco::iGibsonEnv::save_oar_data] testing result: " + str(self.termination_reason))
41604172

41614173
if self.episode_done:
41624174
self.oars_data['log_file'].append("")

0 commit comments

Comments
 (0)