functionality for random and regular complete

cartpole experiments
This commit is contained in:
Niko Feith 2023-06-12 17:19:35 +02:00
parent b902e07424
commit 62f0e15881
2 changed files with 5 additions and 4 deletions

View File

@ -222,7 +222,7 @@ class ActiveRLService(Node):
self.active_rl_pub.publish(rl_response) self.active_rl_pub.publish(rl_response)
self.end_time = time.time() self.end_time = time.time()
self.get_logger().info(f'RL Time: {self.end_time-self.begin_time}, mode: {self.interactive_run}') # self.get_logger().info(f'RL Time: {self.end_time-self.begin_time}, mode: {self.interactive_run}')
self.begin_time = None self.begin_time = None
self.end_time = None self.end_time = None
@ -263,7 +263,7 @@ class ActiveRLService(Node):
self.rl_pending = False self.rl_pending = False
self.end_time = time.time() self.end_time = time.time()
self.get_logger().info(f'RL Time: {self.end_time - self.begin_time}, mode: {self.interactive_run}') # self.get_logger().info(f'RL Time: {self.end_time - self.begin_time}, mode: {self.interactive_run}')
self.begin_time = None self.begin_time = None
self.end_time = None self.end_time = None
@ -278,7 +278,7 @@ class ActiveRLService(Node):
self.active_rl_pub.publish(rl_response) self.active_rl_pub.publish(rl_response)
self.end_time = time.time() self.end_time = time.time()
self.get_logger().info(f'RL Time: {self.end_time - self.begin_time}, mode: {self.interactive_run}') # self.get_logger().info(f'RL Time: {self.end_time - self.begin_time}, mode: {self.interactive_run}')
self.begin_time = None self.begin_time = None
self.end_time = None self.end_time = None

View File

@ -123,6 +123,7 @@ class ActiveBOTopic(Node):
self.seed_array = None self.seed_array = None
self.env = None self.env = None
self.active_bo_pending = False self.active_bo_pending = False
self.BO = None
def active_bo_callback(self, msg): def active_bo_callback(self, msg):
if not self.active_bo_pending: if not self.active_bo_pending:
@ -408,7 +409,7 @@ class ActiveBOTopic(Node):
state_msg = ActiveBOState() state_msg = ActiveBOState()
state_msg.current_run = self.current_run + 1 if self.current_run < self.bo_runs else self.bo_runs state_msg.current_run = self.current_run + 1 if self.current_run < self.bo_runs else self.bo_runs
state_msg.current_episode = self.current_episode + 1 \ state_msg.current_episode = self.current_episode \
if self.current_episode < self.bo_episodes else self.bo_episodes if self.current_episode < self.bo_episodes else self.bo_episodes
state_msg.best_reward = float(self.best_reward) state_msg.best_reward = float(self.best_reward)
state_msg.last_user_reward = self.last_user_reward state_msg.last_user_reward = self.last_user_reward