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

Stretch robot restructured arm updated secondary camera image synthesis #951

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
6 changes: 2 additions & 4 deletions unity/Assets/Scripts/BaseFPSAgentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public GameObject[] TargetCircles {
protected bool snapToGrid;
protected bool continuousMode;// deprecated, use snapToGrid instead
public ImageSynthesis imageSynthesis;
// public bool enableImageSynthesis;
private bool isVisible = true;
public bool inHighFrictionArea = false;
// outbound object filter
Expand Down Expand Up @@ -619,7 +618,6 @@ public void Initialize(ServerAction action) {

if (action.renderDepthImage || action.renderSemanticSegmentation || action.renderInstanceSegmentation || action.renderNormalsImage) {
this.updateImageSynthesis(true);
// enableImageSynthesis = true;
}

if (action.visibilityDistance > 0.0f) {
Expand Down Expand Up @@ -1789,7 +1787,7 @@ public virtual MetadataWrapper generateMetadataWrapper() {
}


public void updateImageSynthesis(bool status) {
public virtual void updateImageSynthesis(bool status) {
if (this.imageSynthesis == null) {
imageSynthesis = this.gameObject.GetComponentInChildren<ImageSynthesis>() as ImageSynthesis;
}
Expand Down Expand Up @@ -3000,7 +2998,7 @@ bool includeInvisible
if (Physics.Raycast(camera.transform.position, point.position - camera.transform.position, out hit, raycastDistance, (1 << 8) | (1 << 10))) {
if (
hit.transform == sop.transform
|| (isSopHeldByArm && Arm.heldObjects[sop].Contains(hit.collider))
|| ( isSopHeldByArm && ((Arm != null && Arm.heldObjects[sop].Contains(hit.collider)) || (SArm != null && SArm.heldObjects[sop].Contains(hit.collider))) )
) {
// if this line is drawn, then this visibility point is in camera frame and not occluded
// might want to use this for a targeting check as well at some point....
Expand Down
14 changes: 11 additions & 3 deletions unity/Assets/Scripts/StretchAgentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ public partial class StretchAgentController : PhysicsRemoteFPSAgentController {
public StretchAgentController(BaseAgentComponent baseAgentComponent, AgentManager agentManager) : base(baseAgentComponent, agentManager) {
}

public override void updateImageSynthesis(bool status) {
base.updateImageSynthesis(status);

// updateImageSynthesis is run in BaseFPSController's Initialize method after the
// Stretch Agent's unique secondary camera has been added to the list of third party
// cameras in InitializeBody, so a third-party camera image synthesis update is
// necessary if we want the secondary camera's image synthesis componenent to match
// the primary camera's
agentManager.updateThirdPartyCameraImageSynthesis(status);
}

public override void InitializeBody() {
VisibilityCapsule = StretchVisCap;
m_CharacterController.center = new Vector3(0, -0.1934924f, -0.1247f);
Expand Down Expand Up @@ -44,9 +55,6 @@ public override void InitializeBody() {
fp_camera_2.transform.localEulerAngles = new Vector3(45f, 90f, 0f);
fp_camera_2.fieldOfView = 60f;
agentManager.registerAsThirdPartyCamera(fp_camera_2);
// if (enableImageSynthesis) {
agentManager.updateThirdPartyCameraImageSynthesis(true);
// }

// limit camera from looking too far down
this.maxDownwardLookAngle = 90f;
Expand Down