Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
[map_manager] updated and compiling for indigo, but disabled add/hide…
Browse files Browse the repository at this point in the history
… layers.

This updates the api for indigo with the changes discussed in #42. It couldn't
replace the add/hide layers (that toggle the occupancy grid map) though. Fix
this when we have a turtlebot to test with.
  • Loading branch information
stonier committed Feb 23, 2015
1 parent 28121fe commit b3decf8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
import android.widget.ListView;

import com.github.rosjava.android_remocons.common_tools.apps.RosAppActivity;
import com.google.common.collect.Lists;

import org.ros.android.view.visualization.layer.Layer;
import org.ros.namespace.NameResolver;
import org.ros.node.NodeConfiguration;
import org.ros.node.NodeMainExecutor;
Expand Down Expand Up @@ -200,27 +202,32 @@ protected void init(NodeMainExecutor nodeMainExecutor) {
nodeConfiguration = NodeConfiguration.newPublic(InetAddressFactory
.newNonLoopback().getHostAddress(), getMasterUri());

CameraControlLayer cameraControlLayer = new CameraControlLayer(this,
nodeMainExecutor.getScheduledExecutorService());
CameraControlLayer cameraControlLayer = new CameraControlLayer();
cameraControlLayer.addListener(new CameraControlListener() {
@Override
public void onZoom(double focusX, double focusY, double factor) {
}
public void onZoom(float focusX, float focusY, float factor) {}

@Override
public void onDoubleTap(float x, float y) {}

@Override
public void onTranslate(float distanceX, float distanceY) {
}
public void onTranslate(float distanceX, float distanceY) {}

@Override
public void onRotate(double focusX, double focusY, double deltaAngle) {
}
public void onRotate(float focusX, float focusY, double deltaAngle) {}

});
mapView.addLayer(cameraControlLayer);
NameResolver appNameSpace = getMasterNameSpace();
String mapTopic = remaps.get(getString(R.string.map_topic));
occupancyGridLayer = new OccupancyGridLayer(appNameSpace.resolve(mapTopic).toString());
mapView.addLayer(occupancyGridLayer);

mapView.onCreate(
Lists.<Layer>newArrayList(
cameraControlLayer,
occupancyGridLayer
)
);

nodeMainExecutor.execute(mapView, nodeConfiguration.setNodeName("android/map_view"));

updateMapList();
Expand Down Expand Up @@ -249,10 +256,13 @@ public void onFailure(RemoteException e) {
@Override
public void onSuccess(PublishMapResponse message) {
safeDismissWaitingDialog();
if (!visibleMapView) {
mapView.addLayer(occupancyGridLayer);
visibleMapView = true;
}
// disabling temporarily until testing
// this api got deprecated
// see https://github.com/rosjava/android_apps/issues/42
// if (!visibleMapView) {
// mapView.addLayer(occupancyGridLayer);
// visibleMapView = true;
// }
}
});

Expand Down Expand Up @@ -381,8 +391,11 @@ public void onSuccess(DeleteMapResponse arg0) {
}
switch (radioFocusRelation) {
case 0:
mapView.hideLayer(occupancyGridLayer);
visibleMapView = false;
// disabling temporarily until testing
// this api got deprecated
// see https://github.com/rosjava/android_apps/issues/42
//mapView.hideLayer(occupancyGridLayer);
//visibleMapView = false;
radioFocus = -1;
break;
case 1:
Expand Down
2 changes: 0 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@
include 'teleop'
include 'map_nav'
include 'make_a_map'
/*
include 'map_manager'
*/

0 comments on commit b3decf8

Please sign in to comment.