#define ROBOMON_ATLANTIS_H
#include <QDialog>
+#include <QDateTime>
+#include <QTimer>
#include <trgen.h>
#include "PlaygroundScene.h"
+#include "playgroundview.h"
#include "Robot.h"
#include <roboorte_robottype.h>
#include "trail.h"
class QProgressBar;
class QFont;
+class MotorSimulation : QObject {
+ Q_OBJECT
+
+ QTimer timer;
+ qint64 last_time;
+ struct robottype_orte_data &orte;
+public:
+ MotorSimulation(struct robottype_orte_data &orte) : QObject(), timer(this), orte(orte) {}
+ void start()
+ {
+ robottype_publisher_motion_irc_create(&orte, 0, 0);
+ connect(&timer, SIGNAL(timeout()), this, SLOT(updateIRC()));
+ timer.start(50);
+ }
+
+ void stop()
+ {
+ robottype_publisher_motion_irc_destroy(&orte);
+ timer.stop();
+ disconnect(&timer, SIGNAL(timeout()), this, SLOT(updateIRC()));
+ }
+private slots:
+ void updateIRC()
+ {
+ qint64 now = QDateTime::currentMSecsSinceEpoch();
+ orte.motion_irc.left += orte.motion_speed.left * (now - last_time); // TODO: Find constant for speed to irc conversion
+ orte.motion_irc.right+= orte.motion_speed.right * (now - last_time);
+ ORTEPublicationSend(orte.publication_motion_irc);
+ last_time = now;
+ }
+};
+
+
class RobomonAtlantis : public QWidget
{
Q_OBJECT
public slots:
void showMap(bool show);
+ void useOpenGL(bool use);
void showTrails(bool show);
+ void showShapeDetect(bool show);
void resetTrails();
private slots:
/************************************************************
void setVoltage33(int state);
void setVoltage50(int state);
void setVoltage80(int state);
- void setLeftMotor(int value);
- void setRightMotor(int value);
- void stopMotors();
+/* void setLeftMotor(int value); */
+/* void setRightMotor(int value); */
+/* void stopMotors(); */
void paintMap();
void setSimulation(int state);
void setObstacleSimulation(int state);
void simulateObstaclesHokuyo();
void changeObstacle(QPointF position);
void sendStart(int plug);
+ void setTeamColor(int plug);
+ void setMotorSimulation(int state);
/************************************************************
* ORTE
QGroupBox *miscGroupBox;
QGroupBox *debugGroupBox;
QGroupBox *actuatorsGroupBox;
- QGroupBox *enginesGroupBox;
QGroupBox *powerGroupBox;
QGroupBox *fsmGroupBox;
+public:
PlaygroundScene *playgroundScene;
- QGraphicsView *playgroundSceneView;
+private:
+ PlaygroundView *playgroundSceneView;
/* position state */
QLineEdit *actPosX;
bool debugWindowEnabled;
/* actuators */
- QSlider *leftMotorSlider;
- QSlider *rightMotorSlider;
- QCheckBox *bothMotorsCheckBox;
- QPushButton *stopMotorsPushButton;
+/* QSlider *leftMotorSlider; */
+/* QSlider *rightMotorSlider; */
+/* QCheckBox *bothMotorsCheckBox; */
+/* QPushButton *stopMotorsPushButton; */
+ //QDial *vidle;
/* power management */
QCheckBox *voltage33CheckBox;
/* misc */
QCheckBox *obstacleSimulationCheckBox;
+ QCheckBox *motorSimulationCheckBox;
QLabel *fsm_main_state;
QLabel *fsm_act_state;
QLabel *fsm_motion_state;
QCheckBox *startPlug;
- QCheckBox *puckInside;
+ QCheckBox *colorChoser;
public:
/* robot */
Robot *robotRefPos;
QTimer *obstacleSimulationTimer;
Point simulatedObstacle;
+ class MotorSimulation motorSimulation;
+
/************************************************************
* ORTE
************************************************************/