Skip to content

Commit

Permalink
Add mo sumo-rl environment
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasAlegre committed Jun 22, 2024
1 parent 668ef51 commit 8da9417
Show file tree
Hide file tree
Showing 6 changed files with 10,316 additions and 0 deletions.
1 change: 1 addition & 0 deletions mo_gymnasium/envs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
import mo_gymnasium.envs.mujoco
import mo_gymnasium.envs.reacher
import mo_gymnasium.envs.resource_gathering
import mo_gymnasium.envs.sumo_rl
import mo_gymnasium.envs.water_reservoir
8 changes: 8 additions & 0 deletions mo_gymnasium/envs/sumo_rl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from gymnasium.envs.registration import register


register(
id="mo-intersection-v0",
entry_point="mo_gymnasium.envs.sumo_rl.mo_sumo_rl:MOIntersectionEnv",
max_episode_steps=300,
)
202 changes: 202 additions & 0 deletions mo_gymnasium/envs/sumo_rl/assets/big_intersection.net.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 02/26/19 22:21:10 by Eclipse SUMO netconvert Version 1.0.1
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/netconvertConfiguration.xsd">
<input>
<sumo-net-file value="tlcs2.net.xml"/>
</input>
<processing>
<offset.disable-normalization value="true"/>
<lefthand value="false"/>
</processing>
<junctions>
<no-turnarounds value="true"/>
<junctions.corner-detail value="5"/>
<junctions.limit-turn-speed value="5.5"/>
<rectangular-lane-cut value="false"/>
</junctions>
<pedestrian>
<walkingareas value="false"/>
</pedestrian>
</configuration>
-->

<net version="1.0" junctionCornerDetail="5" limitTurnSpeed="5.50" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd">

<location netOffset="0.00,0.00" convBoundary="-750.00,-750.00,750.00,750.00" origBoundary="-10000000000.00,-10000000000.00,10000000000.00,10000000000.00" projParameter="!"/>

<edge id=":TL_0" function="internal">
<lane id=":TL_0_0" index="0" speed="6.51" length="9.03" shape="-11.20,16.80 -11.55,14.35 -12.60,12.60 -14.35,11.55 -16.80,11.20"/>
</edge>
<edge id=":TL_1" function="internal">
<lane id=":TL_1_0" index="0" speed="13.89" length="33.60" shape="-11.20,16.80 -11.20,-16.80"/>
<lane id=":TL_1_1" index="1" speed="13.89" length="33.60" shape="-8.00,16.80 -8.00,-16.80"/>
<lane id=":TL_1_2" index="2" speed="13.89" length="33.60" shape="-4.80,16.80 -4.80,-16.80"/>
</edge>
<edge id=":TL_4" function="internal">
<lane id=":TL_4_0" index="0" speed="11.36" length="29.67" shape="-1.60,16.80 -0.45,8.75 3.00,3.00 8.75,-0.45 16.80,-1.60"/>
</edge>
<edge id=":TL_5" function="internal">
<lane id=":TL_5_0" index="0" speed="6.51" length="9.03" shape="16.80,11.20 14.35,11.55 12.60,12.60 11.55,14.35 11.20,16.80"/>
</edge>
<edge id=":TL_6" function="internal">
<lane id=":TL_6_0" index="0" speed="13.89" length="33.60" shape="16.80,11.20 -16.80,11.20"/>
<lane id=":TL_6_1" index="1" speed="13.89" length="33.60" shape="16.80,8.00 -16.80,8.00"/>
<lane id=":TL_6_2" index="2" speed="13.89" length="33.60" shape="16.80,4.80 -16.80,4.80"/>
</edge>
<edge id=":TL_9" function="internal">
<lane id=":TL_9_0" index="0" speed="11.36" length="29.67" shape="16.80,1.60 8.75,0.45 3.00,-3.00 -0.45,-8.75 -1.60,-16.80"/>
</edge>
<edge id=":TL_10" function="internal">
<lane id=":TL_10_0" index="0" speed="6.51" length="9.03" shape="11.20,-16.80 11.55,-14.35 12.60,-12.60 14.35,-11.55 16.80,-11.20"/>
</edge>
<edge id=":TL_11" function="internal">
<lane id=":TL_11_0" index="0" speed="13.89" length="33.60" shape="11.20,-16.80 11.20,16.80"/>
<lane id=":TL_11_1" index="1" speed="13.89" length="33.60" shape="8.00,-16.80 8.00,16.80"/>
<lane id=":TL_11_2" index="2" speed="13.89" length="33.60" shape="4.80,-16.80 4.80,16.80"/>
</edge>
<edge id=":TL_14" function="internal">
<lane id=":TL_14_0" index="0" speed="11.36" length="29.67" shape="1.60,-16.80 0.45,-8.75 -3.00,-3.00 -8.75,0.45 -16.80,1.60"/>
</edge>
<edge id=":TL_15" function="internal">
<lane id=":TL_15_0" index="0" speed="6.51" length="9.03" shape="-16.80,-11.20 -14.35,-11.55 -12.60,-12.60 -11.55,-14.35 -11.20,-16.80"/>
</edge>
<edge id=":TL_16" function="internal">
<lane id=":TL_16_0" index="0" speed="13.89" length="33.60" shape="-16.80,-11.20 16.80,-11.20"/>
<lane id=":TL_16_1" index="1" speed="13.89" length="33.60" shape="-16.80,-8.00 16.80,-8.00"/>
<lane id=":TL_16_2" index="2" speed="13.89" length="33.60" shape="-16.80,-4.80 16.80,-4.80"/>
</edge>
<edge id=":TL_19" function="internal">
<lane id=":TL_19_0" index="0" speed="11.36" length="29.67" shape="-16.80,-1.60 -8.75,-0.45 -3.00,3.00 0.45,8.75 1.60,16.80"/>
</edge>

