Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurbenemann committed Oct 24, 2014
2 parents 25e3243 + 75e63e2 commit 5a71ca6
Show file tree
Hide file tree
Showing 19 changed files with 413 additions and 79 deletions.
2 changes: 2 additions & 0 deletions Android/.classpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="src" path="/Core"/>
<classpathentry exported="true" kind="src" path="/Mavlink"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
Expand Down
2 changes: 1 addition & 1 deletion Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.droidplanner"
android:versionCode="105"
android:versionCode="106"
android:versionName="please run version.sh to get the version name">

<uses-sdk
Expand Down
14 changes: 7 additions & 7 deletions Android/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
target=android-21
android.library.reference.1=../Libraries/usb-serial-for-android/UsbSerialLibrary
android.library.reference.2=../Libraries/HorizontalVariableListView/HorizontalVariableListView
android.library.reference.3=../Libraries/google-play-services_lib
android.library.reference.4=../Libraries/PebbleKit
android.library.reference.5=../Libraries/mapbox-android-sdk/0.4.0
android.library.reference.6=../Libraries/AndroidSlidingUpPanel-2.0.2/library
android.library.reference.7=../Libraries/EllipsoidFit/EllipsoidFit
android.library.reference.8=../Mavlink
android.library.reference.9=../Core
android.library.reference.3=../Mavlink
android.library.reference.4=../Core
android.library.reference.5=../Libraries/google-play-services_lib
android.library.reference.6=../Libraries/PebbleKit
android.library.reference.7=../Libraries/mapbox-android-sdk/0.4.0
android.library.reference.8=../Libraries/AndroidSlidingUpPanel-2.0.2/library
android.library.reference.9=../Libraries/EllipsoidFit/EllipsoidFit
98 changes: 98 additions & 0 deletions Android/res/layout/fragment_editor_detail_change_speed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/missionItemDetailLayout" >

<org.droidplanner.android.widgets.spinners.SpinnerSelfSelect
android:id="@+id/spinnerWaypointType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:entries="@array/ExampleWaypointType" />

<RelativeLayout
android:id="@+id/title_rect"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_alignParentTop="true"
android:background="@drawable/wp_title_rectangle" >

<TextView
android:id="@+id/WaypointIndex"
style="@style/largeMissionDetailText"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
tools:text="22" />

<View
android:id="@+id/title_div"
android:layout_width="1dp"
android:layout_height="54dp"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/WaypointIndex"
android:background="@drawable/wp_title_div" />

<RelativeLayout
android:id="@+id/title_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/title_div"
android:orientation="vertical" >

<TextView
android:id="@+id/WaypointType"
style="@style/missionHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:text="@string/waypointType_Change_Speed" />

<TextView
android:id="@+id/DistanceLabel"
style="@style/missionHeaderlabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/WaypointType"
android:layout_below="@id/WaypointType" />
</RelativeLayout>
</RelativeLayout>

<ImageView
android:id="@+id/menuHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/title_rect"
android:layout_alignParentRight="true"
android:layout_margin="10dp"
android:src="@drawable/ic_menu_hint"
tools:ignore="ContentDescription" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title_rect"
android:orientation="vertical"
android:paddingBottom="5dp" >

<TextView
style="@style/ModeDetailText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/mode_desc_rectangle"
android:padding="12dp"
android:text="@string/waypointInfo_SetSpeed" />

<org.droidplanner.android.widgets.spinnerWheel.CardWheelHorizontalView
android:id="@+id/picker1"
style="@style/missionItemDetailCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:text="@string/speed_label" />
</LinearLayout>

</RelativeLayout>
2 changes: 1 addition & 1 deletion Android/res/layout/fragment_editor_detail_takeoff.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
android:layout_marginLeft="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mission_item_title_takeoff"/>
android:text="@string/waypointType_TakeOff"/>

<TextView
android:id="@+id/DistanceLabel"
Expand Down
1 change: 1 addition & 0 deletions Android/res/values/preferences_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This file is used to store the preferences keys so that it's accessible and modi
<string name="pref_warn_on_arm_key">pref_warn_on_arm</string>
<string name="pref_auto_insert_mission_takeoff_rtl_land_key">pref_auto_insert_mission_takeoff_rtl_land</string>
<string name="pref_warn_on_takeoff_in_auto_key">pref_warn_on_takeoff_in_auto</string>
<string name="pref_warn_on_dronie_creation_key">pref_warn_on_dronie_creation</string>

