-
Notifications
You must be signed in to change notification settings - Fork 247
New shots for Solo #416
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
Merged
Merged
New shots for Solo #416
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c0e617b
update gradle version
phmagic 5719dca
Added new shot messages for Pano and Zipline
phmagic 99e37ce
Update Pano messages
phmagic 89425a8
added Return To Me home point message
phmagic 8630d89
Updated based on PR comments
phmagic 7e809ef
Updated per PR review
phmagic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
...src/main/java/com/o3dr/services/android/lib/drone/companion/solo/tlv/SoloPanoOptions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| package com.o3dr.services.android.lib.drone.companion.solo.tlv; | ||
|
|
||
| import android.os.Parcel; | ||
| import android.support.annotation.IntDef; | ||
|
|
||
| import java.nio.ByteBuffer; | ||
|
|
||
| /** | ||
| * Created by phu on 6/24/16. | ||
| */ | ||
| public class SoloPanoOptions extends TLVPacket { | ||
|
|
||
| public static final int MESSAGE_LENGTH = 12; | ||
|
|
||
| /** | ||
| * Pano can automatically run, is it running? | ||
| */ | ||
| private static final int PANO_ON_VALUE = 1; | ||
| private static final int PANO_OFF_VALUE = 0; | ||
|
|
||
| private boolean isRunning; | ||
|
|
||
| /** | ||
| * Pano has multiple sub modes | ||
| */ | ||
| @IntDef({ | ||
| PANO_PREFERENCE_CYLINDRICAL, | ||
| PANO_PREFERENCE_SPHERICAL, | ||
| PANO_PREFERENCE_VIDEO | ||
| }) | ||
| public @interface PanoPreference{} | ||
|
|
||
| public static final int PANO_PREFERENCE_CYLINDRICAL = 0; | ||
| public static final int PANO_PREFERENCE_SPHERICAL = 1; | ||
| public static final int PANO_PREFERENCE_VIDEO = 2; | ||
| @PanoPreference | ||
| private int panoPreference; | ||
|
|
||
| /** | ||
| * Pan angle (used in cylindrical) | ||
| */ | ||
| private short panAngle; | ||
|
|
||
| /** | ||
| * Yaw speed (used in video) | ||
| */ | ||
| private float degreesPerSecondYawSpeed; | ||
|
|
||
| /** | ||
| * Camera FOV | ||
| */ | ||
| private float cameraFOV; | ||
|
|
||
| public boolean isRunning() { | ||
| return isRunning; | ||
| } | ||
|
|
||
| public void setRunning(boolean running) { | ||
| isRunning = running; | ||
| } | ||
|
|
||
| @PanoPreference | ||
| public int getPanoPreference() { | ||
| return panoPreference; | ||
| } | ||
|
|
||
| public void setPanoPreference(@PanoPreference int panoPreference) { | ||
| this.panoPreference = panoPreference; | ||
| } | ||
|
|
||
| public short getPanAngle() { | ||
| return panAngle; | ||
| } | ||
|
|
||
| public void setPanAngle(short panAngle) { | ||
| this.panAngle = panAngle; | ||
| } | ||
|
|
||
| public float getDegreesPerSecondYawSpeed() { | ||
| return degreesPerSecondYawSpeed; | ||
| } | ||
|
|
||
| public void setDegreesPerSecondYawSpeed(float degreesPerSecondYawSpeed) { | ||
| this.degreesPerSecondYawSpeed = degreesPerSecondYawSpeed; | ||
| } | ||
|
|
||
| public float getCameraFOV() { | ||
| return cameraFOV; | ||
| } | ||
|
|
||
| public void setCameraFOV(float cameraFOV) { | ||
| this.cameraFOV = cameraFOV; | ||
| } | ||
|
|
||
| public SoloPanoOptions(int panoPreference, boolean isRunning, short panAngle, float degreesPerSecondYawSpeed, float cameraFOV) { | ||
| super(TLVMessageTypes.TYPE_SOLO_PANO_OPTIONS, MESSAGE_LENGTH); | ||
| this.panoPreference = panoPreference; | ||
| this.isRunning = isRunning; | ||
| this.panAngle = panAngle; | ||
| this.degreesPerSecondYawSpeed = degreesPerSecondYawSpeed; | ||
| this.cameraFOV = cameraFOV; | ||
| } | ||
|
|
||
| SoloPanoOptions(ByteBuffer buffer) { | ||
| this(buffer.get(), buffer.get() == PANO_ON_VALUE, (short) buffer.getShort(), buffer.getFloat(), buffer.getFloat()); | ||
| } | ||
|
|
||
| @Override | ||
| protected void getMessageValue(ByteBuffer valueCarrier) { | ||
| valueCarrier.put((byte) panoPreference); | ||
| valueCarrier.put((byte) (isRunning ? 1 : 0)); | ||
| valueCarrier.putShort(panAngle); | ||
| valueCarrier.putFloat(degreesPerSecondYawSpeed); | ||
| valueCarrier.putFloat(cameraFOV); | ||
| } | ||
|
|
||
| @Override | ||
| public void writeToParcel(Parcel dest, int flags) { | ||
| super.writeToParcel(dest, flags); | ||
| dest.writeByte((byte) panoPreference); | ||
| dest.writeByte(isRunning ? (byte) 1 : (byte) 0); | ||
| dest.writeInt(panAngle); | ||
| dest.writeFloat(degreesPerSecondYawSpeed); | ||
| dest.writeFloat(cameraFOV); | ||
| } | ||
|
|
||
| protected SoloPanoOptions(Parcel in) { | ||
| super(in); | ||
| @PanoPreference int panoPreference = (int)in.readByte(); | ||
| this.panoPreference = panoPreference; | ||
| this.isRunning = in.readByte() != 0; | ||
| this.panAngle = (short) in.readInt(); | ||
| this.degreesPerSecondYawSpeed = in.readFloat(); | ||
| this.cameraFOV = in.readFloat(); | ||
| } | ||
|
|
||
| public static final Creator<SoloPanoOptions> CREATOR = new Creator<SoloPanoOptions>() { | ||
| public SoloPanoOptions createFromParcel(Parcel source) { | ||
| return new SoloPanoOptions(source); | ||
| } | ||
|
|
||
| public SoloPanoOptions[] newArray(int size) { | ||
| return new SoloPanoOptions[size]; | ||
| } | ||
| }; | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "SoloPanoOptions{" + | ||
| "panoPreference=" + panoPreference + | ||
| "isRunning=" + isRunning + | ||
| "panAngle=" + panAngle + | ||
| "degreesPerSecondYawSpeed=" + degreesPerSecondYawSpeed + | ||
| "cameraFOV=" + cameraFOV + | ||
| '}'; | ||
| } | ||
| } | ||
71 changes: 71 additions & 0 deletions
71
.../src/main/java/com/o3dr/services/android/lib/drone/companion/solo/tlv/SoloPanoStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| package com.o3dr.services.android.lib.drone.companion.solo.tlv; | ||
|
|
||
| import android.os.Parcel; | ||
|
|
||
| import java.nio.ByteBuffer; | ||
|
|
||
| /** | ||
| * Created by phu on 7/17/16. | ||
| */ | ||
| public class SoloPanoStatus extends TLVPacket { | ||
|
|
||
| public static final int MESSAGE_LENGTH = 2; | ||
|
|
||
| private byte currentStep; | ||
| private byte totalSteps; | ||
|
|
||
| public SoloPanoStatus(byte currentStep, byte totalSteps) { | ||
| super(TLVMessageTypes.TYPE_SOLO_PANO_STATUS, MESSAGE_LENGTH); | ||
| this.currentStep = currentStep; | ||
| this.totalSteps = totalSteps; | ||
| } | ||
|
|
||
| SoloPanoStatus(ByteBuffer buffer) { | ||
| this(buffer.get(), buffer.get()); | ||
| } | ||
|
|
||
| @Override | ||
| protected void getMessageValue(ByteBuffer valueCarrier) { | ||
| valueCarrier.put(currentStep); | ||
| valueCarrier.put(totalSteps); | ||
| } | ||
|
|
||
| @Override | ||
| public void writeToParcel(Parcel dest, int flags) { | ||
| super.writeToParcel(dest, flags); | ||
| dest.writeByte(currentStep); | ||
| dest.writeByte(totalSteps); | ||
| } | ||
|
|
||
| protected SoloPanoStatus(Parcel in) { | ||
| super(in); | ||
| this.currentStep = in.readByte(); | ||
| this.totalSteps = in.readByte(); | ||
| } | ||
|
|
||
| public static final Creator<SoloPanoStatus> CREATOR = new Creator<SoloPanoStatus>() { | ||
| public SoloPanoStatus createFromParcel(Parcel source) { | ||
| return new SoloPanoStatus(source); | ||
| } | ||
| public SoloPanoStatus[] newArray(int size) { | ||
| return new SoloPanoStatus[size]; | ||
| } | ||
| }; | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "SoloPanoStatus{" + | ||
| "currentStep=" + currentStep + | ||
| "totalSteps=" + totalSteps + | ||
| '}'; | ||
| } | ||
|
|
||
| public int getCurrentStep() { | ||
| return currentStep; | ||
| } | ||
|
|
||
| public int getTotalSteps() { | ||
| return totalSteps; | ||
| } | ||
|
|
||
| } |
61 changes: 61 additions & 0 deletions
61
...com/o3dr/services/android/lib/drone/companion/solo/tlv/SoloReturnHomeLocationMessage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package com.o3dr.services.android.lib.drone.companion.solo.tlv; | ||
|
|
||
| import android.os.Parcel; | ||
|
|
||
| import com.o3dr.services.android.lib.coordinate.LatLongAlt; | ||
|
|
||
| import java.nio.ByteBuffer; | ||
|
|
||
| /** | ||
| * Created by phu on 7/21/16. | ||
| */ | ||
| public class SoloReturnHomeLocationMessage extends TLVPacket { | ||
|
|
||
| private LatLongAlt coordinate; | ||
|
|
||
| public SoloReturnHomeLocationMessage(double latitude, double longitude, float altitudeInMeters) { | ||
| super(TLVMessageTypes.TYPE_RTL_HOME_POINT, 20); | ||
| this.coordinate = new LatLongAlt(latitude, longitude, altitudeInMeters); | ||
| } | ||
|
|
||
| public SoloReturnHomeLocationMessage(LatLongAlt coordinate){ | ||
| super(TLVMessageTypes.TYPE_RTL_HOME_POINT, 20); | ||
| this.coordinate = coordinate; | ||
| } | ||
|
|
||
| public LatLongAlt getCoordinate() { | ||
| return coordinate; | ||
| } | ||
|
|
||
| public void setCoordinate(LatLongAlt coordinate) { | ||
| this.coordinate = coordinate; | ||
| } | ||
|
|
||
| @Override | ||
| protected void getMessageValue(ByteBuffer valueCarrier) { | ||
| valueCarrier.putDouble(coordinate.getLatitude()); | ||
| valueCarrier.putDouble(coordinate.getLongitude()); | ||
| valueCarrier.putFloat((float) coordinate.getAltitude()); | ||
| } | ||
|
|
||
| @Override | ||
| public void writeToParcel(Parcel dest, int flags) { | ||
| super.writeToParcel(dest, flags); | ||
| dest.writeParcelable(this.coordinate, flags); | ||
| } | ||
|
|
||
| protected SoloReturnHomeLocationMessage(Parcel in) { | ||
| super(in); | ||
| this.coordinate = in.readParcelable(LatLongAlt.class.getClassLoader()); | ||
| } | ||
|
|
||
| public static final Creator<SoloReturnHomeLocationMessage> CREATOR = new Creator<SoloReturnHomeLocationMessage>() { | ||
| public SoloReturnHomeLocationMessage createFromParcel(Parcel source) { | ||
| return new SoloReturnHomeLocationMessage(source); | ||
| } | ||
|
|
||
| public SoloReturnHomeLocationMessage[] newArray(int size) { | ||
| return new SoloReturnHomeLocationMessage[size]; | ||
| } | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@phmagic the first parameter is an
int, sobuffer.getInt()should be used instead.buffer.getShort()doesn't need a cast as well.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.
@phmagic nevermind, I see below you're storing the
panoPreferenceas a byte.