File tree Expand file tree Collapse file tree
fd_controllers/fd_inertia_broadcaster/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,19 +43,21 @@ class State;
4343namespace fd_inertia_broadcaster
4444{
4545const auto kUninitializedValue = std::numeric_limits<double >::quiet_NaN();
46- const size_t sizeFlattenedInertia = 15 ;
46+ const size_t sizeFlattenedInertia = 21 ;
4747
48- unsigned int flattened_index_from_triangular_index (unsigned int idx_row, unsigned int idx_col)
48+ unsigned int flattened_index_from_triangular_index (
49+ unsigned int idx_row,
50+ unsigned int idx_col,
51+ unsigned int dim = 6 )
4952{
5053 unsigned int i = idx_row;
5154 unsigned int j = idx_col;
5255 if (idx_col < idx_row) {
5356 i = idx_col;
5457 j = idx_row;
5558 }
56- return i * (i - 1 ) / 2 + j;
59+ return i * (2 * dim - i - 1 ) / 2 + j;
5760}
58-
5961template <class Derived >
6062void matrixEigenToMsg (const Eigen::MatrixBase<Derived> & e, std_msgs::msg::Float64MultiArray & m)
6163{
Original file line number Diff line number Diff line change @@ -40,9 +40,18 @@ namespace fd_hardware
4040
4141rclcpp::Logger LOGGER = rclcpp::get_logger(" FDEffortHardwareInterface" );
4242
43- unsigned int flattened_index_from_triangular_index (unsigned int i, unsigned int j)
43+ unsigned int flattened_index_from_triangular_index (
44+ unsigned int idx_row,
45+ unsigned int idx_col,
46+ unsigned int dim = 6 )
4447{
45- return i * (i - 1 ) / 2 + j;
48+ unsigned int i = idx_row;
49+ unsigned int j = idx_col;
50+ if (idx_col < idx_row) {
51+ i = idx_col;
52+ j = idx_row;
53+ }
54+ return i * (2 * dim - i - 1 ) / 2 + j;
4655}
4756
4857
You can’t perform that action at this time.
0 commit comments