:py:mod:`starling_sim.basemodel.agent.moving_agent` =================================================== .. py:module:: starling_sim.basemodel.agent.moving_agent .. autoapi-nested-parse:: This module contains the MovingAgent class, with useful methods to make an agent move in the environment Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: starling_sim.basemodel.agent.moving_agent.MovingAgent .. py:class:: MovingAgent(simulation_model, agent_id, origin, **kwargs) Bases: :py:obj:`starling_sim.basemodel.agent.spatial_agent.SpatialAgent` This class describes an agent with the capacity of moving .. py:method:: move_(route=None, duration=None, check_dest=False, destination=None, parameters=None, verb=True) Compute a route with the given parameters and follow it. :param route: list of consecutive nodes in the environment :param duration: total duration of the move :param check_dest: boolean indicating the destination changes should be checked while following the route :param destination: used for computing the route. If None, self.tempDest is used :param parameters: agent specific parameters used for path evaluation :param verb: boolean indicating if a message should be displayed when calling the function :return: yield one or several processes during the route execution .. py:method:: follow_route_data_(route_data, check_dest, mode, verb=True) Travel along the given route :param route_data: route_data to be followed :param check_dest: boolean indicating if destination changes should be checked during the trip :param mode: mode used :param verb: boolean indicating if a log should be displayed when calling the function .. py:method:: change_position(new_position, mode) Change the current position of the agent. :param new_position: new position of the agent :param mode: agent transport mode :return: .. py:method:: move_to_(destination, duration) Perform the action of moving from the current position to a given destination :param destination: Destination in the simulation environment :param duration: Duration of the trip :return: yield a trip duration process .. py:method:: fly_(destination=None, duration=None, length=None, distance_factor=None, speed=None, mode=None, verb=True) Realise a direct trip from current position to destination without using the network. The information provided (duration, length, speed) must allow to compute the trip duration and length. Length can be computed using euclidean distance. If duration and length are provided, speed is not used. :param destination: destination of the trip. Default is self.tempDestination. :param duration: duration of the trip. Default is computed using length and speed. :param length: length of the trip. Default is computed using duration and speed, or using euclidean distance. :param distance_factor: value multiplied to euclidean distance to get trip distance. Default is defined by the 'distance_factor' config value. :param speed: speed of the agent, used to compute duration and length :param mode: mode of traveling. Default is self.mode. :param verb: boolean indicating if a log should be displayed when calling the function :return: yield a trip duration process .. py:method:: approximate_trip(origin, destination, distance_factor, speed) Approximate the length and time of a trip based on the euclidean distance and speed. The computation is based on a factor that is applied to the euclidean distance. :param origin: origin position :param destination: destination position :param distance_factor: value multiplied to euclidean distance to get trip distance. :param speed: speed of the travelling agent, in m/s. If None, travel time is not computed :return: tuple (travel_length, travel_time)