Examples of TLState


Examples of it.polito.appeal.traci.TLState

                   
                    LightState[] ls = new LightState[tl.getReadCurrentStateQuery().get().lightStates.length];
                    for(int i=0; i<tl.getReadCurrentStateQuery().get().lightStates.length; i++){
                     ls[i]=LightState.RED;
                    }
                    TLState tls = new TLState(ls);
                    ChangeLightsStateQuery q = tl.getChangeLightsStateQuery();
                    q.setValue(tls);
                    q.run();
                   
View Full Code Here

Examples of it.polito.appeal.traci.TLState

 
  @Test
  public void testStateAtFirstStep() throws IOException {
    TrafficLight tl = repo.getByID("0");
    TLState tlState = tl.getReadCurrentStateQuery().get();
    final LightState[] states = tlState.lightStates;
    assertEquals(16, states.length);
    assertArrayEquals(PHASES[0], states);
  }
View Full Code Here

Examples of it.polito.appeal.traci.TLState

   
    // looks like SUMO shifts all TL timings ahead one second
    conn.nextSimStep();
   
    for (int p = 0; p < PHASES.length; p++) {
      TLState tlState = query.get();
      final LightState[] states = tlState.lightStates;
      System.out.println("state at t=" + conn.getCurrentSimStep() + "\n"
          + "  expected " + Arrays.toString(PHASES[p]) + "\n"
          + "  actual   " + Arrays.toString(states));
      assertArrayEquals("state at t=" + conn.getCurrentSimStep(), PHASES[p], states);
View Full Code Here

Examples of it.polito.appeal.traci.TLState

 
  @Test
  public void testStateAtFirstStep() throws IOException {
    TrafficLight tl = repo.getByID("0");
    TLState tlState = tl.queryReadState().get();
    final LightState[] states = tlState.lightStates;
    assertEquals(16, states.length);
    assertArrayEquals(PHASES[0], states);
  }
View Full Code Here

Examples of it.polito.appeal.traci.TLState

   
    // looks like SUMO shifts all TL timings ahead one second
    conn.nextSimStep();
   
    for (int p = 0; p < PHASES.length; p++) {
      TLState tlState = query.get();
      final LightState[] states = tlState.lightStates;
      log.info("state at t=" + conn.getCurrentSimStep() + "\n"
          + "  expected " + Arrays.toString(PHASES[p]) + "\n"
          + "  actual   " + Arrays.toString(states));
      assertArrayEquals("state at t=" + conn.getCurrentSimStep(), PHASES[p], states);
View Full Code Here

Examples of it.polito.appeal.traci.TLState

  @Test
  public void testChangingCompleteProgramDefinition() throws IOException {
    TrafficLight tl = repo.getByID("0");
   
    final Logic expectedLogic = new Logic("0", 0, new Phase[] {
      new Phase(10000, new TLState("rrGGyyyyggrryryr")),
      new Phase(15000, new TLState("GGyyrrrrrrGGrGrG")),
      new Phase(55000, new TLState("yyrrGGGGGGyyGyGy"))
    });
    tl.queryChangeCompleteProgramDefinition().setValue(expectedLogic);
    tl.queryChangeCompleteProgramDefinition().run();
   
    Program newProgram = tl.queryReadCompleteDefinition().get();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.