<edge id="E2TL" from="DE" to="TL" priority="-1" length="750.00">
<lane id="E2TL_0" index="0" speed="13.89" length="750.00" shape="750.00,11.20 16.80,11.20"/>
<lane id="E2TL_1" index="1" speed="13.89" length="750.00" shape="750.00,8.00 16.80,8.00"/>
<lane id="E2TL_2" index="2" speed="13.89" length="750.00" shape="750.00,4.80 16.80,4.80"/>
<lane id="E2TL_3" index="3" speed="13.89" length="750.00" shape="750.00,1.60 16.80,1.60"/>
</edge>
<edge id="N2TL" from="DN" to="TL" priority="-1" length="750.00">
<lane id="N2TL_0" index="0" speed="13.89" length="750.00" shape="-11.20,750.00 -11.20,16.80"/>
<lane id="N2TL_1" index="1" speed="13.89" length="750.00" shape="-8.00,750.00 -8.00,16.80"/>
<lane id="N2TL_2" index="2" speed="13.89" length="750.00" shape="-4.80,750.00 -4.80,16.80"/>
<lane id="N2TL_3" index="3" speed="13.89" length="750.00" shape="-1.60,750.00 -1.60,16.80"/>
</edge>
<edge id="S2TL" from="DS" to="TL" priority="-1" length="750.00">
<lane id="S2TL_0" index="0" speed="13.89" length="750.00" shape="11.20,-750.00 11.20,-16.80"/>
<lane id="S2TL_1" index="1" speed="13.89" length="750.00" shape="8.00,-750.00 8.00,-16.80"/>
<lane id="S2TL_2" index="2" speed="13.89" length="750.00" shape="4.80,-750.00 4.80,-16.80"/>
<lane id="S2TL_3" index="3" speed="13.89" length="750.00" shape="1.60,-750.00 1.60,-16.80"/>
</edge>
<edge id="TL2E" from="TL" to="DE" priority="-1" length="750.00">
<lane id="TL2E_0" index="0" speed="13.89" length="750.00" shape="16.80,-11.20 750.00,-11.20"/>
<lane id="TL2E_1" index="1" speed="13.89" length="750.00" shape="16.80,-8.00 750.00,-8.00"/>
<lane id="TL2E_2" index="2" speed="13.89" length="750.00" shape="16.80,-4.80 750.00,-4.80"/>
<lane id="TL2E_3" index="3" speed="13.89" length="750.00" shape="16.80,-1.60 750.00,-1.60"/>
</edge>
<edge id="TL2N" from="TL" to="DN" priority="-1" length="750.00">
<lane id="TL2N_0" index="0" speed="13.89" length="750.00" shape="11.20,16.80 11.20,750.00"/>
<lane id="TL2N_1" index="1" speed="13.89" length="750.00" shape="8.00,16.80 8.00,750.00"/>
<lane id="TL2N_2" index="2" speed="13.89" length="750.00" shape="4.80,16.80 4.80,750.00"/>
<lane id="TL2N_3" index="3" speed="13.89" length="750.00" shape="1.60,16.80 1.60,750.00"/>
</edge>
<edge id="TL2S" from="TL" to="DS" priority="-1" length="750.00">
<lane id="TL2S_0" index="0" speed="13.89" length="750.00" shape="-11.20,-16.80 -11.20,-750.00"/>
<lane id="TL2S_1" index="1" speed="13.89" length="750.00" shape="-8.00,-16.80 -8.00,-750.00"/>
<lane id="TL2S_2" index="2" speed="13.89" length="750.00" shape="-4.80,-16.80 -4.80,-750.00"/>
<lane id="TL2S_3" index="3" speed="13.89" length="750.00" shape="-1.60,-16.80 -1.60,-750.00"/>
</edge>
<edge id="TL2W" from="TL" to="DW" priority="-1" length="750.00">
<lane id="TL2W_0" index="0" speed="13.89" length="750.00" shape="-16.80,11.20 -750.00,11.20"/>
<lane id="TL2W_1" index="1" speed="13.89" length="750.00" shape="-16.80,8.00 -750.00,8.00"/>
<lane id="TL2W_2" index="2" speed="13.89" length="750.00" shape="-16.80,4.80 -750.00,4.80"/>
<lane id="TL2W_3" index="3" speed="13.89" length="750.00" shape="-16.80,1.60 -750.00,1.60"/>
</edge>
<edge id="W2TL" from="DW" to="TL" priority="-1" length="750.00">
<lane id="W2TL_0" index="0" speed="13.89" length="750.00" shape="-750.00,-11.20 -16.80,-11.20"/>
<lane id="W2TL_1" index="1" speed="13.89" length="750.00" shape="-750.00,-8.00 -16.80,-8.00"/>
<lane id="W2TL_2" index="2" speed="13.89" length="750.00" shape="-750.00,-4.80 -16.80,-4.80"/>
<lane id="W2TL_3" index="3" speed="13.89" length="750.00" shape="-750.00,-1.60 -16.80,-1.60"/>
</edge>

<tlLogic id="TL" type="static" programID="0" offset="0">
<phase duration="100" state="GGGGrrrrrrGGGGrrrrrr"/>
<phase duration="100" state="yyyyrrrrrryyyyrrrrrr"/>
<phase duration="100" state="rrrrGrrrrrrrrrGrrrrr"/>
<phase duration="100" state="rrrryrrrrrrrrryrrrrr"/>
<phase duration="100" state="rrrrrGGGGrrrrrrGGGGr"/>
<phase duration="100" state="rrrrryyyyrrrrrryyyyr"/>
<phase duration="100" state="rrrrrrrrrGrrrrrrrrrG"/>
<phase duration="100" state="rrrrrrrrryrrrrrrrrry"/>
</tlLogic>

<junction id="DE" type="dead_end" x="750.00" y="0.00" incLanes="TL2E_0 TL2E_1 TL2E_2 TL2E_3" intLanes="" shape="750.00,0.00 750.00,-12.80 750.00,0.00"/>
<junction id="DN" type="dead_end" x="0.00" y="750.00" incLanes="TL2N_0 TL2N_1 TL2N_2 TL2N_3" intLanes="" shape="0.00,750.00 12.80,750.00 0.00,750.00"/>
<junction id="DS" type="dead_end" x="0.00" y="-750.00" incLanes="TL2S_0 TL2S_1 TL2S_2 TL2S_3" intLanes="" shape="0.00,-750.00 -12.80,-750.00 0.00,-750.00"/>
<junction id="DW" type="dead_end" x="-750.00" y="0.00" incLanes="TL2W_0 TL2W_1 TL2W_2 TL2W_3" intLanes="" shape="-750.00,0.00 -750.00,12.80 -750.00,0.00"/>
<junction id="TL" type="traffic_light" x="0.00" y="0.00" incLanes="N2TL_0 N2TL_1 N2TL_2 N2TL_3 E2TL_0 E2TL_1 E2TL_2 E2TL_3 S2TL_0 S2TL_1 S2TL_2 S2TL_3 W2TL_0 W2TL_1 W2TL_2 W2TL_3" intLanes=":TL_0_0 :TL_1_0 :TL_1_1 :TL_1_2 :TL_4_0 :TL_5_0 :TL_6_0 :TL_6_1 :TL_6_2 :TL_9_0 :TL_10_0 :TL_11_0 :TL_11_1 :TL_11_2 :TL_14_0 :TL_15_0 :TL_16_0 :TL_16_1 :TL_16_2 :TL_19_0" shape="-12.80,16.80 12.80,16.80 13.24,14.58 13.80,13.80 14.58,13.24 15.58,12.91 16.80,12.80 16.80,-12.80 14.58,-13.24 13.80,-13.80 13.24,-14.58 12.91,-15.58 12.80,-16.80 -12.80,-16.80 -13.24,-14.58 -13.80,-13.80 -14.58,-13.24 -15.58,-12.91 -16.80,-12.80 -16.80,12.80 -14.58,13.24 -13.80,13.80 -13.24,14.58 -12.91,15.58">
<request index="0" response="00000000000000000000" foes="00000100000111000000" cont="0"/>
<request index="1" response="00000000000000000000" foes="11111100001111000000" cont="0"/>
<request index="2" response="00000000000000000000" foes="11111100001111000000" cont="0"/>
<request index="3" response="00000000000000000000" foes="11111100001111000000" cont="0"/>
<request index="4" response="00000011110000000000" foes="11110011111111000000" cont="0"/>
<request index="5" response="00000011100000000000" foes="10000011100000000000" cont="0"/>
<request index="6" response="00000111100000011111" foes="10000111100000011111" cont="0"/>
<request index="7" response="00000111100000011111" foes="10000111100000011111" cont="0"/>
<request index="8" response="00000111100000011111" foes="10000111100000011111" cont="0"/>
<request index="9" response="01111111100000011110" foes="01111111100000011110" cont="0"/>
<request index="10" response="00000000000000000000" foes="01110000000000010000" cont="0"/>
<request index="11" response="00000000000000000000" foes="11110000001111110000" cont="0"/>
<request index="12" response="00000000000000000000" foes="11110000001111110000" cont="0"/>
<request index="13" response="00000000000000000000" foes="11110000001111110000" cont="0"/>
<request index="14" response="00000000000000001111" foes="11110000001111001111" cont="0"/>
<request index="15" response="00000000000000001110" foes="00000000001000001110" cont="0"/>
<request index="16" response="00000111110000011110" foes="00000111111000011110" cont="0"/>
<request index="17" response="00000111110000011110" foes="00000111111000011110" cont="0"/>
<request index="18" response="00000111110000011110" foes="00000111111000011110" cont="0"/>
<request index="19" response="00000111100111111110" foes="00000111100111111110" cont="0"/>
</junction>

