Skip to content

Conversation

@jmatejcz
Copy link
Contributor

@jmatejcz jmatejcz commented Dec 31, 2025

Purpose

Improve performance of manipulation demo

Proposed Changes

  • examples/manipulation-demo-streamlit.py now launches everything - simulation, robo stack and UI. No need for second terminal.
  • Changes to embodiment prompt to improve performance
  • Added new scene configs
  • Now all configs that are available in the demo contains only - red cubes, carrots and apples
    Yellow cubes, blue cubes, tomatoes and corn were removed because our vision model do not recognize colors so these were easy to confuse
  • Fixed a bug in connector where unique id was created during import time, which resulted in all connector nodes having the same name
  • Fixed description of arguments in MoveObjectFromToToolInput
  • Updated command in docs and added example prompts
  • Using Vacuum Gripper which performs better in our demo (switched branch in demos.repos)

Warning

For now we have binary with vacuum gripper only for jazzy and do not have them on aws. But these will be added, for now you need to download it manually: https://robotecai.sharepoint.com/:u:/g/EemJ_CqFGd5JqFVYxJhFDx0BQigipS6uJuui940h2Catjw?e=BwMqs1
After that you will need to rebuild with colcon and resource env

Warning

If you already have rai-manipulaiton-demo cloned, VCS wont pull changes automatically. You need to either pull manually or remove the repo and clone again.

Notes and Doubts

I didn't test it extensively on rai-perception refactor. It was developed and tested mainly when rai-openset-vision existed, so the tools were slightly different. But they are very similar so i' m betting that it works fine.

in experimental setup reset arm was added straight to agent after every tool call, so the arm is not stuck in weird positions. In production we obviously can't leave it like that. Reset arm tool can be added, but it will introduce more complexity to demo.

I tried making adding launch methods to common file here a4f8495, but it seems like python package import do not work in launch files so I removed it. If you know if this can be done, please let me know

If now one streamlit file launches everything, do we need the rest of the example mani files?

Testing

Run manipulation demo, it should perform better

@jmatejcz jmatejcz force-pushed the jm/fix/manipulation-demo branch 3 times, most recently from d5e10ae to 7e9d854 Compare January 2, 2026 10:51
@jmatejcz jmatejcz force-pushed the jm/mani-docker-demo branch 2 times, most recently from d46cf98 to 2576943 Compare January 2, 2026 12:09
@jmatejcz jmatejcz force-pushed the jm/fix/manipulation-demo branch from 7822d45 to a054137 Compare January 3, 2026 15:49
Base automatically changed from jm/fix/manipulation-demo to main January 4, 2026 10:32
@jmatejcz jmatejcz force-pushed the jm/mani-docker-demo branch from 182be41 to 712fa7d Compare January 4, 2026 10:41
@jmatejcz jmatejcz marked this pull request as ready for review January 4, 2026 10:51
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.36%. Comparing base (8700550) to head (592547b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #747      +/-   ##
==========================================
+ Coverage   65.34%   65.36%   +0.02%     
==========================================
  Files          78       78              
  Lines        3388     3390       +2     
==========================================
+ Hits         2214     2216       +2     
  Misses       1174     1174              

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

@jmatejcz jmatejcz requested a review from Juliaj January 4, 2026 10:58
@jmatejcz jmatejcz force-pushed the jm/mani-docker-demo branch from 8693150 to a2545d1 Compare January 5, 2026 10:27
@jmatejcz jmatejcz force-pushed the jm/mani-docker-demo branch from 43a6a96 to 55af70c Compare January 5, 2026 10:49
@jmatejcz jmatejcz force-pushed the jm/mani-docker-demo branch from 0c2fd35 to 7743d6f Compare January 6, 2026 14:03
Comment on lines 131 to 133
x: float = Field(description="The x coordinate of the point to move to")
y: float = Field(description="The y coordinate of the point to move to")
z: float = Field(description="The z coordinate of the point to move to")
x: float = Field(description="The x coordinate of the point to move from")
y: float = Field(description="The y coordinate of the point to move from")
z: float = Field(description="The z coordinate of the point to move from")
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about these ?

Suggested change
x: float = Field(description="The x coordinate of the point to move to")
y: float = Field(description="The y coordinate of the point to move to")
z: float = Field(description="The z coordinate of the point to move to")
x: float = Field(description="The x coordinate of the point to move from")
y: float = Field(description="The y coordinate of the point to move from")
z: float = Field(description="The z coordinate of the point to move from")
x: float = Field(description="The x coordinate of the source point (pick-up location) in the manipulator frame")
y: float = Field(description="The y coordinate of the source point (pick-up location) in the manipulator frame")
z: float = Field(description="The z coordinate of the source point (pick-up location) in the manipulator frame")
x1: float = Field(description="The x coordinate of the destination point (drop-off location) in the manipulator frame")
y1: float = Field(description="The y coordinate of the destination point (drop-off location) in the manipulator frame")
z1: float = Field(description="The z coordinate of the destination point (drop-off location) in the manipulator frame")

The thought about adding "in the manipulator frame" to the coordinate descriptions is to clarify the required coordinate system and help the LLM agents chain tools correctly. So when GetObjectPositionsTool returns positions in the target/manipulator frame, the agent can use them directly with MoveObjectFromToTool without confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i didn't encounter problems where llm confuses 1st point with 2nd point, but it looks like a good change

)
for entity in content["entities"]
]
# Ensure the object has the correct _prefix field
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# Ensure the object has the correct _prefix field
# Set the ROS2 message type namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deleted 437f25d