<string name="pref_enable_tts_key">pref_enable_tts</string>
<string name="pref_tts_periodic_key">tts_periodic</string>
Expand Down
16 changes: 11 additions & 5 deletions Android/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,15 @@
<!-- Waypoint types -->
<string name="waypointType_Waypoint">Waypoint</string>
<string name="waypointType_SplineWaypoint">Spline Waypoint</string>
<string name="waypointType_TakeOff">Take-Off</string>
<string name="waypointType_TakeOff">Takeoff</string>
<string name="waypointType_RTL">Return To Launch</string>
<string name="waypointType_Land">Land</string>
<string name="waypointType_Change_Speed">Change Speed</string>
<string name="waypointType_Circle">Circle</string>
<string name="waypointType_Loiter">Loiter</string>
<string name="waypointType_ROI">Region of Interest</string>
<string name="waypointType_Survey">Survey Polygon</string>
<string name="waypointType_BuildingMapper">Landmark Mapper</string>
<string name="waypointType_BuildingMapper">Structure Scan</string>

<!-- Waypoint info -->
<string name="waypointInfo_Land">Land vehicle at the current location. You must manually exit Auto mode to disarm motors.</string>
Expand All @@ -199,7 +200,7 @@
<string name="waypointInfo_CondYaw">Set condition to reach a certain target angle.</string>
<string name="waypointInfo_CondDistance">Delay mission state machine until within desired distance of next NAV point</string>
<string name="waypointInfo_SetHome">Changes the home location either to the current location or a specified location.</string>
<string name="waypointInfo_SetSpeed">Change speed and/or throttle set points.Set -1 for both Speed and Throttle if no changes is required</string>
<string name="waypointInfo_SetSpeed">Change vehicle speed until the end of this mission.</string>
<string name="waypointInfo_ROI">Sets a location and altitude to point copter towards and to aim an optional camera.</string>
<string name="waypointInfo_SetJump">Repeat waypoint</string>

Expand Down Expand Up @@ -337,6 +338,7 @@
<string name="altitude_label">Altitude</string>
<string name="meter_unit">m</string>
<string name="speed_unit">m/s</string>
<string name="speed_label">Speed</string>
<string name="ground_speed_label">Ground Speed</string>
<string name="air_speed_label">Air Speed</string>
<string name="default_angle_value">--°</string>
Expand All @@ -351,6 +353,7 @@
<string name="mission_control_auto">Auto</string>
<string name="mission_control_follow">Follow</string>
<string name="mission_control_dronie">Dronie</string>
<string name="mission_control_change_speed">Change Speed</string>
<string name="telemetry_label">Telemetry</string>
<string name="flight_modes_label">Flight modes</string>
<string name="menu_info_bar">Info Bar</string>
Expand Down Expand Up @@ -476,7 +479,7 @@

<!-- Help -->
<string name="help_item_description">How to plan and fly a mission</string>
<string name="mission_item_title_takeoff">TAKEOFF</string>

<string name="label_advaned">Advanced</string>
<string name="label_steps_count">Number of Steps</string>
<string name="label_altitude_step">Altitude Step</string>
Expand All @@ -495,7 +498,7 @@
<!-- Drone locator strings -->
<string name="locator">Locator</string>
<string name="open_tlog_file">Open Log File</string>
<string name="status_waiting_for_gps">Waiting for GPS...</string>
<string name="status_waiting_for_gps">Waiting for GPS</string>

<!-- Preference dialogs -->
<string name="pref_misc_title">Miscellaneous</string>
Expand All @@ -509,5 +512,8 @@
<string name="pref_dialog_selection_reset_desc"><![CDATA[Reset selection through: Settings -> User Interface -> Preference Dialogs]]></string>
<string name="dialog_confirm_take_off_in_auto_title">Take off in Auto?</string>
<string name="dialog_confirm_take_off_in_auto_msg">Warning! The drone will now take off and start the mission.</string>
<string name="pref_dronie_creation_title">Create dronie?</string>
<string name="pref_dronie_creation_message">Please stand back 8m before starting the
dronie.</string>

</resources>
8 changes: 8 additions & 0 deletions Android/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@
android:defaultValue="@string/pref_dialog_entry_ask"
android:entryValues="@array/preference_dialog_entry"/>

<ListPreference
android:key="@string/pref_warn_on_dronie_creation_key"
android:title="@string/pref_dronie_creation_title"
android:entries="@array/preference_dialog_entry"
android:entryValues="@array/preference_dialog_entry"
android:defaultValue="@string/pref_dialog_entry_ask"
/>

</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ public void onDrawerOpened() {
resetMapBearing.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(mapFragment != null) {
mapFragment.updateMapBearing(0);
}
updateMapBearing(0);
}
});

