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

Added tutorial for Gazebo joint controller plugin #2263

Merged
merged 32 commits into from
Jan 8, 2024
Merged

Added tutorial for Gazebo joint controller plugin #2263

merged 32 commits into from
Jan 8, 2024

Conversation

yaswanth1701
Copy link
Contributor

🎉 New feature

Closes #1019

Summary

Added a tutorial for Gazebo's joint controller plugin.

Test it

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@github-actions github-actions bot added the 🌱 garden Ignition Garden label Dec 11, 2023
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yaswanth1701, thank you for writting the tutorial and contribute!

Two main things to review too:

Comment on lines 1 to 2

\page jointcontrollers Joint Controllers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\page jointcontrollers Joint Controllers
\page jointcontrollers Joint Controllers


This mode let's the user explicitly set the values of PID gains and also bounds for velocity.

Note: This force mode is for the user who looking to manually tune PID gains for velocity control according to a specific use case (e.g. Custom models). For general testing purposes, velocity mode will give the best results.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note: This force mode is for the user who looking to manually tune PID gains for velocity control according to a specific use case (e.g. Custom models). For general testing purposes, velocity mode will give the best results.
**Note**: This force mode is for the user who looking to manually tune PID gains for velocity control according to a specific use case (e.g. Custom models). For general testing purposes, velocity mode will give the best results.


Note: This force mode is for the user who looking to manually tune PID gains for velocity control according to a specific use case (e.g. Custom models). For general testing purposes, velocity mode will give the best results.

