Skip to content

Commit 5a71ca6

Browse files
Merge branch 'master' into beta
2 parents 25e3243 + 75e63e2 commit 5a71ca6

File tree

19 files changed

+413
-79
lines changed

19 files changed

+413
-79
lines changed

Android/.classpath

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3+
<classpathentry exported="true" kind="src" path="/Core"/>
4+
<classpathentry exported="true" kind="src" path="/Mavlink"/>
35
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
46
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
57
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>

Android/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
package="org.droidplanner"
5-
android:versionCode="105"
5+
android:versionCode="106"
66
android:versionName="please run version.sh to get the version name">
77

88
<uses-sdk

Android/project.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
target=android-21
1515
android.library.reference.1=../Libraries/usb-serial-for-android/UsbSerialLibrary
1616
android.library.reference.2=../Libraries/HorizontalVariableListView/HorizontalVariableListView
17-
android.library.reference.3=../Libraries/google-play-services_lib
18-
android.library.reference.4=../Libraries/PebbleKit
19-
android.library.reference.5=../Libraries/mapbox-android-sdk/0.4.0
20-
android.library.reference.6=../Libraries/AndroidSlidingUpPanel-2.0.2/library
21-
android.library.reference.7=../Libraries/EllipsoidFit/EllipsoidFit
22-
android.library.reference.8=../Mavlink
23-
android.library.reference.9=../Core
17+
android.library.reference.3=../Mavlink
18+
android.library.reference.4=../Core
19+
android.library.reference.5=../Libraries/google-play-services_lib
20+
android.library.reference.6=../Libraries/PebbleKit
21+
android.library.reference.7=../Libraries/mapbox-android-sdk/0.4.0
22+
android.library.reference.8=../Libraries/AndroidSlidingUpPanel-2.0.2/library
23+
android.library.reference.9=../Libraries/EllipsoidFit/EllipsoidFit
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
style="@style/missionItemDetailLayout" >
5+
6+
<org.droidplanner.android.widgets.spinners.SpinnerSelfSelect
7+
android:id="@+id/spinnerWaypointType"
8+
android:layout_width="match_parent"
9+
android:layout_height="wrap_content"
10+
android:layout_alignParentTop="true"
11+
android:layout_margin="5dp"
12+
android:entries="@array/ExampleWaypointType" />
13+
14+
<RelativeLayout
15+
android:id="@+id/title_rect"
16+
android:layout_width="match_parent"
17+
android:layout_height="64dp"
18+
android:layout_alignParentTop="true"
19+
android:background="@drawable/wp_title_rectangle" >
20+
21+
<TextView
22+
android:id="@+id/WaypointIndex"
23+
style="@style/largeMissionDetailText"
24+
android:layout_width="64dp"
25+
android:layout_height="wrap_content"
26+
android:layout_centerVertical="true"
27+
tools:text="22" />
28+
29+
<View
30+
android:id="@+id/title_div"
31+
android:layout_width="1dp"
32+
android:layout_height="54dp"
33+
android:layout_alignParentTop="true"
34+
android:layout_marginTop="5dp"
35+
android:layout_toRightOf="@id/WaypointIndex"
36+
android:background="@drawable/wp_title_div" />
37+
38+
<RelativeLayout
39+
android:id="@+id/title_content"
40+
android:layout_width="match_parent"
41+
android:layout_height="wrap_content"
42+
android:layout_centerVertical="true"
43+
android:layout_toRightOf="@id/title_div"
44+
android:orientation="vertical" >
45+
46+
<TextView
47+
android:id="@+id/WaypointType"
48+
style="@style/missionHeaderTitle"
49+
android:layout_width="wrap_content"
50+
android:layout_height="wrap_content"
51+
android:layout_marginLeft="12dp"
52+
android:text="@string/waypointType_Change_Speed" />
53+
54+
<TextView
55+
android:id="@+id/DistanceLabel"
56+
style="@style/missionHeaderlabel"
57+
android:layout_width="wrap_content"
58+
android:layout_height="wrap_content"
59+
android:layout_alignLeft="@id/WaypointType"
60+
android:layout_below="@id/WaypointType" />
61+
</RelativeLayout>
62+
</RelativeLayout>
63+
64+
<ImageView
65+
android:id="@+id/menuHint"
66+
android:layout_width="wrap_content"
67+
android:layout_height="wrap_content"
68+
android:layout_alignBottom="@id/title_rect"
69+
android:layout_alignParentRight="true"
70+
android:layout_margin="10dp"
71+
android:src="@drawable/ic_menu_hint"
72+
tools:ignore="ContentDescription" />
73+
74+
<LinearLayout
75+
android:layout_width="match_parent"
76+
android:layout_height="wrap_content"
77+
android:layout_below="@id/title_rect"
78+
android:orientation="vertical"
79+
android:paddingBottom="5dp" >
80+
81+
<TextView
82+
style="@style/ModeDetailText"
83+
android:layout_width="wrap_content"
84+
android:layout_height="wrap_content"
85+
android:background="@drawable/mode_desc_rectangle"
86+
android:padding="12dp"
87+
android:text="@string/waypointInfo_SetSpeed" />
88+
89+
<org.droidplanner.android.widgets.spinnerWheel.CardWheelHorizontalView
90+
android:id="@+id/picker1"
91+
style="@style/missionItemDetailCard"
92+
android:layout_width="match_parent"
93+
android:layout_height="wrap_content"
94+
android:orientation="vertical"
95+
android:text="@string/speed_label" />
96+
</LinearLayout>
97+
98+
</RelativeLayout>

Android/res/layout/fragment_editor_detail_takeoff.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
android:layout_marginLeft="12dp"
5353
android:layout_width="wrap_content"
5454
android:layout_height="wrap_content"
55-
android:text="@string/mission_item_title_takeoff"/>
55+
android:text="@string/waypointType_TakeOff"/>
5656

5757
<TextView
5858
android:id="@+id/DistanceLabel"

Android/res/values/preferences_keys.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This file is used to store the preferences keys so that it's accessible and modi
4444
<string name="pref_warn_on_arm_key">pref_warn_on_arm</string>
4545
<string name="pref_auto_insert_mission_takeoff_rtl_land_key">pref_auto_insert_mission_takeoff_rtl_land</string>
4646
<string name="pref_warn_on_takeoff_in_auto_key">pref_warn_on_takeoff_in_auto</string>
47+
<string name="pref_warn_on_dronie_creation_key">pref_warn_on_dronie_creation</string>
4748

4849
<string name="pref_enable_tts_key">pref_enable_tts</string>
4950
<string name="pref_tts_periodic_key">tts_periodic</string>

Android/res/values/strings.xml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,15 @@
177177
<!-- Waypoint types -->
178178
<string name="waypointType_Waypoint">Waypoint</string>
179179
<string name="waypointType_SplineWaypoint">Spline Waypoint</string>
180-
<string name="waypointType_TakeOff">Take-Off</string>
180+
<string name="waypointType_TakeOff">Takeoff</string>
181181
<string name="waypointType_RTL">Return To Launch</string>
182182
<string name="waypointType_Land">Land</string>
183+
<string name="waypointType_Change_Speed">Change Speed</string>
183184
<string name="waypointType_Circle">Circle</string>
184185
<string name="waypointType_Loiter">Loiter</string>
185186
<string name="waypointType_ROI">Region of Interest</string>
186187
<string name="waypointType_Survey">Survey Polygon</string>
187-
<string name="waypointType_BuildingMapper">Landmark Mapper</string>
188+
<string name="waypointType_BuildingMapper">Structure Scan</string>
188189

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

@@ -337,6 +338,7 @@
337338
<string name="altitude_label">Altitude</string>
338339
<string name="meter_unit">m</string>
339340
<string name="speed_unit">m/s</string>
341+
<string name="speed_label">Speed</string>
340342
<string name="ground_speed_label">Ground Speed</string>
341343
<string name="air_speed_label">Air Speed</string>
342344
<string name="default_angle_value">--°</string>
@@ -351,6 +353,7 @@
351353
<string name="mission_control_auto">Auto</string>
352354
<string name="mission_control_follow">Follow</string>
353355
<string name="mission_control_dronie">Dronie</string>
356+
<string name="mission_control_change_speed">Change Speed</string>
354357
<string name="telemetry_label">Telemetry</string>
355358
<string name="flight_modes_label">Flight modes</string>
356359
<string name="menu_info_bar">Info Bar</string>
@@ -476,7 +479,7 @@
476479

477480
<!-- Help -->
478481
<string name="help_item_description">How to plan and fly a mission</string>
479-
<string name="mission_item_title_takeoff">TAKEOFF</string>
482+
480483
<string name="label_advaned">Advanced</string>
481484
<string name="label_steps_count">Number of Steps</string>
482485
<string name="label_altitude_step">Altitude Step</string>
@@ -495,7 +498,7 @@
495498
<!-- Drone locator strings -->
496499
<string name="locator">Locator</string>
497500
<string name="open_tlog_file">Open Log File</string>
498-
<string name="status_waiting_for_gps">Waiting for GPS...</string>
501+
<string name="status_waiting_for_gps">Waiting for GPS</string>
499502

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

513519
</resources>

Android/res/xml/preferences.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,14 @@
168168
android:defaultValue="@string/pref_dialog_entry_ask"
169169
android:entryValues="@array/preference_dialog_entry"/>
170170

171+
<ListPreference
172+
android:key="@string/pref_warn_on_dronie_creation_key"
173+
android:title="@string/pref_dronie_creation_title"
174+
android:entries="@array/preference_dialog_entry"
175+
android:entryValues="@array/preference_dialog_entry"
176+
android:defaultValue="@string/pref_dialog_entry_ask"
177+
/>
178+
171179
</PreferenceScreen>
172180
</PreferenceCategory>
173181
</PreferenceScreen>

