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

Better arm editor debugging and allowing relative arm movement. #801

Merged
merged 4 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions unity/Assets/Scripts/ArmAgentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,47 @@ protected IK_Robot_Arm_Controller getArm() {
return arm;
}


/*
This function is identical to `MoveArm` except that rather than
giving a target position you instead give an "offset" w.r.t.
the arm's (i.e. wrist's) current location.

Thus if you want to increase the
arms x position (in world coordinates) by 0.1m you should
pass in `offset=Vector3(0.1f, 0f, 0f)` and `coordinateSpace="world"`.
If you wanted to move the arm 0.1m to the "right" from the agent's
perspective then you would pass in the same offset but set
`coordinateSpace="armBase"`. Note that this last movement is **not**
the same as passing `position=Vector3(0.1f, 0f, 0f)` to the `MoveArm`
action with `coordinateSpace="wrist"` as, if the wrist has been rotated,
right need not mean the same thing to the arm base as it does to the wrist.

Finally note that when `coordinateSpace="wrist"` then both `MoveArm` and
`MoveArmRelative` are identical.
*/
public void MoveArmRelative(
Copy link
Collaborator

Choose a reason for hiding this comment

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

as mentioned in my review of #803, I'd like a quick comment summary for this action to make documentation upkeep easier.

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 have added this documentation.

Vector3 offset,
float speed = 1,
float? fixedDeltaTime = null,
bool returnToStart = true,
string coordinateSpace = "armBase",
bool restrictMovement = false,
bool disableRendering = true
) {
IK_Robot_Arm_Controller arm = getArm();
arm.moveArmRelative(
controller: this,
offset: offset,
unitsPerSecond: speed,
fixedDeltaTime: fixedDeltaTime.GetValueOrDefault(Time.fixedDeltaTime),
returnToStart: returnToStart,
coordinateSpace: coordinateSpace,
restrictTargetPosition: restrictMovement,
disableRendering: disableRendering
);
}

public void MoveArm(
Vector3 position,
float speed = 1,
Expand Down
Loading