analyze.mocap: This function performs motion capture data analysis based on...

Description Usage Arguments Value Examples

Description

This procedure detects highest differences between reference and input mocap recording. Analysis goes as follows:

Usage

1
2
analyze.mocap(data.configuration, ref.d = NULL, in.d = NULL,
  extremumthreshold = 0.66, smoothSize = 0.1)

Arguments

data.configuration

a list containing configuration for the algorithm. Each element of the list is a list with following elements (all elements are obligatory):

  • x1 - reference signal for DTW (vectors list),

  • x2 - second signal for DTW (vectors list),

  • FUN - distance function for DTW, use euc.dist or euc.dist1d, however you can define any function that can operates on x1 and x2,

  • ylab - label on Y axis of the results plot,

  • legend - part of the legend over plots,

  • plotRGL - name of the body joint for which DTW alignment of x1 and x2 will be drawn. It will be 3D rgl plot. If plotRGL = NULL plot will not be drawn.

  • skeleton - object of class mocap. It is used to get joints relations while plotting RGL plot.

ref.d

data frame with reference mocap data (default is ref.d=NULL). It is used to get joints relations while plotting RGL plot.

in.d

data frame with reference mocap data (default is in.d=NULL). It is used to get joints relations while plotting RGL plot.

extremumthreshold

threshold from range [0,1], that is used to remove local extreme, which relative value is below extremumthreshold (default value is extremumthreshold=0.66).

smoothSize

size of the Gaussian smoothing window. Default value is smoothSize = 0.1.

Value

a list containing data.configuration parameters plus algorihm results

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
########################
#analyze upper body data
########################
data(right.arm.motion.1)
data(right.arm.motion.2)

refdata <- right.arm.motion.1$data.frame
inputdata <- right.arm.motion.2$data.frame

extremumthreshold <- 0.66
smoothSize <- 0.1

inputdataalignment <- rotatedata(inputdata, refdata, "LeftShoulder","RightShoulder")
inputdataalignmentkinematic <- calculate.kinematic(inputdataalignment, bodypartname = "LeftShoulder")
refdatakinematic <- calculate.kinematic(refdata, bodypartname = "LeftShoulder")
inputdataalignmentkinematic <- aligninputandrefdata(inputdataalignmentkinematic, refdatakinematic, limbname = "LeftShoulder")

data.configuration <- list()
data.configuration[[1]] <- list(x1 = vector.to.list(refdatakinematic, "RightHand"),
   x2 = vector.to.list(inputdataalignmentkinematic, "RightHand"),
   FUN = euc.dist,
   ylab = "Distance [cm]",
   legend = "RightHand",
   plotRGL = "RightHand",
   skeleton = right.arm.motion.1)

data.configuration[[2]] <- list(x1 = vector.to.angles.list(refdatakinematic, "RightShoulder", "RightArm", "RightForearm"),
   x2 = vector.to.angles.list(inputdataalignmentkinematic, "RightShoulder", "RightArm", "RightForearm"),
   FUN = euc.dist1d,
   ylab = "Angle [rad]",
   legend = "Right elbow",
   plotRGL = NULL,
   skeleton = NULL)

x1 <- vector.to.angles.frame.list(refdatakinematic, "RightArm", "RightForearm", "RightShoulder", "LeftShoulder")
x2 <- vector.to.angles.frame.list(inputdataalignmentkinematic, "RightArm", "RightForearm", "RightShoulder", "LeftShoulder")

data.configuration[[3]] <- list(x1 = x1[[1]],
   x2 = x2[[1]],
   FUN = euc.dist1d,
   ylab = "Angle [rad]",
   legend = "X angle between RightArm and RightForearm",
   plotRGL = NULL,
   skeleton = NULL)

data.configuration[[4]] <- list(x1 = x1[[2]],
   x2 = x2[[2]],
   FUN = euc.dist1d,
   ylab = "Angle [rad]",
   legend = "Y angle between RightArm and RightForearm",
   plotRGL = NULL,
   skeleton = NULL)

data.configuration[[5]] <- list(x1 = x1[[3]],
   x2 = x2[[3]],
   FUN = euc.dist1d,
   ylab = "Angle [rad]",
   legend = "Z angle between RightArm and RightForearm",
   plotRGL = NULL,
   skeleton = NULL)

res <- analyze.mocap(data.configuration,
refdatakinematic,
inputdataalignmentkinematic,
extremumthreshold,
smoothSize)

########################
#analyze lower body data
########################
data(mawashi.geri.left.1)
data(mawashi.geri.left.2)

refdata <- mawashi.geri.left.1$data.frame
inputdata <- mawashi.geri.left.2$data.frame
extremumthreshold <- 0.66
smoothSize <- 0.1

inputdataalignment <- rotatedata(inputdata, refdata, "LeftThigh","RightThigh")
inputdataalignmentkinematic <- calculate.kinematic(inputdataalignment, bodypartname = "RightFoot")
refdatakinematic <- calculate.kinematic(refdata, bodypartname = "RightFoot")
inputdataalignmentkinematic <- aligninputandrefdata(inputdataalignmentkinematic, refdatakinematic, limbname = "RightFoot")

data.configuration <- list()
data.configuration[[1]] <- list(x1 = vector.to.list(refdatakinematic, "LeftFoot"),
 x2 = vector.to.list(inputdataalignmentkinematic, "LeftFoot"),
 FUN = euc.dist,
 ylab = "Distance [cm]",
  legend = "LeftFoot",
  plotRGL = "LeftFoot",
  skeleton = mawashi.geri.left.1)

data.configuration[[2]] <- list(x1 = vector.to.angles.list(refdatakinematic, "LeftThigh", "LeftLeg", "LeftFoot"),
  x2 = vector.to.angles.list(inputdataalignmentkinematic, "LeftThigh", "LeftLeg", "LeftFoot"),
  FUN = euc.dist1d,
  ylab = "Angle [rad]",
  legend = "Left knee",
  plotRGL = NULL)

x1 <- vector.to.angles.frame.list(refdatakinematic, "LeftThigh", "LeftLeg", "LeftThigh","RightThigh")
x2 <- vector.to.angles.frame.list(inputdataalignmentkinematic, "LeftThigh", "LeftLeg", "LeftThigh","RightThigh")

data.configuration[[3]] <- list(x1 = x1[[1]],
  x2 = x2[[1]],
  FUN = euc.dist1d,
  ylab = "Angle [rad]",
  legend = "X angle between LeftThigh and LeftLeg",
  plotRGL = NULL)

data.configuration[[4]] <- list(x1 = x1[[2]],
  x2 = x2[[2]],
  FUN = euc.dist1d,
  ylab = "Angle [rad]",
  legend = "Y angle between LeftThigh and LeftLeg",
  plotRGL = NULL)

data.configuration[[5]] <- list(x1 = x1[[3]],
  x2 = x2[[3]],
  FUN = euc.dist1d,
  ylab = "Angle [rad]",
  legend = "Z angle between LeftThigh and LeftLeg",
  plotRGL = NULL)

res <- analyze.mocap(data.configuration,
refdatakinematic,
inputdataalignmentkinematic,
extremumthreshold,
smoothSize)

browarsoftware/RMoCap documentation built on May 16, 2019, 7:28 a.m.