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) #290

Merged
merged 1 commit into from
Apr 26, 2024
Merged

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)

# Conflicts:
#	ign_ros2_control_demos/launch/pendulum_example_effort.launch.py
#	ign_ros2_control_demos/launch/pendulum_example_position.launch.py
#	ign_ros2_control_demos/urdf/test_pendulum_effort.xacro.urdf
#	ign_ros2_control_demos/urdf/test_pendulum_position.xacro.urdf
@mergify mergify bot requested a review from ahcorde as a code owner April 26, 2024 07:52
@mergify mergify bot added the conflicts label Apr 26, 2024
Copy link
Contributor Author

mergify bot commented Apr 26, 2024

Cherry-pick of 27af210 has failed:

On branch mergify/bp/humble/pr-289
Your branch is up to date with 'origin/humble'.

You are currently cherry-picking commit 27af210.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   doc/index.rst

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	added by them:   ign_ros2_control_demos/launch/pendulum_example_effort.launch.py
	added by them:   ign_ros2_control_demos/launch/pendulum_example_position.launch.py
	added by them:   ign_ros2_control_demos/urdf/test_pendulum_effort.xacro.urdf
	added by them:   ign_ros2_control_demos/urdf/test_pendulum_position.xacro.urdf

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot mentioned this pull request Apr 26, 2024
@ahcorde ahcorde merged commit 6e99707 into humble Apr 26, 2024
5 checks passed
@ahcorde ahcorde deleted the mergify/bp/humble/pr-289 branch April 26, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants