Skip to content

Commit

Permalink
Fix to stretch arm initialization not including gripper variants in c…
Browse files Browse the repository at this point in the history
…ollision listener logic
  • Loading branch information
winthos committed Jul 26, 2024
1 parent c87dcc0 commit 3de253a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 6 additions & 6 deletions unity/Assets/Scripts/RobotArmTest/stretch_arm_rig_gripper.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &3520020699051343488
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -29256,7 +29256,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &4305213092866356922
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -36573,7 +36573,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &5141672049479370786
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -47082,7 +47082,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &261595647541202395
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -48173,7 +48173,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &3448685651741388282
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -50975,7 +50975,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &1789519952878528289
Transform:
m_ObjectHideFlags: 0
Expand Down
7 changes: 6 additions & 1 deletion unity/Assets/Scripts/StretchAgentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,12 @@ protected int gripperOpenFloatToState(float openness) {
}

public ActionFinished SetGripperOpenness(float? openness, int? openState = null) {
setGripperOpenness(openness: openness, openState: openState);
return ActionFinished.Success;
}

//moving this to a helper function so we can call it without sending back an ActionFinished call
public void setGripperOpenness(float? openness, int? openState = null) {
if (openness.HasValue == openState.HasValue) {
throw new InvalidOperationException(
$"Only one of openness or openState should have a value"
Expand All @@ -583,7 +589,6 @@ public ActionFinished SetGripperOpenness(float? openness, int? openState = null)

GripperOpennessStates[openState.Value].SetActive(true);
gripperOpennessState = openState.Value;
return ActionFinished.Success;
}

// public void RotateCameraBase(float yawDegrees, float rollDegrees) {
Expand Down
3 changes: 3 additions & 0 deletions unity/Assets/Scripts/Stretch_Robot_Arm_Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ void Start() {
}

solver = this.gameObject.GetComponentInChildren<Stretch_Arm_Solver>();

//call SetGripperOpenness logic in StretchAgentController here
((StretchAgentController)PhysicsController).setGripperOpenness(openness: null, openState: 1);
}

public void resetPosRotManipulator() {
Expand Down

0 comments on commit 3de253a

Please sign in to comment.