Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
impedance_controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IPK_AUT
Converging
impedance_controller
Commits
5a9d48c2
Commit
5a9d48c2
authored
1 month ago
by
jeo65286
Browse files
Options
Downloads
Patches
Plain Diff
Edit task inertia matrix func
parent
6033138c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/include/math/robotics_utilities.hpp
+15
-9
15 additions, 9 deletions
common/include/math/robotics_utilities.hpp
fr3_impedance_controller_sim/src/fr3_impedance_controller_sim.cpp
+5
-5
5 additions, 5 deletions
...dance_controller_sim/src/fr3_impedance_controller_sim.cpp
with
20 additions
and
14 deletions
common/include/math/robotics_utilities.hpp
+
15
−
9
View file @
5a9d48c2
...
@@ -108,8 +108,8 @@ auto getFilteredTustinDerivative(const Eigen::Matrix<T, Rows, 1> & u, //
...
@@ -108,8 +108,8 @@ auto getFilteredTustinDerivative(const Eigen::Matrix<T, Rows, 1> & u, //
template
<
typename
T
,
int
Rows
,
int
Cols
>
template
<
typename
T
,
int
Rows
,
int
Cols
>
auto
getTaskAcceleration
(
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
&
J
,
auto
getTaskAcceleration
(
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
&
J
,
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
&
dJ
,
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
&
dJ
,
const
Eigen
::
Matrix
<
T
,
Row
s
,
1
>
&
dq
,
const
Eigen
::
Matrix
<
T
,
Col
s
,
1
>
&
dq
,
const
Eigen
::
Matrix
<
T
,
Row
s
,
1
>
&
ddq
)
const
Eigen
::
Matrix
<
T
,
Col
s
,
1
>
&
ddq
)
{
{
return
J
*
ddq
+
dJ
*
dq
;
return
J
*
ddq
+
dJ
*
dq
;
};
};
...
@@ -133,14 +133,20 @@ auto computeFullInertiaMatrix(const Eigen::Matrix<T, Rows, Cols> & M_ut)
...
@@ -133,14 +133,20 @@ auto computeFullInertiaMatrix(const Eigen::Matrix<T, Rows, Cols> & M_ut)
* @param Jt_inv : (pseudo-)inverse of Jacobian.transpose matrix
* @param Jt_inv : (pseudo-)inverse of Jacobian.transpose matrix
* @return n x n operational inertia matrix
* @return n x n operational inertia matrix
*/
*/
template
<
typename
T
,
int
Rows
,
int
Cols
>
template
<
typename
DerivedM
,
typename
DerivedJInv
,
typename
DerivedJtInv
>
auto
computeTaskInertiaMatrix
(
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
&
M
,
auto
computeTaskInertiaMatrix
(
const
Eigen
::
Matrix
Base
<
DerivedM
>
&
M
,
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
&
J_inv
,
const
Eigen
::
Matrix
Base
<
DerivedJInv
>
&
J_inv
,
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
&
Jt_inv
)
const
Eigen
::
Matrix
Base
<
DerivedJtInv
>
&
Jt_inv
)
{
{
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>
Mt
(
M
.
rows
(),
M
.
cols
());
using
Scalar
=
typename
DerivedM
::
Scalar
;
Mt
.
noalias
()
=
Jt_inv
*
M
*
J_inv
;
// prevent unnecessary duplicate to minimize memory allocation
return
Mt
;
// 반환 행렬의 크기를 자동으로 결정
Eigen
::
Matrix
<
Scalar
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
>
Mt
(
Jt_inv
.
rows
(),
J_inv
.
cols
());
// 병렬 연산 및 중간 메모리 복사 방지
Mt
.
noalias
()
=
Jt_inv
*
M
*
J_inv
;
return
Mt
.
eval
();
// 완전히 평가된 행렬 반환
}
}
}
// namespace robot_utils
}
// namespace robot_utils
...
...
This diff is collapsed.
Click to expand it.
fr3_impedance_controller_sim/src/fr3_impedance_controller_sim.cpp
+
5
−
5
View file @
5a9d48c2
...
@@ -350,7 +350,7 @@ void FR3ImpedanceControllerSim::update()
...
@@ -350,7 +350,7 @@ void FR3ImpedanceControllerSim::update()
/* compute current EE Twist & Acceleration using backward Euler method */
/* compute current EE Twist & Acceleration using backward Euler method */
ee_vel_world_cal_
=
Je
*
dq_mes_
;
ee_vel_world_cal_
=
Je
*
dq_mes_
;
ee_acc
el
_world_eul_
=
robo
::
getEulerDerivative
(
ee_vel_world_cal_
,
ee_vel_world_cal_prev_
,
dt_
);
ee_acc_world_eul_
=
robo
::
getEulerDerivative
(
ee_vel_world_cal_
,
ee_vel_world_cal_prev_
,
dt_
);
/* Inertia matrix */
/* Inertia matrix */
pin
::
crba
(
model_
,
data_
,
q_mes_
);
pin
::
crba
(
model_
,
data_
,
q_mes_
);
...
@@ -359,6 +359,7 @@ void FR3ImpedanceControllerSim::update()
...
@@ -359,6 +359,7 @@ void FR3ImpedanceControllerSim::update()
// k_mass << 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 10.0;
// k_mass << 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 10.0;
// M.diagonal().array() *= k_mass.array();
// M.diagonal().array() *= k_mass.array();
Mat7
<
double
>
M_full
=
robo
::
computeFullInertiaMatrix
(
M
);
Mat7
<
double
>
M_full
=
robo
::
computeFullInertiaMatrix
(
M
);
// TODO: Check Me is correct
Mat6
<
double
>
Me
=
robo
::
computeTaskInertiaMatrix
(
M_full
,
Je_pinv
,
Je_t_pinv
);
Mat6
<
double
>
Me
=
robo
::
computeTaskInertiaMatrix
(
M_full
,
Je_pinv
,
Je_t_pinv
);
Mat7
<
double
>
dMinv
=
autodiff_
->
get_dMinv
(
q_mes_
,
dq_mes_
);
Mat7
<
double
>
dMinv
=
autodiff_
->
get_dMinv
(
q_mes_
,
dq_mes_
);
...
@@ -438,11 +439,10 @@ void FR3ImpedanceControllerSim::update()
...
@@ -438,11 +439,10 @@ void FR3ImpedanceControllerSim::update()
Vec7
<
double
>
tau_dist_hat_dob
;
Vec7
<
double
>
tau_dist_hat_dob
;
// Vec7<double> tau_dist_hat_dob = Je.transpose() * F_dist_hat_dob;
// Vec7<double> tau_dist_hat_dob = Je.transpose() * F_dist_hat_dob;
//
Vec6<double> fr_F_task = Je_t_pinv * fr_tau_des_;
Vec6
<
double
>
fr_F_task
=
Je_t_pinv
*
fr_tau_des_
;
//
Vec6<double> fr_F_ext_hat_filtered = Je_t_pinv * fr_tau_ext_hat_filtered_;
Vec6
<
double
>
fr_F_ext_hat_filtered
=
Je_t_pinv
*
fr_tau_ext_hat_filtered_
;
// !!! since dob has shared pointer, multiple use of this function induce bug in estimation
// !!! since dob has shared pointer, multiple use of this function induce bug in estimation
// Vec6<double> fr_F_dist_hat_dob = dob_->get_force_disturbance(fr_F_task, Me,
Vec6
<
double
>
fr_F_dist_hat_dob
=
dob_
->
get_force_disturbance
(
fr_F_task
,
Me
,
ee_acc_world_eul_
);
// ee_acc_world_eul_);
/* update states */
/* update states */
this
->
update_previous_states
();
this
->
update_previous_states
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment