-
Notifications
You must be signed in to change notification settings - Fork 55
feat: improving manipulation demo #747
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
base: main
Are you sure you want to change the base?
Conversation
d5e10ae to
7e9d854
Compare
d46cf98 to
2576943
Compare
7822d45 to
a054137
Compare
182be41 to
712fa7d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
8693150 to
a2545d1
Compare
added common file in examples > > Co-authored-by: bboczek <bartłomiej.boczek@robotec.ai>
43a6a96 to
55af70c
Compare
0c2fd35 to
7743d6f
Compare
| 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") |
There was a problem hiding this comment.
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 ?
| 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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Ensure the object has the correct _prefix field | |
| # Set the ROS2 message type namespace |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "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.", |
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "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.", |
There was a problem hiding this comment.
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)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "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)", |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "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", |
There was a problem hiding this comment.
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)." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "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)." | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied 62e5985
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 |
I get import error. I tried these approaches with adding path, but it seems like when you use |
PERFORMANCE TESTSI tried simple prompts that require 1 tool call and some more advanced , for example these (which are in docs now):
Problems that we encountered on old version:
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:
|
| "2rc_2a", | ||
| "3rc_2a_1carrot", | ||
| "3carrots_3a_2rc", | ||
| ] |
There was a problem hiding this comment.
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:]}" |
There was a problem hiding this comment.
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.
Purpose
Improve performance of manipulation demo
Proposed Changes
examples/manipulation-demo-streamlit.pynow launches everything - simulation, robo stack and UI. No need for second terminal.Yellow cubes, blue cubes, tomatoes and corn were removed because our vision model do not recognize colors so these were easy to confuse
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