<connection from="E2TL" to="TL2N" fromLane="0" toLane="0" via=":TL_5_0" tl="TL" linkIndex="5" dir="r" state="o"/>
<connection from="E2TL" to="TL2W" fromLane="0" toLane="0" via=":TL_6_0" tl="TL" linkIndex="6" dir="s" state="o"/>
<connection from="E2TL" to="TL2W" fromLane="1" toLane="1" via=":TL_6_1" tl="TL" linkIndex="7" dir="s" state="o"/>
<connection from="E2TL" to="TL2W" fromLane="2" toLane="2" via=":TL_6_2" tl="TL" linkIndex="8" dir="s" state="o"/>
<connection from="E2TL" to="TL2S" fromLane="3" toLane="3" via=":TL_9_0" tl="TL" linkIndex="9" dir="l" state="o"/>
<connection from="N2TL" to="TL2W" fromLane="0" toLane="0" via=":TL_0_0" tl="TL" linkIndex="0" dir="r" state="O"/>
<connection from="N2TL" to="TL2S" fromLane="0" toLane="0" via=":TL_1_0" tl="TL" linkIndex="1" dir="s" state="O"/>
<connection from="N2TL" to="TL2S" fromLane="1" toLane="1" via=":TL_1_1" tl="TL" linkIndex="2" dir="s" state="O"/>
<connection from="N2TL" to="TL2S" fromLane="2" toLane="2" via=":TL_1_2" tl="TL" linkIndex="3" dir="s" state="O"/>
<connection from="N2TL" to="TL2E" fromLane="3" toLane="3" via=":TL_4_0" tl="TL" linkIndex="4" dir="l" state="o"/>
<connection from="S2TL" to="TL2E" fromLane="0" toLane="0" via=":TL_10_0" tl="TL" linkIndex="10" dir="r" state="O"/>
<connection from="S2TL" to="TL2N" fromLane="0" toLane="0" via=":TL_11_0" tl="TL" linkIndex="11" dir="s" state="O"/>
<connection from="S2TL" to="TL2N" fromLane="1" toLane="1" via=":TL_11_1" tl="TL" linkIndex="12" dir="s" state="O"/>
<connection from="S2TL" to="TL2N" fromLane="2" toLane="2" via=":TL_11_2" tl="TL" linkIndex="13" dir="s" state="O"/>
<connection from="S2TL" to="TL2W" fromLane="3" toLane="3" via=":TL_14_0" tl="TL" linkIndex="14" dir="l" state="o"/>
<connection from="W2TL" to="TL2S" fromLane="0" toLane="0" via=":TL_15_0" tl="TL" linkIndex="15" dir="r" state="o"/>
<connection from="W2TL" to="TL2E" fromLane="0" toLane="0" via=":TL_16_0" tl="TL" linkIndex="16" dir="s" state="o"/>
<connection from="W2TL" to="TL2E" fromLane="1" toLane="1" via=":TL_16_1" tl="TL" linkIndex="17" dir="s" state="o"/>
<connection from="W2TL" to="TL2E" fromLane="2" toLane="2" via=":TL_16_2" tl="TL" linkIndex="18" dir="s" state="o"/>
<connection from="W2TL" to="TL2N" fromLane="3" toLane="3" via=":TL_19_0" tl="TL" linkIndex="19" dir="l" state="o"/>

