Skip to content

Commit

Permalink
Adding gimbal rate in gz simulation (#24125)
Browse files Browse the repository at this point in the history
* Adding gimbal rate in gz simulation

* add submodule
  • Loading branch information
Perrrewi authored Dec 18, 2024
1 parent 6b10f1c commit 8a93913
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Tools/simulation/gz
Submodule gz updated 1 files
+1 −1 models/gimbal/model.sdf
8 changes: 8 additions & 0 deletions src/modules/simulation/gz_bridge/GZGimbal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ void GZGimbal::gimbalIMUCallback(const gz::msgs::IMU &IMU_data)
IMU_data.orientation().z());
_q_gimbal = q_FLU_to_FRD * q_gimbal_FLU * q_FLU_to_FRD.inversed();

matrix::Vector3f rate = q_FLU_to_FRD.rotateVector(matrix::Vector3f(IMU_data.angular_velocity().x(),
IMU_data.angular_velocity().y(),
IMU_data.angular_velocity().z()));

_gimbal_rate[0] = rate(0);
_gimbal_rate[1] = rate(1);
_gimbal_rate[2] = rate(2);

pthread_mutex_unlock(&_node_mutex);
}

Expand Down

0 comments on commit 8a93913

Please sign in to comment.