Skip to content

Commit 678a25a

Browse files
committed
Update doco, add refs, examples, clarify.
1 parent 6ec4f8f commit 678a25a

30 files changed

+240
-175
lines changed

PGraph.m

+56-29
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,73 @@
55
%
66
% Provides support for graphs that:
77
% - are directed
8-
% - are embedded in a coordinate system
8+
% - are embedded in a coordinate system (2D or 3D)
9+
% - have multiple unconnected components
910
% - have symmetric cost edges (A to B is same cost as B to A)
1011
% - have no loops (edges from A to A)
11-
% - have vertices that are represented by integers VID
12-
% - have edges that are represented by integers EID
12+
%
13+
% Graph representation:
14+
% - vertices are represented by integer vertex ids (vid)
15+
% - edges are represented by integer edge ids (eid)
16+
% - each vertex can have arbitrary associated data
17+
% - each edge can have arbitrary associated data
1318
%
1419
% Methods::
1520
%
1621
% Constructing the graph::
17-
% g.add_node(coord) add vertex, return vid
18-
% g.add_edge(v1, v2) add edge from v1 to v2, return eid
19-
% g.setcost(e, c) set cost for edge e
20-
% g.setdata(v, u) set user data for vertex v
21-
% g.data(v) get user data for vertex v
22+
% g.add_node(coord) add vertex
23+
% g.add_edge(v1, v2) add edge fbetween vertices
24+
% g.setcost(e, c) set cost for edge
25+
% g.setedata(e, u) set user data for edge
26+
% g.setvdata(v, u) set user data for vertex
27+
%
28+
% Modifying the graph::
2229
% g.clear() remove all vertices and edges from the graph
30+
% g.delete_edge(e) remove edge
31+
% g.delete_node(v) remove vertex
32+
% g.setcoord(v) set coordinate of vertex
2333
%
2434
% Information from graph::
25-
% g.edges(v) list of edges for vertex v
26-
% g.cost(e) cost of edge e
27-
% g.neighbours(v) neighbours of vertex v
28-
% g.component(v) component id for vertex v
29-
% g.connectivity() number of edges for all vertices
35+
% g.about() summary information about node
36+
% g.component(v) component id for vertex
37+
% g.componentnodes(c) vertices in component
38+
% g.connectivity() number of edges for all vertices
39+
% g.connectivity_in() number of incoming edges for all vertices
40+
% g.connectivity_out() number of outgoing edges for all vertices
41+
% g.coord(v) coordinate of vertex
42+
% g.cost(e) cost of edge
43+
% g.distance_metric(v1,v2) distance between nodes
44+
% g.edata(e) get edge user data
45+
% g.edgedir(v1,v2) direction of edge
46+
% g.edges(v) list of edges for vertex
47+
% g.edges_in(v) list of edges into vertex
48+
% g.edges_out(v) list of edges from vertex
49+
% g.lookup(name) vertex from name
50+
% g.name(v) name of vertex
51+
% g.neighbours(v) neighbours of vertex
52+
% g.neighbours_d(v) neighbours of vertex and edge directions
53+
% g.neighbours_in(v) neighbours with edges in
54+
% g.neighbours_out(v) neighbours with edges out
55+
% g.samecomponent(v1,v2) test if vertices in same component
56+
% g.vdata(v) vertex user data
57+
% g.vertices(e) vertices for edge
3058
%
3159
% Display::
3260
%
33-
% g.plot() set goal vertex for path planning
34-
% g.highlight_node(v) highlight vertex v
35-
% g.highlight_edge(e) highlight edge e
36-
% g.highlight_component(c) highlight all nodes in component c
37-
% g.highlight_path(p) highlight nodes and edge along path p
38-
%
39-
% g.pick(coord) vertex closest to coord
40-
%
4161
% g.char() convert graph to string
4262
% g.display() display summary of graph
63+
% g.highlight_node(v) highlight vertex
64+
% g.highlight_edge(e) highlight edge
65+
% g.highlight_component(c) highlight all nodes in component
66+
% g.highlight_path(p) highlight nodes and edge along path
67+
% g.pick(coord) vertex closest to coord
68+
% g.plot() plot graph
69+
%
4370
%
4471
% Matrix representations::
4572
% g.adjacency() adjacency matrix
46-
% g.incidence() incidence matrix
4773
% g.degree() degree matrix
74+
% g.incidence() incidence matrix
4875
% g.laplacian() Laplacian matrix
4976
%
5077
% Planning paths through the graph::
@@ -53,17 +80,17 @@
5380
% g.path(v) list of vertices from v to goal
5481
%
5582
% Graph and world points::
83+
% g.closest(coord) vertex closest to coord
5684
% g.coord(v) coordinate of vertex v
5785
% g.distance(v1, v2) distance between v1 and v2
5886
% g.distances(coord) return sorted distances from coord to all vertices
59-
% g.closest(coord) vertex closest to coord
6087
%
6188
% Object properties (read only)::
6289
% g.n number of vertices
6390
% g.ne number of edges
6491
% g.nc number of components
6592
%
66-
% Examples::
93+
% Example::
6794
% g = PGraph();
6895
% g.add_node([1 2]'); % add node 1
6996
% g.add_node([3 4]'); % add node 1
@@ -74,7 +101,8 @@
74101
% g.plot()
75102
%
76103
% Notes::
77-
% - Support for edge direction is rudimentary.
104+
% - Support for edge direction is quite simple.
105+
% - The method distance_metric() could be redefined in a subclass.
78106

79107
% Copyright (C) 1993-2019 Peter I. Corke
80108
%
@@ -462,7 +490,7 @@ function clear(g)
462490
function c = connectivity_in(g,n )
463491
%PGraph.connectivity Graph connectivity
464492
%
465-
% C = G.connectivity() is a vector (Nx1) with the number of edges per
493+
% C = G.connectivity() is a vector (Nx1) with the number of incoming edges per
466494
% vertex.
467495
%
468496
% The average vertex connectivity is
@@ -483,7 +511,7 @@ function clear(g)
483511
function c = connectivity_out(g,n )
484512
%PGraph.connectivity Graph connectivity
485513
%
486-
% C = G.connectivity() is a vector (Nx1) with the number of edges per
514+
% C = G.connectivity() is a vector (Nx1) with the number of outgoing edges per
487515
% vertex.
488516
%
489517
% The average vertex connectivity is
@@ -790,8 +818,7 @@ function colorComponent(g, v, l)
790818
function v = componentnodes(g, c)
791819
%PGraph.component Graph component
792820
%
793-
% C = G.component(V) is the id of the graph component that contains vertex
794-
% V.
821+
% C = G.component(V) are the ids of all vertices in the graph component V.
795822
v = find(g.labels == c);
796823
end
797824

SE3.m

+22-14
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@
220220
% (T)
221221
for i=1:length(a)
222222
obj(i).data = a(i).data;
223-
end
224-
223+
end
225224
elseif numcols(a) == 3
226225
% SE3( xyz )
227226
for i=1:length(a)
@@ -359,9 +358,12 @@
359358
function T = increment(obj, v)
360359
%SE3.increment Apply incremental motion to an SE3 pose
361360
%
362-
% P1 = P.increment(d) is an SE3 pose object formed by applying the
363-
% incremental motion vector d (1x6) in the frame associated with SE3 pose
364-
% P.
361+
% P1 = P.increment(D) is an SE3 pose object formed by compounding the
362+
% SE3 pose with the incremental motion described by D (6x1).
363+
%
364+
% The vector D=(dx, dy, dz, dRx, dRy, dRz) represents infinitessimal translation
365+
% and rotation, and is an approximation to the instantaneous spatial velocity
366+
% multiplied by time step.
365367
%
366368
% See also SE3.todelta, DELTA2TR, TR2DELTA.
367369
T = obj .* SE3(delta2tr(v));
@@ -635,13 +637,17 @@ R zeros(3,3)
635637
end
636638

637639
function d = todelta(P1, P2)
638-
%SE3.todelta Convert SE(3) object to differential motion vector
640+
%SE3.todelta Convert SE3 object to differential motion vector
639641
%
640-
% D = SE3.todelta(P0, P1) is the (6x1) differential motion vector (dx, dy,
641-
% dz, dRx, dRy, dRz) corresponding to infinitessimal motion (in the P0
642-
% frame) from SE(3) pose P0 to P1. .
642+
% D = P0.todelta(P1) is the differential motion (6x1) corresponding to
643+
% infinitessimal motion (in the P0 frame) from SE3 pose P0 to P1.
643644
%
644-
% D = SE3.todelta(P) as above but the motion is with respect to the world frame.
645+
% The vector D=(dx, dy, dz, dRx, dRy, dRz) represents infinitessimal translation
646+
% and rotation, and is an approximation to the instantaneous spatial velocity
647+
% multiplied by time step.
648+
%
649+
% D = P.todelta() as above but the motion is from the world frame to the SE3
650+
% pose P.
645651
%
646652
% Notes::
647653
% - D is only an approximation to the motion, and assumes
@@ -890,12 +896,14 @@ R zeros(3,3)
890896
end
891897

892898
function obj = delta(d)
893-
%SE3.delta SE3 object from differential motion vector
899+
%SE3.delta Construct SE3 object from differential motion vector
894900
%
895901
% T = SE3.delta(D) is an SE3 pose object representing differential
896-
% translation and rotation. The vector D=(dx, dy, dz, dRx, dRy, dRz)
897-
% represents an infinitessimal motion, and is an approximation to the spatial
898-
% velocity multiplied by time.
902+
% motion D (6x1).
903+
%
904+
% The vector D=(dx, dy, dz, dRx, dRy, dRz) represents infinitessimal translation
905+
% and rotation, and is an approximation to the instantaneous spatial velocity
906+
% multiplied by time step.
899907
%
900908
% See also SE3.todelta, SE3.increment, TR2DELTA.
901909

angdiff.m

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
%ANGDIFF Difference of two angles
22
%
3-
% ANGDIFF(TH1, TH2) is the difference between angles TH1 and TH2
3+
% ANGDIFF(TH1, TH2) is the difference between angles TH1 and TH2, ie. TH1-TH2
44
% on the circle. The result is in the interval [-pi pi). Either or both
55
% arguments can be a vector:
66
% - If TH1 is a vector, and TH2 a scalar then return a vector where TH2 is modulo
77
% subtracted from the corresponding elements of TH1.
88
% - If TH1 is a scalar, and TH2 a vector then return a vector where the
99
% corresponding elements of TH2 are modulo subtracted from TH1.
1010
% - If TH1 and TH2 are vectors then return a vector whose elements are the modulo
11-
% difference of the corresponding elements of TH1 and TH2.
11+
% difference of the corresponding elements of TH1 and TH2, which must be the
12+
% same length.
1213
%
1314
% ANGDIFF(TH) as above but TH=[TH1 TH2].
1415
%
15-
% ANGDIFF(TH) is the equivalent angle to TH in the interval [-pi pi).
16+
% ANGDIFF(TH) is the equivalent angle to the scalar TH in the interval [-pi pi).
1617
%
1718
% Notes::
19+
% - The MathWorks Robotics Systems Toolbox defines a function with the same name
20+
% which computes TH2-TH1 rather than TH1-TH2.
1821
% - If TH1 and TH2 are both vectors they should have the same
1922
% orientation, which the output will assume.
2023
%

angvec2r.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
% equivalent to a rotation of THETA about the vector V.
55
%
66
% Notes::
7-
% - If THETA == 0 then return identity matrix.
7+
% - Uses Rodrigues' formula
8+
% - If THETA == 0 then return identity matrix and ignore V.
89
% - If THETA ~= 0 then V must have a finite length.
910
%
1011
% See also angvec2tr, eul2r, rpy2r, tr2angvec, trexp, SO3.angvec.

angvec2tr.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
% rotation of THETA about the vector V.
55
%
66
% Note::
7+
% - Uses Rodrigues' formula
78
% - The translational part is zero.
8-
% - If THETA == 0 then return identity matrix.
9+
% - If THETA == 0 then return identity matrix and ignore V.
910
% - If THETA ~= 0 then V must have a finite length.
1011
%
1112
% See also angvec2r, eul2tr, rpy2tr, angvec2r, tr2angvec, trexp, SO3.angvec.

chi2inv_rtb.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%CHI2INV_RTB Inverse chi-squared function
22
%
3-
% X = CHI2INV_RTB(P, N) is the inverse chi-squared cdf function of N-degrees of freedom.
3+
% X = CHI2INV_RTB(P, N) is the inverse chi-squared CDF function of N-degrees of freedom.
44
%
55
% Notes::
66
% - only works for N=2

circle.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
% axes.
55
%
66
% X = CIRCLE(C, R, OPTIONS) is a matrix (2xN) whose columns define the
7-
% coordinates [x,y] of points around the circumferance of a circle
7+
% coordinates [x,y] of points around the circumference of a circle
88
% centred at C (1x2) and of radius R.
99
%
10-
% C is normally 2x1 but if 3x1 then the circle is embedded in 3D, and X is Nx3,
11-
% but the circle is always in the xy-plane with a z-coordinate of C(3).
10+
% C is normally 2x1 but if 3x1 then the circle is embedded in 3D, and X is Nx3.
11+
% The circle is always in the xy-plane with a z-coordinate of C(3).
1212
%
1313
% Options::
1414
% 'n',N Specify the number of points (default 50)

delta2tr.m

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
%DELTA2TR Convert differential motion to a homogeneous transform
22
%
33
% T = DELTA2TR(D) is a homogeneous transform (4x4) representing differential
4-
% translation and rotation. The vector D=(dx, dy, dz, dRx, dRy, dRz)
5-
% represents an infinitessimal motion, and is an approximation to the spatial
6-
% velocity multiplied by time.
4+
% motion D (6x1).
5+
%
6+
% The vector D=(dx, dy, dz, dRx, dRy, dRz) represents infinitessimal translation
7+
% and rotation, and is an approximation to the instantaneous spatial velocity
8+
% multiplied by time step.
9+
%
10+
% Reference::
11+
% - Robotics, Vision & Control: Second Edition, P. Corke, Springer 2016; p67.
712
%
813
% See also tr2delta, SE3.delta.
914

e2h.m

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
% H = E2H(E) is the homogeneous version (K+1xN) of the Euclidean
44
% points E (KxN) where each column represents one point in R^K.
55
%
6+
% Reference::
7+
% - Robotics, Vision & Control: Second Edition, P. Corke, Springer 2016; p604.
8+
%
69
% See also H2E.
710

811
% Copyright (C) 1993-2019 Peter I. Corke

eul2jac.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
%EUL2JAC Euler angle rate Jacobian
22
%
3-
% J = EUL2JAC(PHI, THETA, PSI) is a Jacobian matrix (3x3) that maps Euler angle rates to
3+
% J = EUL2JAC(PHI, THETA, PSI) is a Jacobian matrix (3x3) that maps ZYZ Euler angle rates to
44
% angular velocity at the operating point specified by the Euler angles PHI, THETA, PSI.
55
%
66
% J = EUL2JAC(EUL) as above but the Euler angles are passed as a vector EUL=[PHI, THETA, PSI].
77
%
88
% Notes::
99
% - Used in the creation of an analytical Jacobian.
10+
% - Angles in radians, rates in radians/sec.
1011
%
11-
% See also rpy2jac, SerialLink.jacobe.
12+
% Reference::
13+
% - Robotics, Vision & Control: Second Edition, P. Corke, Springer 2016; p232-3.
14+
%
15+
% See also rpy2jac, eul2r, SerialLink.jacobe.
1216

1317
% Copyright (C) 1993-2019 Peter I. Corke
1418
%

h2e.m

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
% E = H2E(H) is the Euclidean version (K-1xN) of the homogeneous
44
% points H (KxN) where each column represents one point in P^K.
55
%
6+
% Reference::
7+
% - Robotics, Vision & Control: Second Edition, P. Corke, Springer 2016; p604.
8+
%
69
% See also E2H.
710

811
% Copyright (C) 1993-2019 Peter I. Corke

homtrans.m

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
% - P is 3xN (3D points) they are considered Euclidean (R^3)
1111
% - P is 4xN (3D points) they are considered projective (P^3)
1212
%
13+
% P2 and P have the same number of rows, ie. if Euclidean points are given
14+
% then Euclidean points are returned, if projective points are given then
15+
% projective points are returned.
16+
%
1317
% TP = HOMTRANS(T, T1) applies homogeneous transformation T to the
1418
% homogeneous transformation T1, that is TP=T*T1. If T1 is a 3-dimensional
1519
% transformation then T is applied to each plane as defined by the first two
16-
% dimensions, ie. if T = NxN and T1=NxNxM then the result is NxNxM.
20+
% dimensions, ie. if T is NxN and T1 is NxNxM then the result is NxNxM.
1721
%
1822
% Notes::
19-
% - T is a homogeneous transformation defining the pose of {B} with respect to {A}.
20-
% - The points are defined with respect to frame {B} and are transformed to be
23+
% - If T is a homogeneous transformation defining the pose of {B} with respect to {A},
24+
% then the points are defined with respect to frame {B} and are transformed to be
2125
% with respect to frame {A}.
2226
%
2327
% See also E2H, H2E, RTBPose.mtimes.

ishomog.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
% ISHOMOG(T) is true (1) if the argument T is of dimension 4x4 or 4x4xN, else
44
% false (0).
55
%
6-
% ISHOMOG(T, 'valid') as above, but also checks the validity of the rotation
6+
% ISHOMOG(T, 'check') as above, but also checks the validity of the rotation
77
% sub-matrix.
88
%
99
% Notes::
10+
% - A valid rotation sub-matrix has determinant of 1.
1011
% - The first form is a fast, but incomplete, test for a transform is SE(3).
1112
%
1213
% See also ISROT, ISHOMOG2, ISVEC.

ishomog2.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
% ISHOMOG2(T) is true (1) if the argument T is of dimension 3x3 or 3x3xN, else
44
% false (0).
55
%
6-
% ISHOMOG2(T, 'valid') as above, but also checks the validity of the rotation
6+
% ISHOMOG2(T, 'check') as above, but also checks the validity of the rotation
77
% sub-matrix.
88
%
99
% Notes::
10+
% - A valid rotation sub-matrix has determinant of 1.
1011
% - The first form is a fast, but incomplete, test for a transform in SE(3).
1112
%
1213
% See also ISHOMOG, ISROT2, ISVEC.

0 commit comments

Comments
 (0)