view main/robots/odr-sim/SimDisplay.h @ 224:5e91f5877f1f main

Latest simulator changes.
author Bob Cook <bob@bobcookdev.com>
date Thu, 17 Apr 2014 22:03:28 -0700
parents 4ef780aebd7e
children 783f69f37c64
line wrap: on
line source

// ----------------------------------------------------------------------------------------
//
//  robots/odr-sim/SimDisplay.h
//    
//  Bob Cook Development, Robotics Library
//  http://www.bobcookdev.com/rl/
//    
//  Window display for the ODR platform simulator.
//
//  Copyright (c) 2011 Bob Cook
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
//
// ----------------------------------------------------------------------------------------

#ifndef BCDRL_ROBOTS_ODRSIM_SIMDISPLAY_H
#define BCDRL_ROBOTS_ODRSIM_SIMDISPLAY_H

#include <stdint.h>

#include <Poco/Timer.h>

class Fl_Box;
class Fl_Dial;
class Fl_Double_Window;
class Fl_Hor_Slider;
class Fl_Light_Button;
class Fl_Line_Dial;
class Fl_Slider;
class Fl_Toggle_Button;

// ----------------------------------------------------------------------------------------

class SimDisplay
{
    public:
        SimDisplay();
        virtual ~SimDisplay();
        void showDisplay();
        void updateMotorSpeeds( int front, int rear );
        void updateServoPositions( int front, int rear );
        void updateManagerMsg( const char* msg, int length );
        void doMgrHeartbeat();
        void resetMgrHeartbeat();
        void updateImuValues();
        void updateSonarFrontState( bool enabled );
        void updateSonarFrontValues();

    private:
        Fl_Double_Window* m_window;
        Fl_Line_Dial*     m_dialMotorSpeedFront;
        Fl_Box*           m_textMotorSpeedFront;
        Fl_Line_Dial*     m_dialMotorSpeedRear;
        Fl_Box*           m_textMotorSpeedRear;
        Fl_Hor_Slider*    m_sliderServoPosFront;
        Fl_Box*           m_textServoPosFront;
        Fl_Hor_Slider*    m_sliderServoPosRear;
        Fl_Box*           m_textServoPosRear;
        Fl_Box*           m_boxMgrHeartbeat;
        Fl_Box*           m_textManagerMsg;
        Fl_Box*           m_boxSonarFrontState;
        Fl_Light_Button*  m_buttonSendCtlUpdate;
        Fl_Light_Button*  m_buttonEstop;
        Fl_Light_Button*  m_buttonMotorCtl;
        Fl_Toggle_Button* m_buttonA;
        Fl_Toggle_Button* m_buttonB;
        Fl_Light_Button*  m_buttonImuKA;
        Fl_Box*           m_textImuValues;
        Fl_Dial*          m_dialImuHeading;
        Fl_Slider*        m_sliderImuPitch;
        Fl_Slider*        m_sliderImuRoll;
        Fl_Light_Button*  m_buttonSonarFrontKA;
        Fl_Slider*        m_sliderSonarFrontL;
        Fl_Slider*        m_sliderSonarFrontCL;
        Fl_Slider*        m_sliderSonarFrontCR;
        Fl_Slider*        m_sliderSonarFrontR;
        Fl_Box*           m_textSonarFront;
        Poco::Timer       m_timerMainHbTimeout;

    private:
        void createWindow();
        void createMotorSpeedDials();
        void createServoSliders();
        void createDisplays();
        void createActionButtons();
        void createImuControls();
        void createSonarFrontControls();
        void timeoutMgrHeartbeat( Poco::Timer& timer );
};

// ----------------------------------------------------------------------------------------
#endif // #ifndef BCDRL_ROBOTS_ODRSIM_SIMDISPLAY_H
// ----------------------------------------------------------------------------------------