Skip to content

Commit

Permalink
Comments in edit_this regarding use_firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
JacopoPan committed Sep 19, 2022
1 parent ca6a70d commit fc6a907
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions competition/edit_this.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Tips:
Search for strings `INSTRUCTIONS:` and `REPLACE THIS (START)` in this file.
Change the code between the 5 blocks starting with
Change the code between the 4 blocks starting with
#########################
# REPLACE THIS (START) ##
#########################
Expand All @@ -20,9 +20,8 @@
They are in methods:
1) __init__
2) cmdFirmware
3) cmdSimOnly (optional)
4) interStepLearn (optional)
5) interEpisodeLearn (optional)
3) interStepLearn (optional)
4) interEpisodeLearn (optional)
"""
import numpy as np
Expand Down Expand Up @@ -81,7 +80,8 @@ def __init__(self,
if use_firmware:
self.ctrl = None
else:
# Initialized simple PID Controller.
# Initialize a simple PID Controller ror debugging and test
# Do NOT use for the IROS 2022 competition.
self.ctrl = PIDController()
# Save additonal environment parameters.
self.KF = initial_info["quadrotor_kf"]
Expand Down Expand Up @@ -151,7 +151,7 @@ def cmdFirmware(self,
"""Pick command sent to the quadrotor through a Crazyswarm/Crazyradio-like interface.
INSTRUCTIONS:
Re-implement this function to return the target position, velocity, acceleration, attitude, and attitude rates to be sent
Re-implement this method to return the target position, velocity, acceleration, attitude, and attitude rates to be sent
from Crazyswarm to the Crazyflie using, e.g., a `cmdFullState` call.
Args:
Expand Down Expand Up @@ -251,7 +251,8 @@ def cmdSimOnly(self,
"""PID per-propeller thrusts with a simplified, software-only PID quadrotor controller.
INSTRUCTIONS:
Re-implement this function to return the target position and velocity.
You do NOT need to re-implement this method for the IROS 2022 Safe Robot Learning competition.
Only re-implement this method when `use_firmware` == False to return the target position and velocity.
Args:
time (float): Episode's elapsed time, in seconds.
Expand All @@ -272,17 +273,11 @@ def cmdSimOnly(self,
iteration = int(time*self.CTRL_FREQ)

#########################
# REPLACE THIS (START) ##
#########################

if iteration < len(self.ref_x):
target_p = np.array([self.ref_x[iteration], self.ref_y[iteration], self.ref_z[iteration]])
else:
target_p = np.array([self.ref_x[-1], self.ref_y[-1], self.ref_z[-1]])
target_v = np.zeros(3)

#########################
# REPLACE THIS (END) ####
#########################

return target_p, target_v
Expand Down

0 comments on commit fc6a907

Please sign in to comment.