JobManager package¶
The JobManager package contains the Python Modules as used by the Job Manager ROS node: Each Module with its functions is described in more detail below.
JobManager.ClosestMex module¶
The ClosestMex module is used to determine the which Mobile Executor is closest to a given move or transport order location. First it will retrieve an up-to-date MEx list and filter on their status, leaving only those with the STANDBY status. Next, for each suitable (STANDBY) MEx, it waits for the amcl_pose message (location) of that MEx and then plans the route from which it will calculate the length of the path. The result is apended to a distances list as a Distance instance with the accompanying MEx ID. After all path length distances have been retrieved, it will loop over all Distance class instances in the list and find the closest MEx, which is then returns as a tuple of closest MEx ID and distance.
-
class
JobManager.ClosestMex.
Distance
(mex_id, distance)[source]¶ Distance class, containing Mobile Executor (MEx) ID and distance attributes. Instances from this class are added to the list where we choose the closest MEx to a location.
-
JobManager.ClosestMex.
calculate_euclidian_distance
(plan)[source]¶ Method to calculate Euclidian destance for each pair of poses from the MEx path. Loops over each pair and sums up the calculated Euclidian distances for a total path length. Returns path length.
-
JobManager.ClosestMex.
call_get_mex_list
()[source]¶ Function for retrieving the list of all MExs from the service provided by mex_sentinel node.
-
JobManager.ClosestMex.
choose_closest_mex
(location)[source]¶ The main method which call all other method in this module.
- Retrieve up-to-date MEx list and filter on their status (STANDBY is required).
- For each suitable MEx, Waits for the amcl_pose message (location) of that MEx, plans the route and calculates path length. Adding the result as a Distance instance.
- Loops over all Distance class instances in the list and finds the closest MEx.
Returns a tuple of closest MEx ID and distance.
-
JobManager.ClosestMex.
get_plan
(x_start, y_start, x_finish, y_finish, mex_id)[source]¶ Function to calculate path to a location using (!) /move_base/make_plan on a certain MEx. For this function to function, the specific MEx must have the move_base package running. Returns a move_base/make_plan plan.
JobManager.Job module¶
The Job module is used by the Job Manager ROS node. It contains the definitions of the Job Status and Job Priority enumerators as well as the Job class.
-
class
JobManager.Job.
Job
(job_id, completion_cb, keyword, mex_id=None, priority=<JobPriority.LOW: 1>)[source]¶ Class which contains overall job details and a list of job-tasks for individual jobs.
-
add_tasks
(list_of_tasks)[source]¶ Add a multiple tasks from a list to the job’s task list and update task count.
-
next_task
()[source]¶ Start executing the next task in the job’s task_list, if the status is still ACTIVE.
-
JobManager.JobActivation module¶
The Job Activation module consist of two functions, the Job Allocator and Job Refiner. The Job Allocator checks the Pending Jobs list and MExs list to assign a Job to a MEx. If the Job involves locomotion, such as MOVE and TRANSPORT Jobs, it will use the ClosestMEx module to retrieve the closest MEx instead. If a Job could be assigned, it is removed from the Pending Jobs list and passed along to the Job Refiner and a call is send to the MEx Sentinel service to update the allocated MEx’s state. The Job Refiner takes in the (rough) Job and further refines it based on the allocated MEx. It then starts the Job and calls the MEx Sentinel service to update the MEx state once more. Finally the Job is appended to the Active Jobs list.
-
JobManager.JobActivation.
job_allocator
(pending_jobs_list, active_jobs_list, mexs_list)[source]¶ Job Allocator function. Check Pending Jobs list and MExs list to assign a Job to a MEx.
Loops through the Pending Jobs list, finds the first pending Job and matches it with an available MEx (Up to date mex_list retrieved from MEx Sentinel service). If succesful, it removes this Job from the Pending Jobs list and passes it along to the Job Refiner, sends an update to the MEx Sentinel to update the allocated MEx state. If unsuccesful it returns None. Should be called/triggered whenever a change is made to either list.
-
JobManager.JobActivation.
job_refiner
(active_jobs_list, mexs_list, rough_job)[source]¶ Job Refiner function. Takes in a rough job and based on the allocated MEx refines the Jobs Tasks to match MEx attributes. Starts the Job, sends update to the MEx Sentinel to update the MEx state and then adds the refined Job to the Active Jobs list.
JobManager.JobBuilder module¶
The Job Builder module is used by the Job Manager ROS node and contains the job_builder function. This function takes in orders from the order list and builds Job class instances with Task class instances based on the order type and attributes. It then appends these Job instances to the Pending Jobs list.
-
JobManager.JobBuilder.
job_builder
(pending_jobs_list, order, job_index, location_dict, completion_cb)[source]¶ Job Builder Takes in order consisting of: keyword, priority and arguments; and creates a Job class instance containing Task class instances depening on the keyword and arguments. Then inserts/appends the Job to the Pending Jobs list depening on the priority.
JobManager.JobServiceMethods module¶
The Job Service Methods module contains the functions used by the Job Manager to call the services as hosted by the MEx Sentinel. It contains functions for calling the following services:
- get_mex_list
- assign_job_to_mex
- unassign_job_from_mex
- change_mex_status
-
JobManager.JobServiceMethods.
call_assign_job
(job_id, mex_id)[source]¶ Function to send an update to the MEx Sentinel to assign a Job to an MEx.
-
JobManager.JobServiceMethods.
call_change_mex_status
(mex_id, status)[source]¶ Function to send an update to the MEx Sentinel to update an MEx’s status.
JobManager.Location module¶
The Location module is used by the Job Manager ROS node as a means to store the information for each location in a Location class instance. Each Location instance has an unique ID, name, position and orientation.
JobManager.MobileExecutor module¶
The MobileExecutor module is used by the Job Manager and MEx Sentinel ROS nodes to store information on Mobile Executors (MExs) in MobileExecutor class instances. Each instance has an unique MEx ID, MEx Status and Job ID. Additionally, the MEx Status class is defined in this module as an enumerator.
JobManager.Order module¶
The Order module contains definitions for several enumerator types; the Order Response status, the Order keyword and the Order argument count.
Note: The ‘FOLLOW’ OrderKeyword and OrderTypeArgCount are not actively implemented.
-
class
JobManager.Order.
OrderKeyword
[source]¶ Bases:
enum.Enum
Class that acts as Enumerator for Order keywords.
-
FOLLOW
= 2¶
-
LOAD
= 3¶
-
MOVE
= 1¶
-
TRANSPORT
= 0¶
-
UNLOAD
= 4¶
-
JobManager.Tasks module¶
The Tasks module is used by the Job Manager ROS node and Job module to store information and status of Tasks as class instances. Each Task has its own class, which inherits from a base Task class. For more information on each class see the descriptions below. Next to the Task classes the module also contains class definitions for the Task Type and Task Status enumerators.
-
class
JobManager.Tasks.
AwaitingLoadCompletion
[source]¶ Bases:
JobManager.Tasks.Task
Task class: AwaitingLoadCompletion, waits for input from user or system to mark loading of the MEx as succeeded, cancelled, aborted. Used by the higher level Job class to populate a list with its job tasks.
-
class
JobManager.Tasks.
AwaitingUnloadCompletion
[source]¶ Bases:
JobManager.Tasks.AwaitingLoadCompletion
Task class: AwaitingUnloadCompletion, waits for input from user or system to mark unloading of the MEx as succeeded, cancelled, aborted. Used by the higher level Job class to populate a list with its job tasks. Inherets from AwaitingLoadCompletion.
-
class
JobManager.Tasks.
RobotMoveBase
(location)[source]¶ Bases:
JobManager.Tasks.Task
Task class: RobotMoveBase, implements move_base action calls to robot navigation stack. Used by the higher level Job class to populate a list with its job tasks.
-
done_cb
(status, result)[source]¶ Callback for stopping of goal. Connected to actionlib send_goal call. move_base callback status options: PENDING=0, ACTIVE=1, PREEMPTED=2, SUCCEEDED=3, ABORTED=4, REJECTED=5, PREEMPTING=6, RECALLING=7, RECALLED=8, LOST=9.
-
feedback_cb
(feedback)[source]¶ Callback for continuous feedback of move_base position. Connected to actionlib send_goal call.
-
-
class
JobManager.Tasks.
Task
(tasktype, child_start)[source]¶ Bases:
object
Base class from which specific child task classes inherit.