Open yannbouteiller opened 3 years ago
Oh well and it is not related but if you modify the API's code can you also modify simStartRace() to allow for controlling both drones instead of competing against the baseline @madratman please?
Personally I replace it with this:
def simStartRace(self, tier=1, competitor=True):
""" Starts an instance of a race in your given level, if valid."""
self.race_tier = tier
if tier == 2 or not competitor:
self.client.call("simStartRace", tier)
return
else:
client_instance = self.__class__()
competitor = BaselineRacer(
client_instance,
viz_traj=False,
viz_traj_color_rgba=[1.0, 1.0, 0.0, 1.0],
)
competitor.level_name = self.level_name
competitor.initialize_drone()
competitor.gate_poses_ground_truth = [
self.__internalRandomGoalZone(gate)
for gate in sorted(self.simListSceneObjects(".*[Gg]ate.*"))
]
if self.level_name == "Soccer_Field_Medium":
curr_pose = deepcopy(competitor.gate_poses_ground_truth[19])
curr_pose.position.x_val = (
competitor.gate_poses_ground_truth[19].position.x_val
+ competitor.gate_poses_ground_truth[20].position.x_val
) / 2
competitor.gate_poses_ground_truth.insert(20, curr_pose)
if self.level_name == "Building99_Hard":
competitor.gate_poses_ground_truth.insert(
3,
Pose(
Vector3r(
(-21.49 - 41.89) / 2.0,
(-5.44 - 1.84) / 2,
(1.51 + 1.82) / 2,
)
),
)
if self.level_name == "ZhangJiaJie_Medium":
num_gates = len(competitor.gate_poses_ground_truth)
last_gate_position = deepcopy(
competitor.gate_poses_ground_truth[-1].position
)
second_last_gate_position = deepcopy(
competitor.gate_poses_ground_truth[-2].position
)
competitor.gate_poses_ground_truth.insert(
num_gates - 1,
Pose(
Vector3r(
(last_gate_position.x_val + second_last_gate_position.x_val)
/ 2.0,
(last_gate_position.y_val + second_last_gate_position.y_val)
/ 2.0,
(last_gate_position.z_val + second_last_gate_position.z_val)
/ 2.0,
)
),
)
self.client.call("simStartRace", tier)
competitor.run_in_thread()
Hello,
I am upgrading the Gym environment that I made during the 2019 competition to ADRL, and I found this bug.
When calling simGetObjectPause() before simStartRace(), there is an error because race_tier is not in initialized: