diff --git a/rl_studio/envs/gazebo/f1/models/f1_env_camera.py b/rl_studio/envs/gazebo/f1/models/f1_env_camera.py index bd9bf364a..e2d66b4df 100644 --- a/rl_studio/envs/gazebo/f1/models/f1_env_camera.py +++ b/rl_studio/envs/gazebo/f1/models/f1_env_camera.py @@ -114,8 +114,6 @@ def calculate_observation(self, state: list) -> list: def step(self, action) -> Tuple: - self._gazebo_unpause() - vel_cmd = Twist() vel_cmd.linear.x = self.actions[action][0] vel_cmd.angular.z = self.actions[action][1] @@ -139,7 +137,6 @@ def step(self, action) -> Tuple: end = time.time() #print(end - start) - self._gazebo_pause() points = self.processed_image(f1_image_camera.data) state = self.calculate_observation(points) center = float(self.config.center_image - points[0]) / ( @@ -170,7 +167,6 @@ def reset(self): else: self._gazebo_reset() - self._gazebo_unpause() # Get camera info image_data = None @@ -189,12 +185,9 @@ def reset(self): state = self.calculate_observation(points) # reset_state = (state, False) - self._gazebo_pause() - return state def inference(self, action): - self._gazebo_unpause() vel_cmd = Twist() vel_cmd.linear.x = self.config.ACTIONS_SET[action][0] @@ -207,7 +200,6 @@ def inference(self, action): cv_image = CvBridge().imgmsg_to_cv2(image_data, "bgr8") f1_image_camera = self.image_msg_to_image(image_data, cv_image) - self._gazebo_pause() points = self.processed_image(f1_image_camera.data) state = self.calculate_observation(points) diff --git a/rl_studio/envs/gazebo/f1/models/reset.py b/rl_studio/envs/gazebo/f1/models/reset.py index 3ef041549..d285c8d6b 100644 --- a/rl_studio/envs/gazebo/f1/models/reset.py +++ b/rl_studio/envs/gazebo/f1/models/reset.py @@ -54,11 +54,9 @@ def reset_f1_state_sp(self): else: self._gazebo_set_fix_pose_f1_follow_right_lane() - self._gazebo_unpause() ##==== get image from sensor camera f1_image_camera, _ = self.f1gazeboimages.get_camera_info() - self._gazebo_pause() ##==== calculating State # simplified perception as observation diff --git a/rl_studio/envs/gazebo/f1/models/simplified_perception.py b/rl_studio/envs/gazebo/f1/models/simplified_perception.py index 7bc281b9d..975a0f466 100644 --- a/rl_studio/envs/gazebo/f1/models/simplified_perception.py +++ b/rl_studio/envs/gazebo/f1/models/simplified_perception.py @@ -13,7 +13,7 @@ def processed_image(self, img, height, width, x_row, center_image): :parameters: input image 640x480 :return: centrals: lists with distance to center in pixels - cntrals_normalized: lists with distance in range [0,1] for calculating rewards + centrals_normalized: lists with distance in range [0,1] for calculating rewards """ image_middle_line = height // 2 img_sliced = img[image_middle_line:] diff --git a/rl_studio/envs/gazebo/f1/models/step.py b/rl_studio/envs/gazebo/f1/models/step.py index f45b20162..06b3be4bb 100644 --- a/rl_studio/envs/gazebo/f1/models/step.py +++ b/rl_studio/envs/gazebo/f1/models/step.py @@ -1,5 +1,6 @@ from geometry_msgs.msg import Twist import numpy as np +import time from rl_studio.agents.utils import ( print_messages, @@ -51,7 +52,6 @@ def step_followline_state_image_actions_discretes(self, action, step): return state, reward, done, {} def step_followline_state_sp_actions_discretes(self, action, step): - self._gazebo_unpause() vel_cmd = Twist() vel_cmd.linear.x = self.actions[action][0] vel_cmd.angular.z = self.actions[action][1] @@ -59,12 +59,12 @@ def step_followline_state_sp_actions_discretes(self, action, step): ##==== get image from sensor camera f1_image_camera, _ = self.f1gazeboimages.get_camera_info() - self._gazebo_pause() ##==== get center points_in_red_line, _ = self.simplifiedperception.processed_image( f1_image_camera.data, self.height, self.width, self.x_row, self.center_image ) + if self.state_space == "spn": self.point = points_in_red_line[self.poi] else: @@ -176,7 +176,6 @@ def __init__(self, **config): self.name = config["states"] def step_followlane_state_sp_actions_discretes(self, action, step): - self._gazebo_unpause() vel_cmd = Twist() vel_cmd.linear.x = self.actions[action][0] vel_cmd.angular.z = self.actions[action][1] @@ -184,7 +183,6 @@ def step_followlane_state_sp_actions_discretes(self, action, step): ##==== get image from sensor camera f1_image_camera, _ = self.f1gazeboimages.get_camera_info() - self._gazebo_pause() ##==== get center centrals_in_lane, centrals_in_lane_normalized = self.simplifiedperception.processed_image(