pykinematics.MimuAngles¶
-
class
pykinematics.
MimuAngles
(static_window=1.0, gravity_value=9.81, filter_values=None, angular_velocity_derivative_order=2, joint_center_kwargs=None, orientation_kwargs=None, correct_knee=True, knee_axis_kwargs=None, verbose=True)¶ Compute angles from MIMU sensors, from initial raw data through joint angles.
Parameters: - static_window : float, optional
Window size in seconds for which to use in calibration during static standing. Default is 1s.
- gravity_value : float, optional
Local gravitational acceleration. Default is 9.81m/s^2
- filter_values : {None, dict}, optional
Filter values for the inertial and magnetic field data. Default is None, which uses the default settings. Providing a dictionary with any of the values modified (ie don’t need to specify all 4) will changed the specific setting. Each entry is a length 2 tuple, containing first filter order, then cutoff frequency (Hz). Default settings and keys:
- ‘Acceleration’: (2, 15)
- ‘Angular velocity’: (2, 15)
- ‘Angular acceleration’: (2, 15)
- ‘Magnetic field’: (2, 15)
- angular_velocity_derivative_order : {2, 4}, optional
Order for the calculation of the angular velocity derivative. Default is 2 for 2nd order.
- joint_center_kwargs : {None, dict}, optional
Optional joint center computation key-word arguments, or None, for using the defaults. See
pykinematics.imu.joints.Center()
for the possible arguments. Default is None.- orientation_kwargs : {None, dict}, optional
Optional sensor relative orientation key-word arguments, or NOne, for using the defaults. See
pykinematics.imu.orientation.SSRO()
for the possible arguments. Default is None.- correct_knee : bool, optional
Correct the knee joint center location by shifting it along the rotation axis closer to the sensors. Default is True.
- knee_axis_kwargs : {None, dict}, optional
Optional knee-axis computation key-word arguments. See
pykinematics.imu.joints.KneeAxis()
for the possible arguments. Default is None- verbose : bool, optional
Print messages regarding the status of the estimation process. Default is True
Methods
calibrate
(self, static_data, joint_center_data)Calibration by computing the sensor-to-segment alignment. estimate
(self, task_data[, return_orientation])Estimate joint angles from data during a trial of interest. -
calibrate
(self, static_data, joint_center_data)¶ Calibration by computing the sensor-to-segment alignment.
Parameters: - static_data : dict
Dictionary of sensor data from a static standing trial. Must contain at least Lumbar, Left thigh, and Right thigh keys. Left shank and Right shank are suggested in order to provide an acceleration scale to ensure that the measured gravity vectors are equivalent between sensors. See Notes for the structure of the dictionary.
- joint_center_data : dict
Dictionary of sensor data from a task to be used for joint center computation. As such the task should have sufficient rotation about all possible axes (ie all 3 for the hip, 1 for the knee). Must contain Lumbar, thigh, and shank keys. See Notes.
Notes
Data dictionary key-level schematic:
- Lumbar
- Time [s]
- Acceleration [m/s^2]
- Angular velocity [rad/s]
- Magnetic field [not specified]
- Left thigh
- Time
- Acceleration
- Angular velocity
- Magnetic field
- Right thigh
- Time
- Acceleration
- Angular velocity
- Magnetic field
- (Left shank)
- Time
- Acceleration
- Angular velocity
- Magnetic field
- (Right shank)
- Time
- Acceleration
- Angular velocity
- Magnetic field
Attributes: - self.acc_scales : dict
Dictionary of acceleration scales for each of the sensors in static_data, required to scale acceleration magnitude to that of local gravitational acceleration during static standing
- self.pelvis_axis : numpy.ndarray
Pelvis fixed axis in the Lumbar sensor’s reference frame.
- self.l_thigh_axis : numpy.ndarray
Left thigh fixed axis in the left thigh’s reference frame.
- self.r_thigh_axis : numpy.ndarray
Right thigh fixed axis in the right thigh’s reference frame.
- self.pelvis_AF : tuple
Tuple of the x, y, and z anatomical axes for the pelvis, in the lumbar sensor frame.
- self.l_thigh_AF : tuple
Tuple of the x, y, and z anatomical axes for the left thigh, in the left thigh’s sensor frame.
- self.r_thigh_AF : tuple
Tuple of the x, y, and z anatomical axes for the right thigh, in the right thigh’s sensor frame.
-
estimate
(self, task_data, return_orientation=False)¶ Estimate joint angles from data during a trial of interest.
Parameters: - task_data : dict
Dictionary of data from a task to compute the hip joint angles for. Required keys/sensors are Lumbar, Left and Right thighs. See the Notes for ImuAngles.calibrate.
- return_orientation : bool, optional
Return the estimates of the relative orientation. Default is False.
Returns: - left_hip_angles : numpy.ndarray
(N, 3) array of hip angles for the left hip, in the order Flexion - Extension, Ad / Abduction, and Internal - External rotation.
- right_hip_angles : numpy.ndarray
(N, 3) array of hip angles for the right hip, in the order Flexion - Extension, Ad / Abduction, and Internal - External rotation.
- R_Lthigh_lumbar : numpy.ndarray, optional
Rotations from the left thigh sensor to the lumbar sensor for all time points in the provided data. Only returned if return_orientation is True.
- R_Rthigh_lumbar : numpy.ndarray, optional
Rotations from the right thigh sensor to the lumbar sensor for all time points in the provided data. Only returned if return_orientation is True.