Skip to content

Commit

Permalink
run mavsdk_server from android example
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed Oct 14, 2019
1 parent 2a1c115 commit 22171f3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ build

local.properties
gradle.properties

.cxx
1 change: 1 addition & 0 deletions examples/android-client/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ dependencies {
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v8:0.7.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.2.1'
implementation 'io.mavsdk:mavsdk:0.2.0'
implementation 'io.mavsdk:mavsdk-server:0.1.1'
implementation 'org.slf4j:slf4j-api:1.7.28'

testImplementation 'junit:junit:4.12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions;
import com.mapbox.mapboxsdk.utils.ColorUtils;
import io.mavsdk.System;
import io.mavsdk.mavsdkserver.MavsdkServer;
import io.reactivex.disposables.Disposable;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -41,7 +42,7 @@
public class MapsActivity extends AppCompatActivity implements OnMapReadyCallback {
private static final Logger logger = LoggerFactory.getLogger(MapsActivity.class);

public static final String BACKEND_IP_ADDRESS = "192.168.0.15";
public static final String BACKEND_IP_ADDRESS = "127.0.0.1";

private CircleManager circleManager;
private SymbolManager symbolManager;
Expand Down Expand Up @@ -87,6 +88,11 @@ public void onResume() {
viewModel.currentPositionLiveData.observe(this, currentPositionObserver);
viewModel.currentMissionPlanLiveData.observe(this, currentMissionPlanObserver);

new Thread(() -> {
MavsdkServer mavsdkServer = new MavsdkServer();
mavsdkServer.run("udp://:14540");
}).start();

drone = new System(BACKEND_IP_ADDRESS, 50051);

disposables.add(drone.getTelemetry().getFlightMode().distinct()
Expand Down
4 changes: 4 additions & 0 deletions examples/android-client/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ include ':app'
// the README in ../../sdk for more instructions about building
// from sources.
//includeBuild '../../sdk'

// Uncomment the following line to use the mavsdk_server built
// from sources.
//includeBuild '../../mavsdk_server'

0 comments on commit 22171f3

Please sign in to comment.