Expand Down Expand Up @@ -237,6 +235,11 @@ private void updateMapLocationButtons(AutoPanMode mode) {
}
}

public void updateMapBearing(float bearing){
if(mapFragment != null)
mapFragment.updateMapBearing(bearing);
}

/**
* Ensures that the device has the correct version of the Google Play
* Services.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.droidplanner.android.fragments;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
Expand All @@ -14,9 +15,11 @@

import org.droidplanner.R;
import org.droidplanner.android.DroidPlannerApp;
import org.droidplanner.android.activities.FlightActivity;
import org.droidplanner.android.activities.helpers.SuperUI;
import org.droidplanner.android.dialogs.YesNoDialog;
import org.droidplanner.android.dialogs.YesNoWithPrefsDialog;
import org.droidplanner.android.proxy.mission.MissionProxy;
import org.droidplanner.android.utils.analytics.GAUtils;
import org.droidplanner.core.MAVLink.MavLinkArm;
import org.droidplanner.core.drone.DroneInterfaces;
Expand All @@ -35,7 +38,7 @@ public class CopterFlightActionsFragment extends Fragment implements View.OnClic
private static final double TAKEOFF_ALTITUDE = 10.0;

private Drone drone;

private MissionProxy missionProxy;
private Follow followMe;

private View mDisconnectedButtons;
Expand All @@ -49,13 +52,23 @@ public class CopterFlightActionsFragment extends Fragment implements View.OnClic
private Button pauseBtn;
private Button autoBtn;

@Override
public void onAttach(Activity activity){
super.onAttach(activity);
if(!(activity instanceof FlightActivity)){
throw new IllegalStateException("Parent activity must be an instance of " +
FlightActivity.class.getName());
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_copter_mission_control, container, false);

DroidPlannerApp droidPlannerApp = (DroidPlannerApp) getActivity().getApplication();
drone = droidPlannerApp.getDrone();
followMe = droidPlannerApp.getFollowMe();
missionProxy = droidPlannerApp.getMissionProxy();
return view;
}

Expand Down Expand Up @@ -208,7 +221,7 @@ public void onClick(View v) {
break;

case R.id.mc_dronieBtn:
drone.getMission().makeAndUploadDronie();
getDronieConfirmation();
eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Dronie uploaded");
break;

Expand All @@ -223,6 +236,31 @@ public void onClick(View v) {

}

private void getDronieConfirmation() {
YesNoWithPrefsDialog ynd = YesNoWithPrefsDialog.newInstance(getActivity()
.getApplicationContext(), getString(R.string.pref_dronie_creation_title),
getString(R.string.pref_dronie_creation_message), new YesNoDialog.Listener() {
@Override
public void onYes() {
final float bearing = missionProxy.makeAndUploadDronie();
if(bearing >= 0){
final FlightActivity flightActivity = (FlightActivity) getActivity();
if(flightActivity != null){
flightActivity.updateMapBearing(bearing);
}
}
}

@Override
public void onNo() {
}
}, getString(R.string.pref_warn_on_dronie_creation_key));

if(ynd != null){
ynd.show(getChildFragmentManager(), "Confirm dronie creation");
}
}

private void getTakeOffInAutoConfirmation() {
YesNoWithPrefsDialog ynd = YesNoWithPrefsDialog.newInstance(getActivity()
.getApplicationContext(), getString(R.string.dialog_confirm_take_off_in_auto_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.droidplanner.core.mission.waypoints.SpatialCoordItem;
import org.droidplanner.core.mission.waypoints.SplineWaypoint;
import org.droidplanner.core.mission.waypoints.Waypoint;
import org.droidplanner.core.model.Drone;
import org.droidplanner.core.util.Pair;

/**
Expand Down Expand Up @@ -223,16 +224,6 @@ public void addTakeoff() {
mMission.addMissionItem(takeoff);
}

public void addDronie(Coord2D start, Coord2D end) {
clear();

List<MissionItem> dronieItems = Mission.createDronie(mMission,start, end);

addMissionItems(dronieItems);
}



public void addTakeOffAndRTL(){
if(!mMission.isFirstItemTakeoff()){
final Takeoff takeOff = new Takeoff(mMission, new Altitude(Takeoff.DEFAULT_TAKEOFF_ALTITUDE));
Expand Down Expand Up @@ -569,4 +560,10 @@ public Length getMissionLength() {
return new Length(0);
}
}

public float makeAndUploadDronie() {
final double bearing = mMission.makeAndUploadDronie();
refresh();
return (float) bearing;
}
}
Loading

0 comments on commit 5a71ca6

Please sign in to comment.