HighwayEnv icon indicating copy to clipboard operation
HighwayEnv copied to clipboard

About manual control

Open wuyukun-tong opened this issue 2 years ago • 3 comments

Hi Now the function of manual control is disabled? The vehicle does not respond when I select manual mode and use the arrow keys to control it.

wuyukun-tong avatar May 27 '22 00:05 wuyukun-tong

Hi, I have issues with manual control as well. For me, it works for highway-v0, but doesn't work for Merge and Intersection. https://github.com/eleurent/highway-env/issues/322

Are you having the same issue?

jlwu002 avatar May 28 '22 18:05 jlwu002

Hi I test it in intersection env but it doesn't working

| | @.*** | | @.*** |

---- Replied Message ---- | From | Junlin @.> | | Date | 05/29/2022 02:35 | | To | @.> | | Cc | @.@.> | | Subject | Re: [eleurent/highway-env] About manual control (Issue #321) |

Hi, I have issues with manual control as well. For me, it works for highway-v0, but doesn't work for Merge and Intersection. https://github.com/eleurent/highway-env/issues/322#issue-1251034515

Are you having the same issue?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

wuyukun-tong avatar May 28 '22 23:05 wuyukun-tong

Hi, Try as indicated in the docs:

import gym
import highway_env

env = gym.make("intersection-v0")
env.configure({
    "manual_control": True,
    "real_time_rendering": True,
})
env.reset()
done = False
while not done:
    _, _, done, _ = env.step(env.action_space.sample())  # with manual control, these actions are ignored
    env.render()

This should work. HOWEVER, this is manual control for the default action type, which is DiscreteMetaAction. You can use the Left and Right arrows to control the vehicle target speed, and usually you can change lanes with Up and Down, but in this environment there is only a single lane that the agent, so these actions have no effect.

If you want full control over the vehicle, you can switch the action type to ContinuousActions:

env.configure({
    "manual_control": True,
    "real_time_rendering": True,
    "action": {
        "type": "ContinuousAction"
    }
})

eleurent avatar May 29 '22 14:05 eleurent