Skip to content

Commit

Permalink
Corrected wrong log, equal pos and vel
Browse files Browse the repository at this point in the history
  • Loading branch information
carlo98 committed Dec 17, 2021
1 parent cfce12b commit b43deee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions shared/Log Analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@
" with open(folder_path + \"/\" + file, \"rb\") as file_pkl:\n",
" data = pickle.load(file_pkl)\n",
" if len(data[1]) == 2 and np.abs(data[0]['z'][-1]) < 0.15: # Threshold height, otherwise not landed (vz not trained)\n",
" file_list.append(file)\n",
" elif len(data[1]) == 3 and np.abs(data[0]['z'][-1]) < 0.50: # Threshold height, otherwise not landed (vz trained)\n",
" file_list.append(file)"
]
},
Expand Down Expand Up @@ -266,7 +264,7 @@
"outputs": [],
"source": [
"ax = velocities.plot(title=\"Velocity/Time\", figsize=(10, 4));\n",
"plt.ylim(-1, 1);\n",
"plt.ylim(-2, 2);\n",
"plt.xlim(0, len(velocities)+1);\n",
"plt.grid();\n",
"ax.set_xlabel(\"Time (s)\");\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def run(self):
with torch.no_grad():
action = self.ddpg.get_exploitation_action(normalized_input)

log_velocities['vx'].append(inputs[0]*self.info_dict['max_vel_xy'])
log_velocities['vy'].append(inputs[1]*self.info_dict['max_vel_xy'])
log_velocities['vx'].append(inputs[3]*self.info_dict['max_vel_xy'])
log_velocities['vy'].append(inputs[4]*self.info_dict['max_vel_xy'])
log_velocities_ref['vx'].append(action[0]*self.info_dict['max_vel_xy'])
log_velocities_ref['vy'].append(action[1]*self.info_dict['max_vel_xy'])
if self.act_shape == 3: # Predicting also vz
log_velocities['vz'].append(inputs[2]*self.info_dict['max_vel_z'])
log_velocities['vz'].append(inputs[5]*self.info_dict['max_vel_z'])
log_velocities_ref['vz'].append(action[2]*self.info_dict['max_vel_z'])

inputs, reward, done = self.env.act(action, self.normalize_input)
Expand Down

0 comments on commit b43deee

Please sign in to comment.