Android/src/org/droidplanner/android/activities/FlightActivity.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ public void onDrawerOpened() {
119119
resetMapBearing.setOnClickListener(new View.OnClickListener() {
120120
@Override
121121
public void onClick(View v) {
122-
if(mapFragment != null) {
123-
mapFragment.updateMapBearing(0);
124-
}
122+
updateMapBearing(0);
125123
}
126124
});
127125

@@ -237,6 +235,11 @@ private void updateMapLocationButtons(AutoPanMode mode) {
237235
}
238236
}
239237

238+
public void updateMapBearing(float bearing){
239+
if(mapFragment != null)
240+
mapFragment.updateMapBearing(bearing);
241+
}
242+
240243
/**
241244
* Ensures that the device has the correct version of the Google Play
242245
* Services.

Android/src/org/droidplanner/android/fragments/CopterFlightActionsFragment.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.droidplanner.android.fragments;
22

3+
import android.app.Activity;
34
import android.graphics.Color;
45
import android.os.Bundle;
56
import android.support.v4.app.Fragment;
@@ -14,9 +15,11 @@
1415

1516
import org.droidplanner.R;
1617
import org.droidplanner.android.DroidPlannerApp;
18+
import org.droidplanner.android.activities.FlightActivity;
1719
import org.droidplanner.android.activities.helpers.SuperUI;
1820
import org.droidplanner.android.dialogs.YesNoDialog;
1921
import org.droidplanner.android.dialogs.YesNoWithPrefsDialog;
22+
import org.droidplanner.android.proxy.mission.MissionProxy;
2023
import org.droidplanner.android.utils.analytics.GAUtils;
2124
import org.droidplanner.core.MAVLink.MavLinkArm;
2225
import org.droidplanner.core.drone.DroneInterfaces;
@@ -35,7 +38,7 @@ public class CopterFlightActionsFragment extends Fragment implements View.OnClic
3538
private static final double TAKEOFF_ALTITUDE = 10.0;
3639

3740
private Drone drone;
38-
41+
private MissionProxy missionProxy;
3942
private Follow followMe;
4043

4144
private View mDisconnectedButtons;
@@ -49,13 +52,23 @@ public class CopterFlightActionsFragment extends Fragment implements View.OnClic
4952
private Button pauseBtn;
5053
private Button autoBtn;
5154

55+
@Override
56+
public void onAttach(Activity activity){
57+
super.onAttach(activity);
58+
if(!(activity instanceof FlightActivity)){
59+
throw new IllegalStateException("Parent activity must be an instance of " +
60+
FlightActivity.class.getName());
61+
}
62+
}
63+
5264
@Override
5365
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
5466
View view = inflater.inflate(R.layout.fragment_copter_mission_control, container, false);
5567

5668
DroidPlannerApp droidPlannerApp = (DroidPlannerApp) getActivity().getApplication();
5769
drone = droidPlannerApp.getDrone();
5870
followMe = droidPlannerApp.getFollowMe();
71+
missionProxy = droidPlannerApp.getMissionProxy();
5972
return view;
6073
}
6174

@@ -208,7 +221,7 @@ public void onClick(View v) {
208221
break;
209222

210223
case R.id.mc_dronieBtn:
211-
drone.getMission().makeAndUploadDronie();
224+
getDronieConfirmation();
212225
eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Dronie uploaded");
213226
break;
214227

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

224237
}
225238

239+
private void getDronieConfirmation() {
240+
YesNoWithPrefsDialog ynd = YesNoWithPrefsDialog.newInstance(getActivity()
241+
.getApplicationContext(), getString(R.string.pref_dronie_creation_title),
242+
getString(R.string.pref_dronie_creation_message), new YesNoDialog.Listener() {
243+
@Override
244+
public void onYes() {
245+
final float bearing = missionProxy.makeAndUploadDronie();
246+
if(bearing >= 0){
247+
final FlightActivity flightActivity = (FlightActivity) getActivity();
248+
if(flightActivity != null){
249+
flightActivity.updateMapBearing(bearing);
250+
}
251+
}
252+
}
253+
254+
@Override
255+
public void onNo() {
256+
}
257+
}, getString(R.string.pref_warn_on_dronie_creation_key));
258+
259+
if(ynd != null){
260+
ynd.show(getChildFragmentManager(), "Confirm dronie creation");
261+
}
262+
}
263+
226264
private void getTakeOffInAutoConfirmation() {
227265
YesNoWithPrefsDialog ynd = YesNoWithPrefsDialog.newInstance(getActivity()
228266
.getApplicationContext(), getString(R.string.dialog_confirm_take_off_in_auto_title),

0 commit comments

Comments
 (0)