/* -*- Mode: Text -*-* */ /********************************************************************\ * File: sep.hs * * Date: 11/25/1997 * * Author: Cem Unsal * * Robotics Institute, Carnegie-Mellon University * * unsal@ri.cmu.edu * * * * Description: * * Sensor Environment Processor (SEP) is part of the type Vehicle, * * and is used to provide: * * * * (a) A subset of vehicles to be evaluated for the sensors * * The output is 'current cell'; the sensor has an input * * connected to this output, and the set of vehicles will be * * read from the set 'Vehicles' of the current set * * (b) [Environment conditions for sensor operations] * * * * External C functions: - * * * * * * This file is distributed under the conditions described in the * * file 'CONDITIONS' which should accompany this file. * \********************************************************************/ #ifndef SAHS_SEP_HS #define SAHS_SEP_HS type SEP { input number x, y; // Vehicle position output Cell mycell; // Current cell in which the vehicle travels state Vehicle myveh, sw; // Ego-vehicle, switching vehicle discrete run, update; export cell_updated; transition run -> update {mycell:vehicle_leaving} // Current cell signals a vehicle is leaving do { sw := leavingvehicle(mycell); }, update -> run {} // If leaving vehicle is not ego-vehicle, do nothing when sw /= myveh , update -> run {cell_updated} // If leaving vehicle is ego-vehicle, update cell using global position when sw = myveh define { set(Cell) newcells := { nc : nc in NC(mycell) | x(nc) <= x and x(nc)+cs(nc) > x and y(nc) <= y and y(nc)+cs(nc) > y}; } do { mycell := minel a in newcells : 1; // Assuming the set 'newcells' // has only 1 element. }; } #endif // SAHS_SEP_HS