-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi, I am using deepbots to construct an environment for my path planning project. I have successfully executed the CartPole game as the tutorial. When I want to construct an action space of my own, however, I always failed. Just as the same sight of CartPole, I set my action in to discrete 3 instead of 2 meaning my robots got three actions totally:
# six elements include x-axis position, y-axis position, ps0 value, ps1 value, ps6 value, ps7 value.
self.observation_space = Box(low=np.array([-0.25, -0.88, 0.00, 0.00, 0.00, 0.00]),
high=np.array([0.75, 0.12, 4095.00, 4095.00, 4095.00, 4095.00]),
dtype=np.float64)
self.action_space = Discrete(3)
self.robot = self.getSelf()
self.leftMotor = self.getDevice("left wheel motor")
self.rightMotor = self. getDevice("right wheel motor")
self.leftMotor.setPosition(float('inf'))
self.rightMotor.setPosition(float('inf'))
self.leftMotor.setVelocity(0.0)
self.rightMotor.setVelocity(0.0)`
Additionally, I did the same setting in apply_action() method according to the tutorial, in which I mapped the three actions to my robots with detailed behaviors:
def apply_action(self, action):
action = int(action[0])
print("action: ", action)
l_speed = 3.14
r_speed = 3.14
if action == 0: # go straight
l_speed = 3.14
r_speed = 3.14
if action == 1: # turn right
l_speed = 3.14
r_speed = -3.14
if action == 2: # turn left
l_speed = -3.14
r_speed = 3.14
self.leftMotor.setVelocity(l_speed)
self.rightMotor.setVelocity(r_speed)
Here, The control algorithms may be not correct but the robots should at least stochastically move. During iteration, however, I found that my robot (in my projects, I used an e-punk robot) never moved even one step no matter how many timestep I set. I don't know what happened to my code and hope anyone can help me to fix it. Many thanks!