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

504 add properly antennas #505

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
67d6d74
Add interpolation space arg
glannuzel Feb 18, 2025
82a24a3
Add space to goto
glannuzel Feb 19, 2025
3784bff
Add elliptical
glannuzel Feb 19, 2025
45a5dbf
Add elliptical parameters in goto
glannuzel Feb 20, 2025
ea967e1
Unsupported elliptical mode in joint space
glannuzel Feb 20, 2025
910cd8d
Remove space from goto_posture and add it to translate_by
glannuzel Feb 20, 2025
b91c3ac
Update request format
glannuzel Feb 20, 2025
be29ea3
Fix mobile base
glannuzel Feb 21, 2025
3b43edf
Remove cartesian interpolation from goto_joints
glannuzel Feb 21, 2025
4226309
Update desc
glannuzel Feb 21, 2025
e23f407
Fix type for grpc message
glannuzel Feb 21, 2025
5b6413c
Fix elliptical parameters
glannuzel Feb 26, 2025
74cc059
Remove send_cartesian_interpolation
glannuzel Feb 26, 2025
74f1a23
Update versions
glannuzel Feb 26, 2025
92af86e
Sending antennas gotos working
glannuzel Feb 27, 2025
476f418
Pydoc check
glannuzel Feb 27, 2025
fba10f4
Remove print
glannuzel Feb 27, 2025
ec98da4
Get goto component info
glannuzel Feb 27, 2025
889efac
Update antenna.py
glannuzel Feb 27, 2025
f1953cc
Fix goto_based_component
glannuzel Feb 28, 2025
8206bb1
Passing tests
glannuzel Feb 28, 2025
27e5119
Add antennas to joint list
glannuzel Feb 28, 2025
25cd742
Fix descriptions
glannuzel Mar 3, 2025
6b749c7
Antenna does not derive from DynamixelMotor
glannuzel Mar 3, 2025
ee954cc
Update 3_arm_and_gripper.ipynb
glannuzel Mar 6, 2025
17dfd69
Merge branch '501-add-cartesian-interpolation-to-goto' into 504-add-p…
glannuzel Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ install_requires =
grpcio>=1.59.0, <=1.62.2
pyquaternion==0.9.9
opencv-python>=4.8.0, <4.9.0
reachy2-sdk-api>=1.0.16, <1.1.0
reachy2-sdk-api>=1.0.17, <1.1.0