Required parameters for both modes can be found [here](https://gazebosim.org/api/gazebo/4.5/classignition_1_1gazebo_1_1systems_1_1JointController.html#:~:text=joint%20is%20actuated.-,System%20Parameters,-%3Cjoint_name%3E%20The).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Required parameters for both modes can be found [here](https://gazebosim.org/api/gazebo/4.5/classignition_1_1gazebo_1_1systems_1_1JointController.html#:~:text=joint%20is%20actuated.-,System%20Parameters,-%3Cjoint_name%3E%20The).
Required parameters for both modes can be found [here](https://gazebosim.org/api/gazebo/7.0/classignition_1_1gazebo_1_1systems_1_1JointController.html#:~:text=joint%20is%20actuated.-,System%20Parameters,-%3Cjoint_name%3E%20The).


Required parameters for both modes can be found [here](https://gazebosim.org/api/gazebo/4.5/classignition_1_1gazebo_1_1systems_1_1JointController.html#:~:text=joint%20is%20actuated.-,System%20Parameters,-%3Cjoint_name%3E%20The).

In both the modes commanded velocity(cmd_vel) can be published or subscribed at the topic: `/model/<model_name>/joint/<joint_name>/cmd_vel` by default.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redoo this phrase


Let's see an example for both modes using a simple model having only one joint.

For controlling joints one would require adding the Gazebo's joint controller plugin to the existing <model_name>.sdf file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For controlling joints one would require adding the Gazebo's joint controller plugin to the existing <model_name>.sdf file.
For controlling joints one would require adding the Gazebo's joint controller plugin to the existing `<model_name>.sdf` file.


1) Launching gazebo simulation.

```xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```xml
```bash

1) Launching gazebo simulation.

```xml
gz sim example2.sdf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gz sim example2.sdf
gz sim -v 4 -r example2.sdf

Comment on lines 606 to 608


<p align="center">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p align="center">
<p align="center">

<img src="https://github.com/yaswanth1701/gz-sim/assets/92177410/5a8b81b2-c96a-44ce-9f15-57e64f2b869b" width="800" height="400">
</p>

Note: by default velocity and position control are disabled if one want to use these mode, they must specify the PID gains value according to usage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note: by default velocity and position control are disabled if one want to use these mode, they must specify the PID gains value according to usage.
**Note**: By default velocity and position control are disabled if one want to use these mode, they must specify the PID gains value according to usage.


4) Checking progress of commanded trajectory.

```xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```xml
```bash

Signed-off-by: Yaswanth <[email protected]>
Signed-off-by: Yaswanth <[email protected]>
Signed-off-by: Yaswanth <[email protected]>
Signed-off-by: Yaswanth <[email protected]>
@yaswanth1701
Copy link
Contributor Author

yaswanth1701 commented Dec 12, 2023

Hi @ahcorde, thanks a lot for reviewing. I have resolved the comment you gave. I am a bit confused about how to locate images and gifs to this folder https://github.com/gazebosim/gz-sim/tree/ee108441a2821d787fc917a705d01abb4a7d7843/tutorials/files. I have added the image and gif here should I just paste the link of folder's images in joint_controller.md file?

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4eb9484) 64.76% compared to head (ee2a164) 64.74%.
Report is 1 commits behind head on gz-sim7.

❗ Current head ee2a164 differs from pull request most recent head 07ab7d7. Consider uploading reports for the commit 07ab7d7 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           gz-sim7    #2263      +/-   ##
===========================================
- Coverage    64.76%   64.74%   -0.03%     
===========================================
  Files          357      357              
  Lines        29139    29141       +2     
===========================================
- Hits         18872    18866       -6     
- Misses       10267    10275       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great so far! Just a few minor comments. I only skimmed to see where we can use better doxygen syntax. Haven't read the tutorial in depth yet.

tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Show resolved Hide resolved
yaswanth1701 and others added 7 commits December 22, 2023 23:14
Signed-off-by: Yaswanth <[email protected]>
Signed-off-by: yaswanth1701 <[email protected]>
Signed-off-by: yaswanth1701 <[email protected]>
Signed-off-by: yaswanth1701 <[email protected]>
Signed-off-by: Yaswanth <[email protected]>
@yaswanth1701
Copy link
Contributor Author

Hi @azeey , I have resolved the comment that you gave. Could you please review this further?

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lines < 100


This would look almost the same as velocity mode if PID gains are tuned properly.

5) Cheking Joint states.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5) Cheking Joint states.
5) Checking Joint states.

@@ -0,0 +1,685 @@
\page jointcontrollers Joint Controllers

Gazebo provides three joint controller plugins. Let's see a detailed description of each of them and example usage to help users to select right joint controller for their usage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enumerate 3 available controllers

Suggested change
Gazebo provides three joint controller plugins. Let's see a detailed description of each of them and example usage to help users to select right joint controller for their usage.
Gazebo provides three joint controller plugins. Let's see a detailed description of each of them and example usage to help users to select right joint controller for their usage.

tutorials/joint_controller.md Show resolved Hide resolved
This mode lets the user control the desired joint velocity directly.

2) Force mode:
A user who wants to control joint velocity using a PID controller can use this mode.This mode lets the user explicitly set the values of PID gains and also bounds for velocity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shorter lines < 100

```

```bash
joint {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you indent this output ?

</div>

```bash
joint {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent output

Comment on lines 287 to 289


## 2) JointPositionController
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 2) JointPositionController
## 2) JointPositionController

```

```bash
joint {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent output


### Example usage:

Let’s set up a new model for this example. A two-linked manipulator arm which has a total of two joints to control ( [```joint_trajectory_controller.sdf```](https://github.com/gazebosim/gz-sim/blob/gz-sim7/examples/worlds/joint_trajectory_controller.sdf) is the original example). Name it as `example2.sdf`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Let’s set up a new model for this example. A two-linked manipulator arm which has a total of two joints to control ( [```joint_trajectory_controller.sdf```](https://github.com/gazebosim/gz-sim/blob/gz-sim7/examples/worlds/joint_trajectory_controller.sdf) is the original example). Name it as `example2.sdf`.
Let’s set up a new model for this example. A two-linked manipulator arm which has a total of two joints to control ([```joint_trajectory_controller.sdf```](https://github.com/gazebosim/gz-sim/blob/gz-sim7/examples/worlds/joint_trajectory_controller.sdf) is the original example). Name it as `example2.sdf`.

@yaswanth1701
Copy link
Contributor Author

yaswanth1701 commented Dec 26, 2023

Hi @ahcorde I have made the changes can you please review it further? Also, what do you mean by 'lines < 100'? I didn't get it."
@yaswanth1701, The length of lines should be lower than 100 characters

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check failures in CI https://github.com/gazebosim/gz-sim/actions/runs/7330698448/job/19975369073?pr=2263

I think there are spaces at the end of the lines

@yaswanth1701
Copy link
Contributor Author

Hi @ahcorde can I please know why the codecov/project report has failed and how I can resolve it?

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I will wait for another pass of @azeey

@ahcorde ahcorde requested a review from azeey January 3, 2024 10:59
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few minor comments. Thanks again for your contribution.

tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Show resolved Hide resolved
tutorials/joint_controller.md Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Outdated Show resolved Hide resolved
tutorials/joint_controller.md Show resolved Hide resolved
@azeey azeey enabled auto-merge (squash) January 8, 2024 18:12
@azeey azeey disabled auto-merge January 8, 2024 18:13
@azeey
Copy link
Contributor

azeey commented Jan 8, 2024

Looks like there's a trailing space issue.

Signed-off-by: yaswanth1701 <[email protected]>
@azeey azeey enabled auto-merge (squash) January 8, 2024 20:19
@azeey azeey merged commit 926923f into gazebosim:gz-sim7 Jan 8, 2024
9 checks passed
@yaswanth1701
Copy link
Contributor Author

Thanks a lot for reviewing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Document the various ways of controlling a joint
3 participants