org.ros.android.view
Class DistanceView

java.lang.Object
  extended by GLSurfaceView
      extended by org.ros.android.view.DistanceView
All Implemented Interfaces:
org.ros.message.MessageListener<sensor_msgs.LaserScan>, org.ros.node.NodeListener, org.ros.node.NodeMain

public class DistanceView
extends GLSurfaceView
implements org.ros.node.NodeMain, org.ros.message.MessageListener<sensor_msgs.LaserScan>

An OpenGL view that displayed data from a laser scanner (or similar sensors like a kinect). This view can zoom in/out based in one of three modes. The user can change the zoom level through a pinch/reverse-pinch, the zoom level can auto adjust based on the speed of the robot, and the zoom level can also auto adjust based on the distance to the closest object around the robot.


Constructor Summary
DistanceView(Context context)
          Initialize the rendering surface.
DistanceView(Context context, AttributeSet attrs)
           
 
Method Summary
 void currentSpeed(double speed)
          Updates the current speed in distanceRenderer which then can adjust the zoom level in velocity mode.
 org.ros.namespace.GraphName getDefaultNodeName()
           
 void lockZoom()
          Prevents changes to the zoom level.
 void onError(org.ros.node.Node node, java.lang.Throwable throwable)
           
 void onNewMessage(sensor_msgs.LaserScan message)
           
 void onShutdown(org.ros.node.Node node)
           
 void onShutdownComplete(org.ros.node.Node node)
           
 void onStart(org.ros.node.ConnectedNode connectedNode)
           
 boolean onTouch(View v, MotionEvent event)
           
 void setTopicName(java.lang.String topicName)
          Sets the topic that the distance view node should subscribe to.
 void setZoomMode(ZoomMode mode)
          Sets the zoom mode to one of the modes in ZoomMode.
 void unlockZoom()
          Unlocks the zoom allowing it to be changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ros.message.MessageListener
onNewMessage
 

Constructor Detail

DistanceView

public DistanceView(Context context)
Initialize the rendering surface.

Parameters:
context -

DistanceView

public DistanceView(Context context,
                    AttributeSet attrs)
Method Detail

setTopicName

public void setTopicName(java.lang.String topicName)
Sets the topic that the distance view node should subscribe to.

Parameters:
topicName - Name of the ROS topic.

getDefaultNodeName

public org.ros.namespace.GraphName getDefaultNodeName()
Specified by:
getDefaultNodeName in interface org.ros.node.NodeMain

onStart

public void onStart(org.ros.node.ConnectedNode connectedNode)
Specified by:
onStart in interface org.ros.node.NodeListener

onShutdown

public void onShutdown(org.ros.node.Node node)
Specified by:
onShutdown in interface org.ros.node.NodeListener

onShutdownComplete

public void onShutdownComplete(org.ros.node.Node node)
Specified by:
onShutdownComplete in interface org.ros.node.NodeListener

onError

public void onError(org.ros.node.Node node,
                    java.lang.Throwable throwable)
Specified by:
onError in interface org.ros.node.NodeListener

onNewMessage

public void onNewMessage(sensor_msgs.LaserScan message)

setZoomMode

public void setZoomMode(ZoomMode mode)
Sets the zoom mode to one of the modes in ZoomMode.

Parameters:
mode - The zoom mode that must be set.

lockZoom

public void lockZoom()
Prevents changes to the zoom level.


unlockZoom

public void unlockZoom()
Unlocks the zoom allowing it to be changed.


currentSpeed

public void currentSpeed(double speed)
Updates the current speed in distanceRenderer which then can adjust the zoom level in velocity mode.

Parameters:
speed - The linear velocity of the robot.

onTouch

public boolean onTouch(View v,
                       MotionEvent event)