Handlers¶
Pose¶
basicSimPose.py - 2D Pose provider for basicSimulator¶
NullPose.py - Pose Handler for single region without Vicon¶
Drive¶
differentialDrive.py - Differential Drive Handler¶
Converts a desired global velocity vector into translational and rotational rates for a differential-drive robot, using feedback linearization.
Motion Control¶
heatController.py - Potential Field Region-to-Region Motion Control¶
Uses the heat-controller to take a current position, current region, and destination region and return a global velocity vector that will help us get there
- class handlers.motionControl.heatController.motionControlHandler(proj, shared_data)¶
- get_controller(current, next, last, cache={})¶
Wrapper for the controller factory, with caching.
- gotoRegion(current_reg, next_reg, last=False)¶
If last is true, we will move to the center of the region.
Returns True if we are outside the supposed current_reg
vectorController.py - Vector Addition Motion Controller¶
Uses the vector field algorithm developed by Stephen R. Lindemann to calculate a global velocity vector to take the robot from the current region to the next region, through a specified exit face.
RRTController.py - Rapidly-Exploring Random Trees Motion Controller¶
Uses Rapidly-exploring Random Tree Algorithm to generate paths given the starting position and the goal point.
- class handlers.motionControl.RRTController.motionControlHandler(proj, shared_data, robot_type, max_angle_goal, max_angle_overlap, plotting)¶
- buildTree(p, theta, regionPoly, nextRegionPoly, q_gBundle, face_normal, last=False)¶
This function builds the RRT tree. p : x,y position of the robot theta : current orientation of the robot regionPoly : current region polygon nextRegionPoly : next region polygon q_gBundle : coordinates of q_goals that the robot can reach face_normal : the normal vector of each face corresponding to each goal point in q_gBundle
- createRegionPolygon(region, hole=None)¶
This function takes in the region points and make it a Polygon.
- data_gen()¶
- generateNewNode(V, V_theta, E, Other, regionPoly, stuck, append_after_latest_node=False)¶
Generate a new node on the current tree matrix V : the node matrix V_theta : the orientation matrix E : the tree matrix (or edge matrix) Other : the matrix containing the velocity and angular velocity(omega) information regionPoly: the polygon of current region stuck : count on the number of times failed to generate new node append_after_latest_node : append new nodes to the latest node (True only if the previous node addition is successful)
- getNode(p, V, E, last=False)¶
This function calculates the velocity for the robot with RRT. The inputs are (given in order):
p = the current x-y position of the robot
E = edges of the tree (2 x No. of nodes on the tree) V = points of the tree (2 x No. of vertices) last = True, if the current region is the last region
= False, if the current region is NOT the last region
- getVelocity(p, V, E, last=False)¶
This function calculates the velocity for the robot with RRT. The inputs are (given in order):
p = the current x-y position of the robot E = edges of the tree (2 x No. of nodes on the tree) V = points of the tree (2 x No. of vertices) last = True, if the current region is the last region
= False, if the current region is NOT the last region
- gotoRegion(current_reg, next_reg, last=False)¶
If last is True, we will move to the center of the destination region. Returns True if we’ve reached the destination region.
- jplot()¶
- orientation_bound(theta)¶
make sure the returned angle is between 0 to 2*pi
- plotMap(mappedRegions)¶
Plotting regions and obstacles with matplotlib.pyplot
number: figure number (see on top)
- plotPoly(c, string, w=1)¶
Plot polygons inside the boundary c = polygon to be plotted with matlabplot string = string that specify color w = width of the line plotting
Robot-specific handlers¶
TODO