basic_robotics.general.faser_general module
General toolbox for mathematical functions.
- basic_robotics.general.faser_general.planeFromThreePoints(ref_point_1: tm, ref_point_2: tm, ref_point_3: tm)[source]
Create the equation of a plane from three points.
- Parameters:
ref_point_1 – tm or vector for point 1
ref_point_2 – tm or vector for point 2
ref_point_3 – tm or vector for point 3
- Returns:
a, b, c, d – equation cooficients of a plane
- basic_robotics.general.faser_general.planePointsFromTransform(ref_point_1: tm)[source]
Create plane TM points from one Transform (using unit vectors).
- Parameters:
ref_point_1 – transform to place plane on
- Returns:
a, b, c – Plane basis points
- basic_robotics.general.faser_general.mirror(origin: tm, mirror_point: tm) tm[source]
Mirror a point about a plane.
- Parameters:
origin – mirror plane (XY local to that tm)
mirror_point – tm describing point to be mirrored over plane
- Returns:
mirrored Point
- basic_robotics.general.faser_general.adjustRotationToMidpoint(active_point: tm, ref_point_1: tm, ref_point_2: tm, mode: int = 0) tm[source]
Appliy the midpoint transform of reference points 1 and 2 to an active point.
- Parameters:
- Returns:
tm – Modified version of active_point with orientation of vector 1 -> 2
- basic_robotics.general.faser_general.tmAvgMidpoint(ref_point_1, ref_point_2)[source]
Simplest version of a midpoint calculation. Simply the average of two positions.
- basic_robotics.general.faser_general.tmInterpMidpoint(ref_point_1, ref_point_2)[source]
Better version of midpoint calculation.
Position is stil average of positions 1 and 2 but rotation is calculated as a proper interpolation
- basic_robotics.general.faser_general.getSurfaceNormal(tri, object_center: tm = None)[source]
Return surface normal vector of set of three points.
- basic_robotics.general.faser_general.rotationFromVector(ref_point_1, ref_point_2)[source]
Reorient ref_point_1 such that its z axis is pointing towards ref_point_2.
looAt is faster and probably better except in colinear global Z cases. :param ref_point_1: position 1 :type ref_point_1: tm :param ref_point_2: position 2 :type ref_point_2: tm
- Returns:
tm – ref_point_1 where z points to position 2
- basic_robotics.general.faser_general.lookAt(ref_point_1, ref_point_2)[source]
Alternate version of RotFromVec, however rotation about z axis may be more random.
Does not depend on sci optimize fmin
- basic_robotics.general.faser_general.poseError(ref_point_1, ref_point_2)[source]
Provide absolute error between two transformations.
- basic_robotics.general.faser_general.geometricError(ref_point_1, ref_point_2)[source]
Provide geometric error between two points.
- basic_robotics.general.faser_general.distance(ref_point_1, ref_point_2)[source]
Calculate straight line distance between two points (2d or 3d (tm)).
- basic_robotics.general.faser_general.arcDistance(ref_point_1, ref_point_2)[source]
Calculate the arc distance between two points.
(magnitude average of geometric error)
- basic_robotics.general.faser_general.closeLinearGap(origin_point, goal_point, delta)[source]
Close linear gap between two points by delta amount.
- basic_robotics.general.faser_general.closeArcGap(origin_point, goal_point, delta)[source]
Close gap to goal using arc method instead of linear.
- basic_robotics.general.faser_general.IKPath(initial, goal, steps)[source]
Create a simple path from origin to goal with a given number of steps.
- basic_robotics.general.faser_general.angleBetween(ref_point_1, ref_point_2, ref_point_3)[source]
Calculate the interior angle between points 1, 2, and 3.
- basic_robotics.general.faser_general.makeWrench(position_applied, force, force_direction_vector, frame_applied=<basic_robotics.general.faser_transform.tm object>)[source]
Generate a new wrench.
- Parameters:
position_applied – relative position ation of wrench
force – magnitude of force applied (or mass if force_direction_vector is a gravity vector)
force_direction_vector – unit vector to apply force (or gravity)
frame_applied (tm, Optional) – frame of the wrench
- Returns:
wrench
- basic_robotics.general.faser_general.transformWrenchFrame(wrench, old_wrench_frame, new_wrench_frame)[source]
Translate one wrench frame to another.
- Parameters:
wrench – original wrench to be translated
old_wrench_frame – the original frame that the wrench was in (tm)
new_wrench_frame – the new frame that the wrench should be in (tm)
- Returns:
new Wrench in the frame of new_wrench_frame
- basic_robotics.general.faser_general.twistToGoal(start_transform, end_transform)[source]
Return a twist describing motion from start_transform to end_transform.
- basic_robotics.general.faser_general.twistToScrew(input_twist)[source]
Convert a twist to a screw.
- Parameters:
input_twist (ndarray) – Twist
- Returns:
ndarray – Screw representing twist
- basic_robotics.general.faser_general.normalizeTwist(twist)[source]
Normalize a Twist.
- Parameters:
tw (ndarray) – Input twist
- Returns:
ndarray – Normalized Twist
- basic_robotics.general.faser_general.twistFromTransform(input_transform)[source]
Create twist from transform (tm).
- Parameters:
input_transform (tm) – input transform
- Returns:
ndarray – twist representing transform
- basic_robotics.general.faser_general.transformFromTwist(input_twist)[source]
Convert a twist to a transformation matrix.
- Parameters:
input_twist (ndarray) – Input twist to be transformed
- Returns:
tm – Transform represented by twist
- basic_robotics.general.faser_general.transformByVector(transform, vec)[source]
Perform tv = TM*vec and removes the 1.
- Parameters:
transform (tm) – transform to operate on
vec (ndarray) – vector to multipy
- Returns:
ndarray – vector product
- basic_robotics.general.faser_general.fiboSphere(num_points)[source]
Create Fibonacci points on the surface of a sphere.
#https://stackoverflow.com/questions/9600801/evenly-distributing-n-points-on-a-sphere :param num_points: number of points
- Returns:
xyzcoords – points in cartesian coordinates
- basic_robotics.general.faser_general.unitSphere(num_points, return_azel=False)[source]
Generate a “unit sphere” with an approximate number of points.
numActual = round(num_points)^2 :param num_points: Approximate number of points to collect :param return_azel: Return Azimuth Elevation Coordinates Also
- Returns:
xyzcoords – points in cartesian coordinates azel: coords in azimuth/elevation notation
- basic_robotics.general.faser_general.getUnitVec(ref_point_1, ref_point_2, distance=1.0, return_dist=False)[source]
Return a vector of a given length pointed from point 1 to point 2.
- basic_robotics.general.faser_general.chainJacobian(screws, theta)[source]
Chain Jacobian.
- Parameters:
Screws – screw list
theta – theta to evaluate at
- Returns:
jac – chain jacobian
- basic_robotics.general.faser_general.numericalJacobian(function_handle, x_init, delta)[source]
Calculate a numerical jacobian.
- Parameters:
function_handle – function handle (FK)
x_init – initial value
delta – delta value
- Returns:
dfdx – numerical Jacobian
- basic_robotics.general.faser_general.boxSpatialInertia(m, l, w, h)[source]
Calculate spatial inertial properties of a box.
- basic_robotics.general.faser_general.setElements(data, inds, vals)[source]
Set the elements in data specified by inds with the values in vals.
- Parameters:
data (ndarray) – data to edit
inds (ndarray) – indexes of data to access
vals (ndarray) – new values to insert into the data
- Returns:
ndarray – modified data
- basic_robotics.general.faser_general.LocalToGlobal(reference, rel)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.GlobalToLocal(reference, rel)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.PlaneFrom3Tms(ref_point_1, ref_point_2, ref_point_3)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.PlaneTMSFromOne(ref_point_1)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.Mirror(origin, mirror_plane)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TMMidRotAdjust(active_point, ref_point_1, ref_point_2, mode=0)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TMMidPointEx(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TMMidPoint(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.RotFromVec(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.lookat(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.Error(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.GeometricError(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.Distance(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.ArcDistance(ref_point_1, ref_point_2)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.CloseGap(origin_point, goal_point, delta)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.ArcGap(origin_point, goal_point, delta)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.Deg2Rad(deg)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.Rad2Deg(rad)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.AngleMod(rad)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.AngleBetween(ref_point_1, ref_point_2, ref_point_3)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.GenForceWrench(position_applied, force, force_direction_vector)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TransformWrenchFrame(wrench, old_wrench_frame, new_wrench_frame)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TwistToScrew(input_twist)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.NormalizeTwist(twist)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TwistFromTransform(input_transform)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TransformFromTwist(input_twist)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.TrVec(transform, vec)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.ChainJacobian(screws, theta)[source]
Notify deprecated function. Please use indicated correct function.
- basic_robotics.general.faser_general.NumJac(f, x0, h)[source]
Notify deprecated function. Please use indicated correct function.