/* -*- Mode: Text -*-* */ /********************************************************************\ * File: grid_simpler.hs * * Date: 11/28/1997 * * Author: Cem Unsal * * Robotics Institute, Carnegie-Mellon University * * unsal@ri.cmu.edu * * * * Description: * * The Cell Creator, which also includes the position of the cells * * is used to describe the grid to be used in the simulation. * * See documentation for details. * * * * Cell generation is not automated; the locations and the adjoint * * cell definitions must be defined carefully. * * * * External C functions: * * * * This file is distributed under the conditions described in the * * file 'CONDITIONS' which should accompany this file. * \********************************************************************/ #ifndef SAHS_GRID_HS #define SAHS_GRID_HS #include /* These numbers must be compatible with highway description. * See associated highway description file. */ global number xmax := 600; global number ymax := 600; global number xmin := 0; global number ymin := 0; global set(Cell) Cells; global CellCreator ccc := create(CellCreator); type CellCreator { output Cell newcell; number c := 75; // Cell size according to the animation window 'track' in TkShift; // definition of this animation window is given in sensor.{pdf,ps} state Cell c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17 ,c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28; discrete start, done; export finished; transition start -> done {} define { // Define temporary cells Cell tc1 := create(Cell, x := 0, y := 0, cs := c); Cell tc2 := create(Cell, x := 0, y := c, cs := c); Cell tc3 := create(Cell, x := 0, y := 2*c, cs := c); Cell tc4 := create(Cell, x := 0, y := 3*c, cs := c); Cell tc5 := create(Cell, x := 0, y := 4*c, cs := c); Cell tc6 := create(Cell, x := 0, y := 5*c, cs := c); Cell tc7 := create(Cell, x := 0, y := 6*c, cs := c); Cell tc8 := create(Cell, x := 0, y := 7*c, cs := c); Cell tc9 := create(Cell, x := c, y := 7*c, cs := c); Cell tc10 := create(Cell, x := 2*c, y := 7*c, cs := c); Cell tc11 := create(Cell, x := 3*c, y := 7*c, cs := c); Cell tc12 := create(Cell, x := 3*c, y := 6*c, cs := c); Cell tc13 := create(Cell, x := 3*c, y := 5*c, cs := c); Cell tc14 := create(Cell, x := 4*c, y := 5*c, cs := c); Cell tc15 := create(Cell, x := 4*c, y := 4*c, cs := c); Cell tc16 := create(Cell, x := 5*c, y := 4*c, cs := c); Cell tc17 := create(Cell, x := 5*c, y := 3*c, cs := c); Cell tc18 := create(Cell, x := 6*c, y := 3*c, cs := c); Cell tc19 := create(Cell, x := 7*c, y := 3*c, cs := c); Cell tc20 := create(Cell, x := 7*c, y := 2*c, cs := c); Cell tc21 := create(Cell, x := 7*c, y := c, cs := c); Cell tc22 := create(Cell, x := 7*c, y := 0, cs := c); Cell tc23 := create(Cell, x := 6*c, y := 0, cs := c); Cell tc24 := create(Cell, x := 5*c, y := 0, cs := c); Cell tc25 := create(Cell, x := 4*c, y := 0, cs := c); Cell tc26 := create(Cell, x := 3*c, y := 0, cs := c); Cell tc27 := create(Cell, x := 2*c, y := 0, cs := c); Cell tc28 := create(Cell, x := 1*c, y := 0, cs := c); } do { // Define cells and their neighbors c1 := tc1; c10 := tc10; c11 := tc11; c20 := tc20; c21 := tc21; c2 := tc2; c9 := tc9; c12 := tc12; c19 := tc19; c22 := tc22; c3 := tc3; c8 := tc8; c13 := tc13; c18 := tc18; c23 := tc23; c4 := tc4; c7 := tc7; c14 := tc14; c17 := tc17; c24 := tc24; c5 := tc5; c6 := tc6; c15 := tc15; c16 := tc16; c25 := tc25; c28 := tc28; c27 := tc27; c26 := tc26; Cells := Cells + {tc1, tc2, tc3, tc4, tc5, tc6, tc7, tc8, tc9, tc10, tc11, tc12, tc13, tc14, tc15, tc16, tc17, tc18, tc19, tc20, tc21, tc22, tc23, tc24, tc25, tc26, tc27, tc28}; NC(c1):={tc2, tc28}; NC(c2):={tc1, tc3, tc28}; NC(c3):={tc2, tc4}; NC(c4):={tc3, tc5}; NC(c5):={tc4, tc6}; NC(c6):={tc5, tc7}; NC(c7):={tc6, tc8, tc9}; NC(c8):={tc7, tc9}; NC(c9):={tc7, tc8, tc10}; NC(c10):={tc9, tc11, tc12}; NC(c11):={tc10, tc12}; NC(c12):={tc10, tc11, tc13, tc14}; NC(c13):={tc12, tc14, tc15}; NC(c14):={tc12, tc13, tc15, tc16}; NC(c15):={tc13, tc14, tc16, tc17}; NC(c16):={tc14, tc15, tc17, tc18}; NC(c17):={tc15, tc16, tc18}; NC(c18):={tc16, tc17, tc19, tc20}; NC(c19):={tc18, tc20}; NC(c20):={tc18, tc19, tc21}; NC(c21):={tc20, tc22, tc23}; NC(c22):={tc21, tc23}; NC(c23):={tc21, tc22, tc24}; NC(c24):={tc23, tc25}; NC(c25):={tc24, tc26}; NC(c26):={tc25, tc27}; NC(c27):={tc26, tc28}; NC(c28):={tc27, tc1, tc2}; }, done -> done {finished} ; // This is required, otherwise you will see // Shift run-time error due to a minel operation in // sensor operations. All adjoining cells must be defined // before any detection operations. // See source_grid.hs and roadsidesensor2_grid.hs for details. } #endif // SAHS_GRID_HS