Skip to content

Commit

Permalink
Set initial position before simulation starts
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Apr 7, 2024
1 parent 693cd46 commit a779320
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gazebo_ros2_control/src/gazebo_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ void GazeboSystem::registerJoints(
// check if joint is actuated (has command interfaces) or passive
this->dataPtr->is_joint_actuated_[j] = (joint_info.command_interfaces.size() > 0);
}

// set initial position for mimic joints
for (const auto & mimic_joint : hardware_info.mimic_joints) {
this->dataPtr->sim_joints_[mimic_joint.joint_index]->SetPosition(
0,
mimic_joint.offset + mimic_joint.multiplier *
this->dataPtr->joint_position_[mimic_joint.mimicked_joint_index],
true);
}
}

void GazeboSystem::registerSensors(
Expand Down

0 comments on commit a779320

Please sign in to comment.