Migrating from Spatial_v1 to Spatial_v2
Spatial_v2 is not backward-compatible
with spatial_v1. Therefore, if you want to port code
from one to the other then a certain amount of editing is required. A
detailed list of changes appears below; but first, here are the main
differences between the two versions:
- planar-vector functions have been folded into their spatial-vector
counterparts, and
- animation is now done within Matlab
In spatial_v1, there were separate functions for spatial and
planar arithmetic. For example, crfp was the planar version
of crf, and IDp was the planar version of ID.
In spatial_v2, the planar functions no longer exist, and the
spatial functions now implement both spatial and planar arithmetic.
Also, the planar version of the system-model data structure no longer exists,
and a single data structure now caters for both types of arithmetic.
The old animation facility relied on a separate program,
called SceneViewer, which was part of an old graphics package
called OpenInventor. A function called drawmodel would
create a text file containing drawing instructions expressed in
OpenInventor's language, and run SceneViewer to display
them. Spatial_v2 comes with a new animator,
called showmotion, that uses Matlab's
handle graphics to display animations directly, thereby eliminating the
dependence on an external graphics program. There have also been several
changes to the format of drawing instructions.
Three more changes worth noting are that (1) non-default gravity must now be
specified as a field in the system-model data structure, rather than as an
argument to the dynamics functions; (2) external forces are now expressed in
absolute coordinates (=fixed-base coordinates), rather than link coordinates;
and (3) the floating-base functions now use a quaternion, rather than a
spatial coordinate transform, to represent the orientation of the floating
base.
Changes to Functions and Data Structures
The table below sets out the changes you will have to make in order to port
your code from spatial_v1
to spatial_v2. Note: where a
function is marked as 'no change', this does not mean that the function itself
has not changed; rather, it means that you do not have to make any changes to
your code.
Spatial Vector Arithmetic |
crf |
no change |
crm |
no change |
mcI |
no change |
Xrotx |
name changed to rotx |
Xroty |
name changed to roty |
Xrotz |
name changed to rotz |
XtoV |
no change |
Xtrans |
name changed to xlt |
|
|
Dynamics Functions |
fbKin |
replaced by fbkin which takes different arguments |
FDab |
no gravity argument; f_ext now in absolute coordinates |
FDcrb |
no gravity argument; f_ext now in absolute coordinates |
FDf |
name changed to FDfb; return value afb replaced
with xdfb; arguments Xfb and vfb replaced
with xfb; no gravity argument; f_ext now in absolute
coordinates |
HandC |
no gravity argument; f_ext now in absolute coordinates |
HD |
no gravity argument; f_ext now in absolute coordinates |
ID |
no gravity argument; f_ext now in absolute coordinates |
IDf |
name changed to IDfb; return value afb replaced
with xdfb; arguments Xfb and vfb replaced
with xfb; no gravity argument; f_ext now in absolute
coordinates |
jcalc |
pitch argument replaced with joint type descriptor |
|
|
Model Constructors |
autoTree |
no change |
floatbase |
no change |
planar2 |
withdrawn. Use planar(2) for an equivalent model using
planar arithmetic, or autoTree(2) for a model using spatial
arithmetic but having slightly different inertias |
planar3 |
withdrawn. Use planar(3) for an equivalent model using
planar arithmetic, or autoTree(3) for a model using spatial
arithmetic but having slightly different inertias |
planarN |
withdrawn. Use planar(n) for an equivalent model using
planar arithmetic, or autoTree(n) for a model using spatial
arithmetic but having slightly different inertias |
|
|
Planar Vector Arithmetic |
crfp |
use crf instead |
crmp |
use crm instead |
mcIp |
use mcI instead |
Xpln |
name changed to plnr |
XtoVp |
use XtoV instead |
|
|
Planar Vector Dynamics Functions |
FDabp |
use FDab instead, but note that arguments differ |
FDcrbp |
use FDcrb instead, but note that arguments differ |
HandCp |
use HandC instead, but note that arguments differ |
IDp |
use ID instead, but note that arguments differ |
jcalcp |
use jcalc instead, but note that arguments differ |
|
|
Planar Vector Model Constructors |
autoTreep |
withdrawn |
|
|
Graphics |
drawmodel |
replaced by showmotion |
|
|
Examples (demos) |
planar2ctrl.mdl |
replaced by example1.mdl |
test_FD |
withdrawn |
test_HD |
withdrawn |
test_fb1 |
withdrawn |
test_fb2 |
withdrawn |
test_p |
withdrawn |
|
|
Branch Induced Sparsity |
expandLambda |
no change |
LTDL |
no change |
LTL |
no change |
mpyH |
no change |
mpyL |
no change |
mpyLt |
no change |
mpyLi |
no change |
mpyLit |
no change |
|
|
System Model Data Structure |
NB |
no change |
parent |
no change |
pitch |
replaced by jtype |
Xtree |
no change |
I |
no change |
appearance |
many changes — see below |
[gravity] |
non-default gravity is now specified in the system model instead of as
an argument to the dynamics functions |
|
|
Planar System Model Data Structure |
NB |
no change |
parent |
no change |
jcode |
replaced by jtype |
Xtree |
no change |
I |
no change |
[gravity] |
non-default gravity is now specified in the system model instead of as
an argument to the dynamics functions |
|
Changes to Appearance Field
- the drawing instructions that used to appear in appearance{1} now
appear in appearance.base
- the drawing instructions that used to appear in appearance{i+1}
now appear in appearance.body{i}
Changes to Drawing Instructions
- {'box',A} becomes 'box',B, where B=A'
- {'cyl',c,r,h,'X/Y/Z'} becomes 'cyl',[p1;p2],r,
where p1 and p2 are row vectors containing the coordinates
of the centres of the two end faces of the cylinder
- {'vertex',V} becomes 'vertices',V
- {'line',L} becomes 'line',L
- {'face',F1,F2,...} can be replaced by 'triangles',T, where
T is an n×3 matrix of vertex numbers such that each row
of T defines one triangle
Page last modified: June 2012
Author: Roy Featherstone