add humanoid and kuka gym environments (experimental)
This commit is contained in:
30
examples/pybullet/gym/racecarZEDGymEnvTest.py
Normal file
30
examples/pybullet/gym/racecarZEDGymEnvTest.py
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
from envs.bullet.racecarZEDGymEnv import RacecarZEDGymEnv
|
||||
print ("hello")
|
||||
environment = RacecarZEDGymEnv(renders=True)
|
||||
|
||||
targetVelocitySlider = environment._p.addUserDebugParameter("wheelVelocity",-1,1,0)
|
||||
steeringSlider = environment._p.addUserDebugParameter("steering",-0.5,0.5,0)
|
||||
|
||||
while (True):
|
||||
targetVelocity = environment._p.readUserDebugParameter(targetVelocitySlider)
|
||||
steeringAngle = environment._p.readUserDebugParameter(steeringSlider)
|
||||
discreteAction = 0
|
||||
if (targetVelocity<-0.33):
|
||||
discreteAction=0
|
||||
else:
|
||||
if (targetVelocity>0.33):
|
||||
discreteAction=6
|
||||
else:
|
||||
discreteAction=3
|
||||
if (steeringAngle>-0.17):
|
||||
if (steeringAngle>0.17):
|
||||
discreteAction=discreteAction+2
|
||||
else:
|
||||
discreteAction=discreteAction+1
|
||||
|
||||
action=discreteAction
|
||||
state, reward, done, info = environment.step(action)
|
||||
obs = environment.getExtendedObservation()
|
||||
print("obs")
|
||||
print(obs)
|
||||
Reference in New Issue
Block a user