[options.packages.find]
where = src
Expand Down
170 changes: 163 additions & 7 deletions src/examples/3_arm_and_gripper.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"id": "10",
"metadata": {},
"source": [
"### Joint space"
"### Joint space goal"
]
},
{
Expand Down Expand Up @@ -433,7 +433,7 @@
"id": "43",
"metadata": {},
"source": [
"### Cartesian space"
"### Cartesian space goal"
]
},
{
Expand Down Expand Up @@ -540,7 +540,8 @@
"metadata": {},
"outputs": [],
"source": [
"reachy.l_arm.goto(new_pose)"
"reachy.l_arm.goto(new_pose)\n",
"reachy.l_arm.goto_posture()"
]
},
{
Expand All @@ -549,6 +550,151 @@
"metadata": {},
"source": [
"To simplify your life, you have access to functions to easily compute translation or rotation. \n",
"But first, have a look the interpolation space!"
]
},
{
"cell_type": "markdown",
"id": "884dfc68",
"metadata": {},
"source": [
"### Interpolation space"
]
},
{
"cell_type": "markdown",
"id": "7a4f0d79",
"metadata": {},
"source": [
"Let's make things a little more complicated now. \n",
"Sending a command in a space (joint or cartesian) does not mean the interpolation to reach the goal position is made in the same space. \n",
"\n",
"***What does that mean?*** \n",
"By default, the interpolation (all the intermediate positions the arm is going to take before reaching the goal position) is made in joint space: if the initial position of the `r_arm.shoulder.pitch` is `30` and we want to reach a position so that `r_arm.shoulder.pitch` is `15`, the goto will calculate the interpolation from 30 to 15 for the joint, **even if the goal position was given in cartesian_space**. The movement will be made regardless the intermediate positions of the end-effector in the cartesian space, only the intermediate positions of the joints are considered.\n",
"\n",
"> **Default interpolation space is `joint_space`**"
]
},
{
"cell_type": "markdown",
"id": "0572d110",
"metadata": {},
"source": [
"Here is an example to go through this. \n",
"From the `elbow_90` posture, we calculate a new pose that is 20cm ahead:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ac548ed0",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from reachy2_sdk.utils.utils import get_pose_matrix\n",
"\n",
"initial_pose = get_pose_matrix([0.25, -0.3, -0.3], [0, -90, 0])\n",
"modified_pose = np.copy(initial_pose)\n",
"modified_pose[0, 3] += 0.25"
]
},
{
"cell_type": "markdown",
"id": "81b47732",
"metadata": {},
"source": [
"We send the arm to the `elbow_90` posture first:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "132db3d7",
"metadata": {},
"outputs": [],
"source": [
"reachy.r_arm.goto(initial_pose)"
]
},
{
"cell_type": "markdown",
"id": "2a5f57e9",
"metadata": {},
"source": [
"Then we send the arm to the new position, 20cm ahead. Watch carefully the trajectory of the gripper when moving to the new goal position:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "95fed794",
"metadata": {},
"outputs": [],
"source": [
"reachy.r_arm.goto(modified_pose)"
]
},
{
"cell_type": "markdown",
"id": "cec15f4e",
"metadata": {},
"source": [
"The gripper is going slightly down before reaching the target. This is because the movement was interpolated in joint space. \n",
"\n",
"Put back the robot in the initial_pose, and set the `interpolation_space` argument to `cartesian_space` to reach the modified goal:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "07c84f62",
"metadata": {},
"outputs": [],
"source": [
"reachy.r_arm.goto(initial_pose)\n",
"reachy.r_arm.goto(modified_pose, interpolation_space=\"cartesian_space\")"
]
},
{
"cell_type": "markdown",
"id": "f99a2c13",
"metadata": {},
"source": [
"The gripper is not following the same trajectory as previsouly, as the interpolation is now made in cartesian space."
]
},
{
"cell_type": "markdown",
"id": "0a296552",
"metadata": {},
"source": [
"### Relative moves: translate_by / rotate_by"
]
},
{
"cell_type": "markdown",
"id": "9bb293a9",
"metadata": {},
"source": [
"The `translate_by` and `rotate_by` methods are here to simplify simple translations and rotations. \n",
"\n",
"Note that if you use the `translate_by` method, which is a goto-based method, the interpolation space will be set bu default to cartesian_space."
]
},
{
"cell_type": "markdown",
"id": "323cf49c",
"metadata": {},
"source": [
"> **Default interpolation space for translate_by is `cartesian_space`**"
]
},
{
"cell_type": "markdown",
"id": "1e7bbced",
"metadata": {},
"source": [
"Use the `translate_by(...)` method to send the gripper back to the previous pose, asking for a translation 10cm back (-10cm on Reachy's x axis):"
]
},
Expand All @@ -559,7 +705,7 @@
"metadata": {},
"outputs": [],
"source": [
"reachy.l_arm.translate_by(-0.1, 0, 0, frame='robot')"
"reachy.r_arm.translate_by(-0.25, 0, 0, frame='robot')"
]
},
{
Expand All @@ -577,7 +723,7 @@
"metadata": {},
"outputs": [],
"source": [
"reachy.l_arm.rotate_by(10, 0, 0, frame='gripper')"
"reachy.r_arm.rotate_by(10, 0, 0, frame='gripper')"
]
},
{
Expand Down Expand Up @@ -606,7 +752,7 @@
"metadata": {},
"outputs": [],
"source": [
"reachy.l_arm.get_translation_by(-0.1, 0.2, -0.1, frame='gripper')"
"reachy.r_arm.get_translation_by(-0.1, 0.2, -0.1, frame='gripper')"
]
},
{
Expand All @@ -616,7 +762,17 @@
"metadata": {},
"outputs": [],
"source": [
"reachy.l_arm.get_rotation_by(-10, 20, 0, frame='gripper')"
"reachy.r_arm.get_rotation_by(-10, 20, 0, frame='gripper')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6d777afc",
"metadata": {},
"outputs": [],
"source": [
"reachy.r_arm.goto_posture()"
]
},
{
Expand Down
Loading
Loading