Skip to content

Commit

Permalink
Fix error joint velocity in the first step of simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
qiayuanl committed Feb 1, 2024
1 parent b3864d4 commit 715cc53
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions legged_gazebo/src/LeggedHWSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ void LeggedHWSim::readSim(ros::Time time, ros::Duration period) {
double position = sim_joints_[j]->Position(0);

joint_velocity_[j] = (position - joint_position_[j]) / period.toSec();
if (time == ros::Time(period.toSec())) {
joint_velocity_[j] = 0;
}
if (joint_types_[j] == urdf::Joint::PRISMATIC) {
joint_position_[j] = position;
} else {
Expand Down

0 comments on commit 715cc53

Please sign in to comment.