From 5c6eeaa7ed2baa4c5082f1da2429c645e2557720 Mon Sep 17 00:00:00 2001 From: aaiaueil Date: Fri, 29 Sep 2023 10:16:36 +0200 Subject: [PATCH 1/6] Added methods Solve issue #16 Not sure about the attributes though, didn't add any --- bionc/bionc_numpy/natural_segment.py | 51 ++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/bionc/bionc_numpy/natural_segment.py b/bionc/bionc_numpy/natural_segment.py index 92fc6dcd..ce7b5434 100644 --- a/bionc/bionc_numpy/natural_segment.py +++ b/bionc/bionc_numpy/natural_segment.py @@ -23,21 +23,68 @@ class NaturalSegment(AbstractNaturalSegment): Methods ------- + to_mx() + This function returns the segment in MX format + from_experimental_Q() + This function sets the segment from the natural coordinates + parameters_from_Q() + This function computes the parameters of the segment from the natural coordinates + set_experimental_Q_function() + This function sets the experimental Q function + _Qi_from_markers() + This function sets the experimental Q function + transformation_matrix() This function returns the transformation matrix, denoted Bi + segment_coordinates_system() + This function computes the segment coordinates from the natural coordinates + location_from_homogenous_transform() + This function returns the location of the segment in natural coordinate from its homogenous transform + rigid_body_constraint() This function returns the rigid body constraints of the segment, denoted phi_r rigid_body_constraint_jacobian() This function returns the jacobian of rigid body constraints of the segment, denoted K_r + rigid_body_constraint_derivative() + This function returns the derivative of the rigid body constraints denoted Phi_r_dot + rigid_body_constraint_jacobian_derivative() + This function returns the derivative of the Jacobian matrix of the rigid body constraints + + _pseudo_inertia_matrix() + This function returns the pseudo-inertia matrix of the segment + _natural_center_of_mass() + This function computes the center of mass of the segment in the natural coordinate system. + center_of_mass_position() + This function returns the position of the center of mass of the segment in the global coordinate system. + _update_mass_matrix() + This function returns the generalized mass matrix of the segment + gravity_force() + This function returns the gravity_force applied on the segment through gravity force + differential_algebraic_equation() + This function returns the differential algebraic equation of the segment add_natural_marker() This function adds a marker to the segment - nb_markers - This function returns the number of markers in the segment + add_natural_vector() + Add a new vector to the segment + add_natural_marker_from_segment_coordinates() + Add a new marker to the segment + add_natural_vector_from_segment_coordinates() + Add a new marker to the segment + + markers() + This function returns the position of the markers of the system as a function of the natural coordinates Q also referred as forward kinematics marker_constraints() This function returns the defects of the marker constraints of the segment, denoted Phi_m markers_jacobian() This function returns the jacobian of the marker constraints of the segment, denoted K_m + potential_energy() + This function returns the potential energy of the segment + kinetic_energy() + This function returns the kinetic energy of the segment + inverse_dynamics() + Computes inverse dynamics + Attributes ---------- From 862de265ce3ae61e8c85dad749e806302990d816 Mon Sep 17 00:00:00 2001 From: aaiaueil Date: Fri, 6 Oct 2023 09:18:56 +0200 Subject: [PATCH 2/6] Takes into account comments from PR#90 --- bionc/bionc_numpy/natural_segment.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bionc/bionc_numpy/natural_segment.py b/bionc/bionc_numpy/natural_segment.py index ce7b5434..829acdfa 100644 --- a/bionc/bionc_numpy/natural_segment.py +++ b/bionc/bionc_numpy/natural_segment.py @@ -28,11 +28,11 @@ class NaturalSegment(AbstractNaturalSegment): from_experimental_Q() This function sets the segment from the natural coordinates parameters_from_Q() - This function computes the parameters of the segment from the natural coordinates + It computes the parameters of the segment from SegmentNaturalCoordinates Q set_experimental_Q_function() - This function sets the experimental Q function + This function sets the experimental Q function that evaluates Q from marker locations _Qi_from_markers() - This function sets the experimental Q function + This function evaluates segment natural coordinates Q from markers locations. transformation_matrix() This function returns the transformation matrix, denoted Bi @@ -66,7 +66,7 @@ class NaturalSegment(AbstractNaturalSegment): add_natural_marker() This function adds a marker to the segment add_natural_vector() - Add a new vector to the segment + Add a new natual vector to the segment add_natural_marker_from_segment_coordinates() Add a new marker to the segment add_natural_vector_from_segment_coordinates() @@ -83,7 +83,7 @@ class NaturalSegment(AbstractNaturalSegment): kinetic_energy() This function returns the kinetic energy of the segment inverse_dynamics() - Computes inverse dynamics + Computes inverse dynamics for one segment Attributes From 7cc3498635adc6a712f85519c43c0e52fc1b3a24 Mon Sep 17 00:00:00 2001 From: aaiaueil Date: Thu, 12 Oct 2023 16:16:19 +0200 Subject: [PATCH 3/6] Blacked code properly --- bionc/bionc_numpy/natural_segment.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bionc/bionc_numpy/natural_segment.py b/bionc/bionc_numpy/natural_segment.py index 829acdfa..c7c56abc 100644 --- a/bionc/bionc_numpy/natural_segment.py +++ b/bionc/bionc_numpy/natural_segment.py @@ -26,12 +26,12 @@ class NaturalSegment(AbstractNaturalSegment): to_mx() This function returns the segment in MX format from_experimental_Q() - This function sets the segment from the natural coordinates - parameters_from_Q() - It computes the parameters of the segment from SegmentNaturalCoordinates Q + This function sets the segment from the natural coordinates + parameters_from_Q() + It computes the parameters of the segment from SegmentNaturalCoordinates Q set_experimental_Q_function() This function sets the experimental Q function that evaluates Q from marker locations - _Qi_from_markers() + _Qi_from_markers() This function evaluates segment natural coordinates Q from markers locations. transformation_matrix() @@ -71,7 +71,7 @@ class NaturalSegment(AbstractNaturalSegment): Add a new marker to the segment add_natural_vector_from_segment_coordinates() Add a new marker to the segment - + markers() This function returns the position of the markers of the system as a function of the natural coordinates Q also referred as forward kinematics marker_constraints() @@ -84,7 +84,7 @@ class NaturalSegment(AbstractNaturalSegment): This function returns the kinetic energy of the segment inverse_dynamics() Computes inverse dynamics for one segment - + Attributes ---------- From 2e7a4b3463b1bb3001bf92f735dd0c6651f07cd7 Mon Sep 17 00:00:00 2001 From: aaiaueil Date: Thu, 12 Oct 2023 16:26:44 +0200 Subject: [PATCH 4/6] Review L29 --- bionc/bionc_numpy/natural_segment.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bionc/bionc_numpy/natural_segment.py b/bionc/bionc_numpy/natural_segment.py index c7c56abc..5ac18f77 100644 --- a/bionc/bionc_numpy/natural_segment.py +++ b/bionc/bionc_numpy/natural_segment.py @@ -26,9 +26,9 @@ class NaturalSegment(AbstractNaturalSegment): to_mx() This function returns the segment in MX format from_experimental_Q() - This function sets the segment from the natural coordinates - parameters_from_Q() - It computes the parameters of the segment from SegmentNaturalCoordinates Q + It builds a NaturalSegment from the segment natural coordinates + parameters_from_Q() + It computes the parameters of the segment from SegmentNaturalCoordinates Q set_experimental_Q_function() This function sets the experimental Q function that evaluates Q from marker locations _Qi_from_markers() From 371a0009c9730e9a6b699e22967413938e0b283b Mon Sep 17 00:00:00 2001 From: aaiaueil Date: Fri, 13 Oct 2023 10:54:53 +0200 Subject: [PATCH 5/6] Commit comment --- bionc/bionc_numpy/natural_segment.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bionc/bionc_numpy/natural_segment.py b/bionc/bionc_numpy/natural_segment.py index 5ac18f77..ee776dbe 100644 --- a/bionc/bionc_numpy/natural_segment.py +++ b/bionc/bionc_numpy/natural_segment.py @@ -24,13 +24,13 @@ class NaturalSegment(AbstractNaturalSegment): Methods ------- to_mx() - This function returns the segment in MX format + This function returns the segment in MX format. from_experimental_Q() - It builds a NaturalSegment from the segment natural coordinates + It builds a NaturalSegment from the segment natural coordinates. parameters_from_Q() - It computes the parameters of the segment from SegmentNaturalCoordinates Q + It computes the parameters of the segment from SegmentNaturalCoordinates Q. set_experimental_Q_function() - This function sets the experimental Q function that evaluates Q from marker locations + This function sets the experimental Q function that evaluates Q from marker locations. _Qi_from_markers() This function evaluates segment natural coordinates Q from markers locations. From 14068f376116ef3050e18d55a9a9aea584860093 Mon Sep 17 00:00:00 2001 From: aaiaueil Date: Mon, 16 Oct 2023 11:13:23 +0200 Subject: [PATCH 6/6] PR #90 --- bionc/bionc_numpy/natural_segment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bionc/bionc_numpy/natural_segment.py b/bionc/bionc_numpy/natural_segment.py index ee776dbe..58b59479 100644 --- a/bionc/bionc_numpy/natural_segment.py +++ b/bionc/bionc_numpy/natural_segment.py @@ -66,7 +66,7 @@ class NaturalSegment(AbstractNaturalSegment): add_natural_marker() This function adds a marker to the segment add_natural_vector() - Add a new natual vector to the segment + Add a new natural vector to the segment add_natural_marker_from_segment_coordinates() Add a new marker to the segment add_natural_vector_from_segment_coordinates() @@ -83,7 +83,7 @@ class NaturalSegment(AbstractNaturalSegment): kinetic_energy() This function returns the kinetic energy of the segment inverse_dynamics() - Computes inverse dynamics for one segment + Computes inverse dynamics for one segment. Attributes