Class NavigationModel

  • Direct Known Subclasses:
    EV3NavigationModel

    public abstract class NavigationModel
    extends java.lang.Object
    NavigationModel is an abstract class that has two implementations: NXTNavigationModel and PCNavigationModel. It is used to hold all navigation data and transmit updates to the date and other events between a NXT brick and the PC. The abstract NAvigationModel class defines all the events and all data and methods that are common to the NXT and PC implementations. The purpose of NavigationModel and the NXT and PC implementations is to to allow navigation tasks to be split between the NXT and the PC, to allow the PC to show a graphical display of the navigational data and allow the user to interact with it. This allows many different navigation applications to be developed which split processing between the PC and the NXT.
    Author:
    Lawrie Griffiths
    • Field Detail

      • nxtName

        protected java.lang.String nxtName
      • dis

        protected java.io.DataInputStream dis
      • dos

        protected java.io.DataOutputStream dos
      • numReadings

        protected int numReadings
      • currentPose

        protected Pose currentPose
      • path

        protected Path path
      • lastMove

        protected Move lastMove
      • lastPlannedMove

        protected Move lastPlannedMove
      • debug

        protected boolean debug
    • Constructor Detail

      • NavigationModel

        public NavigationModel()
    • Method Detail

      • hasMap

        public boolean hasMap()
        Test is the model has a map registered
        Returns:
        true iff a map is registered
      • getMap

        public LineMap getMap()
        Get the registered map
        Returns:
        the LineMap
      • setNumReadings

        public void setNumReadings​(int number)
        Set the number of readings for MCL
        Parameters:
        number - the number of readings
      • getRobotPose

        public Pose getRobotPose()
        Get the current pose of the robot
        Returns:
        the robot pose
      • getParticles

        public MCLParticleSet getParticles()
        Get the registered particle set
        Returns:
        the MCLParticleSet or null
      • setRobotPose

        public void setRobotPose​(Pose p)
        Set the current robot pose
        Parameters:
        p - the pose
      • setParticleSet

        public void setParticleSet​(MCLParticleSet particles)
        Set the MCL Particle set
        Parameters:
        particles - an MCLParticleSet
      • getReadings

        public RangeReadings getReadings()
        Get the current range readings
        Returns:
        the RangeReadings object
      • setTarget

        public void setTarget​(Waypoint target)
        Set the target waypoint that the robot is to go to
        Parameters:
        target - the target waypoint
      • getTarget

        public Waypoint getTarget()
        Get the target waypoint
        Returns:
        the target waypoint
      • getPath

        public Path getPath()
        Get the registered path
        Returns:
        the Path object
      • setDebug

        public void setDebug​(boolean on)
        Set debug output on of off
        Parameters:
        on - true for on, false for off