<connection from=":TL_0" to="TL2W" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":TL_1" to="TL2S" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":TL_1" to="TL2S" fromLane="1" toLane="1" dir="s" state="M"/>
<connection from=":TL_1" to="TL2S" fromLane="2" toLane="2" dir="s" state="M"/>
<connection from=":TL_4" to="TL2E" fromLane="0" toLane="3" dir="l" state="M"/>
<connection from=":TL_5" to="TL2N" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":TL_6" to="TL2W" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":TL_6" to="TL2W" fromLane="1" toLane="1" dir="s" state="M"/>
<connection from=":TL_6" to="TL2W" fromLane="2" toLane="2" dir="s" state="M"/>
<connection from=":TL_9" to="TL2S" fromLane="0" toLane="3" dir="l" state="M"/>
<connection from=":TL_10" to="TL2E" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":TL_11" to="TL2N" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":TL_11" to="TL2N" fromLane="1" toLane="1" dir="s" state="M"/>
<connection from=":TL_11" to="TL2N" fromLane="2" toLane="2" dir="s" state="M"/>
<connection from=":TL_14" to="TL2W" fromLane="0" toLane="3" dir="l" state="M"/>
<connection from=":TL_15" to="TL2S" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":TL_16" to="TL2E" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":TL_16" to="TL2E" fromLane="1" toLane="1" dir="s" state="M"/>
<connection from=":TL_16" to="TL2E" fromLane="2" toLane="2" dir="s" state="M"/>
<connection from=":TL_19" to="TL2N" fromLane="0" toLane="3" dir="l" state="M"/>

</net>
Loading

0 comments on commit 8da9417

Please sign in to comment.