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

Implement Full Schema using MoveIt2Servo #122

Merged
merged 15 commits into from
Oct 30, 2023
Merged

Conversation

egordon
Copy link
Collaborator

@egordon egordon commented Oct 18, 2023

Description

Implement the full acquisition schema.

Testing procedure

Tested w/ Action 0 (i.e. just straight down and up).

Observed occasional errors:

  • Misses the carrot (camera calibration? or detection before robot has finished moving above plate, maybe add an 0.5s delay?)
  • Delay on twist execution means that the robot does not move as far as expected during extraction. Okay for now, need to investigate later
  • Carrot depth occasionally off (TODO later: verify against depth camera)

Before opening a pull request

  • Format your code using black formatter python3 -m black .
  • Run your code through pylint and address all warnings/errors. The only warnings that are acceptable to not address is TODOs that should be addressed in a future PR. From the top-level ada_feeding directory, run: pylint --recursive=y --rcfile=.pylintrc ..

Before Merging

  • Squash & Merge

@egordon egordon self-assigned this Oct 27, 2023
@egordon egordon marked this pull request as ready for review October 27, 2023 02:50
@amalnanavati
Copy link
Contributor

Re. the following:

or detection before robot has finished moving above plate, maybe add an 0.5s delay?

The app shows the user a live video stream, so assuming the user has at least a 0.5s delay before selecting a point on the screen, that delay is essentially there.

Copy link
Contributor

@amalnanavati amalnanavati left a comment

Choose a reason for hiding this comment

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

LGTM. A few small comments but nothing that requires re-review.

@@ -127,8 +218,8 @@ def create_tree(
wait_for_server_timeout_sec=0.0,
),
# Get MoveIt2 Constraints
ComputeApproachConstraints(
name="ComputeApproachConstraints",
ComputeActionConstraints(
Copy link
Contributor

Choose a reason for hiding this comment

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

This could potentially block forever (e.g., if the tf or moveit lock is not available, or if the approach frame was not registered by the TF tree). Do we want to add a Timeout for that?

# Docstring copied from @override

# Input Validation
if not self.blackboard_exists("stamped_msg") or not self.blackboard_exists(
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that as of #124 , you can pass a list into blackboard_exists

from ada_feeding.helpers import BlackboardKey
from ada_feeding.idioms import (
pre_moveto_config,
scoped_behavior,
retry_call_ros_service,
)
from ada_feeding.idioms.pre_moveto_config import set_parameter_response_all_success
from ada_feeding.trees import StartServoTree, StopServoTree
from ada_feeding.visitors import MoveToVisitor
from ada_feeding_msgs.action import AcquireFood
from ada_feeding_msgs.srv import AcquisitionSelect
Copy link
Contributor

Choose a reason for hiding this comment

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

Heads-up that some versions of pylint view imports from ada_feeding_msgs as "Third-party" and not as "Local." To address this, I'd recommend putting inputs from ada_feeding_msgs at the top of the "Local" block, to accommodate both versions of pylint.

twist=Twist(),
)

### Define Tree Leaf Nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the motivation for defining these leaf nodes separately, but the other leaf nodes as part of the XML-like definition?

I think having these leaf nodes be separate is a bit confusing to read since it is unclear where variables like approach_thresh get written to the blackboard. Whereas if you define these leaf nodes in the tree structure, then readers would already have seen that Compute... outputs those blackboard variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Incorporated into tree.

), # GraspRetry Sequence
), # GraspRetryInfinite SuccessIsRunning
), # GraspServoTimeout TimeoutFromBlackboard
), # GraspSucceed FailureIsSuccess
Copy link
Contributor

Choose a reason for hiding this comment

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

This helps readability a lot -- thanks!

name="GraspRetry",
memory=True,
children=[
UpdateTimestamp(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we use the UpdateTimestamp + publishers.FromBlackboard sequence enough (4x in this file alone) that it makes sense to make it an idiom.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I might just wrap this whole thing into a ServoMove Behavior anyway to more easily combine with MoveToVisitor, so that would encompass everything within Timeout(SuccessIsRunning(Sequence(...))) into a single value.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@egordon
Copy link
Collaborator Author

egordon commented Oct 30, 2023

Updates tested again in sim.

@egordon egordon merged commit 473e356 into ros2-devel Oct 30, 2023
@egordon egordon deleted the egordon/full_schema branch October 30, 2023 23:37
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.

2 participants