for entity in content["entities"]
]
# Ensure the object has the correct _prefix field
pose_stamped._prefix = "geometry_msgs/msg"
Copy link
Collaborator

Choose a reason for hiding this comment

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

In theory, this is not needed because the _prefix is already set in BaseGeometryModel. Were you seeing runtime failures ?

Copy link
Contributor Author

@jmatejcz jmatejcz Jan 7, 2026

Choose a reason for hiding this comment

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

I asked @boczekbartek , but it was long ago and he do not remember why he added this, but we agreed that it is probably not needed as _prefix has default value ( as you mentioned), so i deleted that line 437f25d

"rules": [
"Always follow the specified payload limit; do not exceed 3 kg."
"Always follow the specified payload limit; do not exceed 3 kg.",
"Before starting the task, by looking at the image, determine if the task can be completed, of yes - proceed without asking. Otherwise report.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Before starting the task, by looking at the image, determine if the task can be completed, of yes - proceed without asking. Otherwise report.",
"Before starting the task, by looking at the image, determine if the task can be completed. If yes - proceed without asking. Otherwise report.",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied 62e5985

"Always follow the specified payload limit; do not exceed 3 kg."
"Always follow the specified payload limit; do not exceed 3 kg.",
"Before starting the task, by looking at the image, determine if the task can be completed, of yes - proceed without asking. Otherwise report.",
"Cubes height is 5cm. Remember to adjust z coordinate while stacking.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Cubes height is 5cm. Remember to adjust z coordinate while stacking.",
"Cubes are 5cm tall. When stacking, add 5cm to the z coordinate for each additional cube.",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied 62e5985

"Before starting the task, by looking at the image, determine if the task can be completed, of yes - proceed without asking. Otherwise report.",
"Cubes height is 5cm. Remember to adjust z coordinate while stacking.",
"Remember to not put objects on top of other objects, unless specifically instructed otherwise",
"Try to consider the typical size og objects when placing them (width, height, length)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Try to consider the typical size og objects when placing them (width, height, length)",
"Try to consider the typical size of objects when placing them (width, height, length)",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied 62e5985

"Remember to not put objects on top of other objects, unless specifically instructed otherwise",
"Try to consider the typical size og objects when placing them (width, height, length)",
"Always leave at least a 5cm margin (x and y) between objects unless specifically instructed otherwise",
"If you repeat the task, make sure to run detection again, to check objects positions",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"If you repeat the task, make sure to run detection again, to check objects positions",
"If you repeat the task, make sure to run detection again to check object positions",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied 62e5985

"850 mm reach suitable for a variety of industrial applications.",
"Interfaces to detect and manipulate objects.",
"Coordinate system: x - front to back (positive is forward), y - left to right (positive is right), z - up to down (positive is up)."
"Coordinate system and reachable space: x - front to back (positive is forward, [0.3, 0.5]), y - left to right (positive is right, [-0.5, 0.5]), z - up to down (positive is up)."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Coordinate system and reachable space: x - front to back (positive is forward, [0.3, 0.5]), y - left to right (positive is right, [-0.5, 0.5]), z - up to down (positive is up)."
"Coordinate system: x-axis (front to back, positive is forward, reachable range [0.3, 0.5] m), y-axis (left to right, positive is right, reachable range [-0.5, 0.5] m), z-axis (vertical, positive is up)."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied 62e5985

@Juliaj
Copy link
Collaborator

Juliaj commented Jan 7, 2026

I tried making adding launch methods to common file here a4f8495, but it seems like python package import do not work in launch files so I removed it.

What error were you seeing? My guess is that the launch file was run in a different Python context, so examples/ might not be on sys.path .

in the launch file, you could try following

import sys
from pathlib import Path

# Add examples directory to path
examples_path = Path(__file__).parent.parent / "examples"
sys.path.insert(0, str(examples_path))

from manipulation_common import launch_description  # or whatever function name

@jmatejcz
Copy link
Contributor Author

jmatejcz commented Jan 7, 2026

I tried making adding launch methods to common file here a4f8495, but it seems like python package import do not work in launch files so I removed it.

What error were you seeing? My guess is that the launch file was run in a different Python context, so examples/ might not be on sys.path .

in the launch file, you could try following

import sys
from pathlib import Path

# Add examples directory to path
examples_path = Path(__file__).parent.parent / "examples"
sys.path.insert(0, str(examples_path))

from manipulation_common import launch_description  # or whatever function name

I get import error. I tried these approaches with adding path, but it seems like when you use ros2 launch python modules are not recognized properly

@jmatejcz
Copy link
Contributor Author

jmatejcz commented Jan 7, 2026

PERFORMANCE TESTS

I tried simple prompts that require 1 tool call and some more advanced , for example these (which are in docs now):

  • "Place every apple on top of the cube"
  • "Stack all cubes into a tower"
  • "Arrange objects in a line"
  • "Move cubes to the left side of the table"

Problems that we encountered on old version:

  • Objects were falling from the gripper mid manipulation
  • Positions of cubes were detected wrongly , tomatoes with apples and corn was just hard to identify
  • Arm was bumping into other objects
  • Arm was not behaving properly on the ends of table
  • Agent struggled with understanding objects sizes (bad alignments and stacking, not leaving any margin)

on the above prompts demo had ~50% acc.

We found out that vision model do not recognize colors -> so I left in demo only configs with red cubes, removed tomatoes and corn.

We decided that this should be showcase of agentic Ai, not a robot capability, so we replaced real gripper with vacuum one ( which is not adequate to what you see in simulation). We removed collisions of gripper's fingers. @knicked did all that in https://github.com/RobotecAI/rai-manipulation-demo.

We changed the embodiment prompt so that agent understand the sizes of objects, leaves margins, etc. We also added the arm range in prompt and made configs so that the objects do not exceed the range.

The results:

  • Easy prompts that require 1 tool call -> almost 100% acc
  • Harder ones (these above) -> 80% , after follow app prompts from user even 95%

"2rc_2a",
"3rc_2a_1carrot",
"3carrots_3a_2rc",
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please consider making this as a dict with values as layout descriptions (i.e. three red cubes) . The keys are too cryptic for the user to select as a layout.

super().__init__()

if node_name is None:
node_name = f"rai_ros2_connector_{str(uuid.uuid4())[-12:]}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding a unit test for this is worthwhile. The unit tests enabled a safe code refactoring.

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.

4 participants