Package mosp_examples :: Module message_example :: Class MsgRandomWiggler
[hide private]
[frames] | no frames]

Class MsgRandomWiggler

source code


Implements a simple person doing only random movement on the map, sending and receiving some messages.


Author: P. Tute

Instance Methods [hide private]
 
next_target(self)
Randomly finds a new next_node to move to.
source code
 
receive(self, m, sender)
On receiving a message, the message is printed to stdout.
source code
 
think(self)
Person with id 23 sends hello messages to all people in his vicinity of 50 meters.
source code

Inherited from mosp.core.Person: __getstate__, __init__, act_at_node, calculate_duration, call_stop_actions, collide_circle, collide_rectangle, current_coords_impl, get_near, get_properties, get_random_way_node, get_speed, go, handle_interrupts, next_target_coord, pause_movement, reactivate, readd_actions, restart_actions, send, set_speed, start_action, stop_action, stop_actions

Inherited from mosp.core.Person (private): _get_classname

Inherited from SimPy.Lib.Process: acquired, active, cancel, interrupt, interruptReset, interrupted, passive, queuing, start, stored, terminated

Inherited from SimPy.Lib.Process (private): _hold, _passivate

Inherited from SimPy.Lister.Lister: __repr__, __str__, attrnames

Inherited from mosp.collide.Point: collide_polygon, get_points

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from SimPy.Lister.Lister: indent

Instance Variables [hide private]

Inherited from mosp.core.Person: current_coords, current_way, dest_node, last_coord, last_node, need_next_target, next_node, p_color, p_color_rgba, p_id, passivate, passivate_with_stop_actions, remove_from_sim, road_orthogonal_offset, start_node, stop_all_actions, target_coord

Properties [hide private]

Inherited from mosp.core.Person: p_agenttype, p_speed, x, y

Inherited from object: __class__

Method Details [hide private]

next_target(self)

source code 

Randomly finds a new next_node to move to.

Ignores the last visited node, if possible without getting stuck. Does not set destination_node. Random movement only uses last_node and next_node of a Person.

Overrides: mosp.core.Person.next_target

Author: P. Tute

receive(self, m, sender)

source code 

On receiving a message, the message is printed to stdout.

Parameters:
  • message - a message from the persons message queue.
  • sender - the sender of the message.
Returns:
True if the message should be removed from the queue, False else. It will then be delivered again in the next cycle.
Overrides: mosp.core.Person.receive

think(self)

source code 

Person with id 23 sends hello messages to all people in his vicinity of 50 meters.

Returns:
time until next wakeup (int, ticks), returning a negative number or 0 will cause self.go() to find a time
Overrides: mosp.core.Person.think