Skip to content
greg737 edited this page Aug 28, 2015 · 1 revision

#Humans

HumanModels

Humans are dynamic entities that inherit from the Entity class. They make use of basic Entity features like subscribing and publishing to stage topics, movement functions, and also inherit the action stack.

There will be two types of humans; Visitors and Workers. Both Visitors and Workers are child classes of the Human class. Currently the Human class does not have any unique implementations in the class, though once the Worker class is designed, both the Visitor and Worker will inherit attributes from the Human.

##Visitor

The possible behaviour of a Visitor is not well defined, as we will not know their intentions, and they may possibly be impaired. Thus the current behaviour of the Visitor is to navigate around the orchard randomly.

The random navigation of the visitor is determined by two functions; go_to_rand_location() and random_nav().

###go_to_rand_location()

This function works by first generating a random x coordinate between -40 and 40, and a random y coordinate between -40 and 40.

Visitor will then append three goto_yx(coordX, coordY) functions to the action stack. The first action that should be performed is a goto movement that moves the Visitor vertically towards a y coordinate of -15; goto_yx(currentX, -15). This is done to place the Visitor in an area without any orchard rows. The next action is then moving the visitor horizontally towards the randomly generated x coordinate; goto_yx(randX, -15). Finally the visitor will move towards the random coordinate; goto_yx(randX, randY).

Go To Random Location

###random_nav()

This random navigation is very simple. It just randomly chooses a cardinal direction, turns to that direction, then moves forward between 15 to 30 metres.

##Worker

The simulated world will also include Workers navigating around the orchard. However the workers have been taught to be aware of the robots movements. We interpreted this as that the workers should actively try to avoid being in the same vicinity as another robot. The Worker is also represented by two models. One model is just a simple human being, the other model is a tractor, which has a significantly larger size, but the same functionality.

The behaviour of the Worker entity is involves first navigating to an orchard row that is not occupied by any robots, then patrolling the row up and down. If the Worker detects that a robot has entered the row it is currently in, it will then attempt to leave the row. It will leave the row either through the north or the south exit, depending on where the robot entered from. It then moves east, and attempts to find another empty orchard row to navigate.

###define_orchard_row_gaps()

This function will read from config.properties file, and then generate pairs of x coordinates that correspond to the coordinates of the orchard rows. It will stores these values into an array. This allows the Worker to know where the orchard rows are, and thus be able to navigate to those rows.

###Robot_Locations_Callback()

The Worker entity subscribes to the topics "carrier_position" and "picker_position", which are topics published by the Carrier and Picker entities. This function is then invoked when a new message is received. It takes the positional data of the robots and stores it into a dictionary, using the robot id as the key.

SubToRobots

###go_to_empty_orchard_row() and patrol_orchard()

Once the worker has information regarding the coordinates of the orchard rows, and the coordinates of all the robots in the stage, it is able to determine if an orchard row that is not currently occupied by a robot. It will then append the necessary goto actions to travel to that row. Once at that row, the patrol_orhcard function will be invoked, which will continuously move the worker up and down the row.

###check_robot_locations()

This is invoked periodically as the worker moves around the stage. The purpose of this function is to iterate through the dictionary of robot locations, and check to see if any robot has entered the row the worker is currently in. If so, this function then stops movement, and calls avoid_robot().

###avoid_robot()

This will append actions to the stack in order to move the worker out of the orchard, and into the right corner of the stage. As demonstrated in the diagram below, the worker will move south if the robot enters from the north, and vice versa.

AvoidRobot

##Collision Avoidance

Both the Visitor and the Worker have a very basic level of collision avoidance. If an object is detected in front of it, it will stop movement, turn right, then move forward. It will always try to perform that set of actions whenever it detects a possible collision. After performing collision avoidance, it will then append a generic action depending on its current state.

Clone this wiki locally