Revision 114:5ce2c04c4d76

View differences:

src/main/java/cz/agents/alite/tactical/universe/entity/embodiment/CarModel.java
230 230
            tuning = new VehicleTuning();
231 231

  
232 232
            maxSteering = 1.0f;
233
            turnRadius = 4d;
233 234
        }
234 235

  
235 236
    }
......
260 261
            tuning = new VehicleTuning();
261 262

  
262 263
            maxSteering = 0.5f;
264
            turnRadius = 8d;
263 265
        }
264 266

  
265 267
    }
......
282 284
        protected VehicleTuning tuning;
283 285

  
284 286
        protected float maxSteering;
287
        protected double turnRadius;
285 288

  
286 289

  
287 290
        public Vector3f getCollisionBox() {
......
339 342
        public float getMaxSteering() {
340 343
			return maxSteering;
341 344
		}
345
        
346
        public double getTurnRadius(){
347
        	return turnRadius;
348
        }
342 349

  
343 350
    }
344 351

  
src/main/java/cz/agents/alite/tactical/universe/environment/actuator/PlanningCarActuator.java
62 62

  
63 63
    GoToWaypointCarActuator goToWaypointCarActuator;
64 64
    CarSensor carSensor;
65
    
66
    double turnRadius;
65 67

  
66 68
    // TODO: into one structure
67 69
    LinkedList<Point> path = new LinkedList<Point>();
......
73 75
        super(environment, relatedEntity);
74 76
        PlanningCarActuator.universe = environment.getUniverse();
75 77
        carStorage = environment.getCarStorage();
78
        turnRadius = carStorage.getCars().get(getRelatedEntity().getName()).getCarModel().getCarDefinition().getTurnRadius();
76 79
        goToWaypointCarActuator = environment.handler().addAction(GoToWaypointCarActuator.class, getRelatedEntity());
77 80
        carSensor = environment.handler().addSensor(CarSensor.class, getRelatedEntity());
78 81
        carSensor.registerWaypointReachedCallback(new WaypointReachedCallback() {
79 82

  
80 83
            @Override
81 84
            public void waypointReached(final Point mapPosition) {
85
            	System.out.println("REACHED " + mapPosition);
82 86
                processNextWaypoint();
83 87
            }
84 88

  
......
134 138
                LinkedList<Point> outPath = new LinkedList<Point>();
135 139
                LinkedList<Boolean> outPathOrientation = new LinkedList<Boolean>();
136 140

  
137
                Planner.preparePlan(lastWaypoint, lastWaypoint.orientation, waypoint, waypoint.orientation, outPath, outPathOrientation);
141
                Planner.preparePlan(lastWaypoint, lastWaypoint.orientation, waypoint, waypoint.orientation, outPath, outPathOrientation, turnRadius);
138 142

  
139 143
                path.addAll(outPath);
140 144
                pathOrientation.addAll(outPathOrientation);
......
146 150
        // generate visual form of the plan
147 151
        VisualPlan visualPlan = new VisualPlan(new LinkedList<Point>(path));
148 152
        carStorage.getCars().get(getRelatedEntity().getName()).setVisualPlan(visualPlan);
149

  
153
        
150 154
        System.out.println("..." + getRelatedEntity().getName() + " finished planning.");
151 155

  
152 156
        processNextWaypoint();
......
194 198
    // TODO: instantiated
195 199
    public static class Planner {
196 200

  
197
        private static final double TURN_RADIUS = 4.0;
198 201

  
199 202
        // TODO: move to universe/env/world
200 203
        public static GroupZone parentZone = null;
201 204
        public static GroupZone levelZone = null;
202 205

  
203 206
        // TODO: instantiated
204
        private static void preparePlan(Point pointFrom, Vector vectorFrom, Point pointTo, Vector vectorTo, LinkedList<Point> outPath, LinkedList<Boolean> outPathOrientation) {
207
        private static void preparePlan(Point pointFrom, Vector vectorFrom, Point pointTo, Vector vectorTo, LinkedList<Point> outPath, LinkedList<Boolean> outPathOrientation, double turnRadius) {
205 208
            if (parentZone == null) {
206 209
                parentZone = new GroupZone();
207 210
                levelZone = new GroupZone();
......
223 226
            expandManeuvers.getManeuver().add(new ExpandManeuver(ExpandManeuverType.TO_END));
224 227

  
225 228
            // plan trajectory
226
            PathFindSpecification pathFindSpecification = new PathFindSpecification(TURN_RADIUS, parentZone, new ManeuverSpecification(Planner.levelZone, levelConstants, expandManeuvers));
229
            PathFindSpecification pathFindSpecification = new PathFindSpecification(turnRadius, parentZone, new ManeuverSpecification(Planner.levelZone, levelConstants, expandManeuvers));
227 230

  
228 231
            try {
229 232
                pathFindSpecification.setFromTo(pointFrom, pointTo, vectorFrom, vectorTo);

Also available in: Unified diff