Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cart-pole demo (backport #289) #291

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Add cart-pole demo (backport #289) #291

merged 1 commit into from
Apr 26, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 26, 2024

Similar to ros-controls/gazebo_ros2_control#172

The difference to gazebo_ros2_control is that it also works with position command interface of the cart. gz_ros2_control does not directly set the position but implements a position controller with velocity output:

} else if (this->dataPtr->joints_[i].joint_control_method & POSITION) {
// Get error in position
double error;
error = (this->dataPtr->joints_[i].joint_position -
this->dataPtr->joints_[i].joint_position_cmd) * *this->dataPtr->update_rate;
// Calculate target velcity
double target_vel = -this->dataPtr->position_proportional_gain_ * error;
auto vel =
this->dataPtr->ecm->Component<sim::components::JointVelocityCmd>(
this->dataPtr->joints_[i].sim_joint);
if (vel == nullptr) {
this->dataPtr->ecm->CreateComponent(
this->dataPtr->joints_[i].sim_joint,
sim::components::JointVelocityCmd({target_vel}));
} else if (!vel->Data().empty()) {
vel->Data()[0] = target_vel;
}


This is an automatic backport of pull request #289 done by [Mergify](https://mergify.com).

(cherry picked from commit 27af210)
@mergify mergify bot requested a review from ahcorde as a code owner April 26, 2024 07:52
@mergify mergify bot mentioned this pull request Apr 26, 2024
@ahcorde ahcorde merged commit 931343a into iron Apr 26, 2024
8 checks passed
@ahcorde ahcorde deleted the mergify/bp/iron/pr-289 branch April 26, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants