]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
robomon: adapted sources to new robottype types, employed actlib function calls
authorMartin Zidek <zidekm1@gmail.com>
Wed, 25 Feb 2009 16:04:59 +0000 (17:04 +0100)
committerMartin Zidek <zidekm1@gmail.com>
Wed, 25 Feb 2009 16:04:59 +0000 (17:04 +0100)
src/robomon/RobomonAtlantis.cpp
src/robomon/RobomonAtlantis.h
src/robomon/RobomonTuning.cpp
src/robomon/RobomonTuning.h
src/robomon/robomon.pro

index dea0d3fd8f3ff3ee50e41b6d936e1cc622db51bc..37e738b0dc9c654a817b7b870f512389ada3f5a1 100644 (file)
@@ -30,6 +30,7 @@
 #include <map.h>
 #include <robomath.h>
 #include <hokuyo.h>
+#include <actuators.h>
 #include "PlaygroundScene.h"
 #include "MiscGui.h"
 #include "robomon_orte.h"
@@ -341,29 +342,29 @@ void RobomonAtlantis::createDrivesGroupBox()
 
        leftBrushDial = new QDial();
        rightBrushDial = new QDial();
-       bagrDial = new QDial();
-       carouselDial = new QDial();
+       lift_posDial = new QDial();
+       pusherDial = new QDial();
 
        leftBrushDriveCheckBox = new QCheckBox(tr("L&eft brush"));
        rightBrushDriveCheckBox = new QCheckBox(tr("Ri&ght brush"));
-       bagrDriveCheckBox = new QCheckBox(tr("B&agr"));
+       lift_posDriveCheckBox = new QCheckBox(tr("B&agr"));
 
        leftBrushDial->setRange(0,200);
        leftBrushDial->setValue(100);
        rightBrushDial->setRange(0,200);
        rightBrushDial->setValue(100);
-       bagrDial->setRange(0,200);
-       bagrDial->setValue(100);
-       carouselDial->setRange(0,4);
-       carouselDial->setNotchesVisible(1);
+       lift_posDial->setRange(0,200);
+       lift_posDial->setValue(100);
+       pusherDial->setRange(0,4);
+       pusherDial->setNotchesVisible(1);
 
        layout->addWidget(leftBrushDial, 0, 0);
        layout->addWidget(leftBrushDriveCheckBox, 0, 1);
        layout->addWidget(rightBrushDial, 1, 0);
        layout->addWidget(rightBrushDriveCheckBox, 1, 1);
-       layout->addWidget(bagrDial, 2, 0);
-       layout->addWidget(bagrDriveCheckBox, 2, 1);
-       layout->addWidget(carouselDial, 3, 0);
+       layout->addWidget(lift_posDial, 2, 0);
+       layout->addWidget(lift_posDriveCheckBox, 2, 1);
+       layout->addWidget(pusherDial, 3, 0);
        drivesGroupBox->setLayout(layout);
 }
 
@@ -424,16 +425,16 @@ void RobomonAtlantis::createActions()
                        this, SLOT(setDrives(int)));
        connect(rightBrushDial, SIGNAL(valueChanged(int)), 
                        this, SLOT(setDrives(int)));
-       connect(bagrDial, SIGNAL(valueChanged(int)), 
+       connect(lift_posDial, SIGNAL(valueChanged(int)), 
                        this, SLOT(setDrives(int)));
-       connect(carouselDial, SIGNAL(valueChanged(int)), 
+       connect(pusherDial, SIGNAL(valueChanged(int)), 
                        this, SLOT(setDrives(int)));
        connect(leftBrushDriveCheckBox, SIGNAL(stateChanged(int)), 
                        this, SLOT(setLeftBrushDriveCB(int)));
        connect(rightBrushDriveCheckBox, SIGNAL(stateChanged(int)), 
                        this, SLOT(setRightBrushDriveCB(int)));
-       connect(bagrDriveCheckBox, SIGNAL(stateChanged(int)), 
-                       this, SLOT(setBagrDriveCB(int)));
+       connect(lift_posDriveCheckBox, SIGNAL(stateChanged(int)), 
+                       this, SLOT(setlift_posDriveCB(int)));
        /* DIO */
        for (int i=0; i<8; i++)
                connect(doCheckBox[0], SIGNAL(stateChanged(int)), 
@@ -529,51 +530,51 @@ void RobomonAtlantis::moveServos(int value)
 void RobomonAtlantis::moveLeftBrush(int state)
 {
        if (state)
-               orte.servos.brush_left = BRUSH_LEFT_OPEN;
+               actlib_servos_brush_left_open();
        else
-               orte.servos.brush_left = BRUSH_LEFT_CLOSE;
+               actlib_servos_brush_left_close();
 }
 
 void RobomonAtlantis::moveRightBrush(int state)
 {
        if (state)
-               orte.servos.brush_right = BRUSH_RIGHT_OPEN;
+               actlib_servos_brush_right_open();
        else
-               orte.servos.brush_right = BRUSH_RIGHT_CLOSE;
+               actlib_servos_brush_right_close();
 }
 
 void RobomonAtlantis::setDrives(int state)
 {
        orte.drives.brush_left = leftBrushDial->value();
        orte.drives.brush_right = rightBrushDial->value();
-       orte.drives.bagr = bagrDial->value();
-       orte.drives.carousel_pos = carouselDial->value();
+       orte.drives.lift_pos = lift_posDial->value();
+       orte.drives.pusher = pusherDial->value();
 }
 
 void RobomonAtlantis::setLeftBrushDriveCB(int state) {
 
        if(state)
-               orte.drives.brush_left = LEFT_BRUSH_DRIVE_ON;
+               actlib_drives_brush_left_on();
        else
-               orte.drives.brush_left = LEFT_BRUSH_DRIVE_OFF;
+               actlib_drives_brush_left_off();
 }
 
 
 void RobomonAtlantis::setRightBrushDriveCB(int state) {
 
        if(state)
-               orte.drives.brush_right = RIGHT_BRUSH_DRIVE_ON;
+               actlib_drives_brush_right_on();
        else
-               orte.drives.brush_right = RIGHT_BRUSH_DRIVE_OFF;
+               actlib_drives_brush_right_off();
 }
 
 
-void RobomonAtlantis::setBagrDriveCB(int state) {
+void RobomonAtlantis::setlift_posDriveCB(int state) {
 
        if(state)
-               orte.drives.bagr = BAGR_DRIVE_ON;
+               orte.drives.lift_pos = 1;
        else
-               orte.drives.bagr = BAGR_DRIVE_OFF;
+               orte.drives.lift_pos = 2;
 }
 
 void RobomonAtlantis::setDO(int state)
@@ -584,10 +585,9 @@ void RobomonAtlantis::setDO(int state)
 void RobomonAtlantis::setLaser(int state) {
 
        if(state)
-               orte.laser_cmd.speed = LASER_DRIVE_ON;
+               actlib_laser_on();
        else
-               orte.laser_cmd.speed = LASER_DRIVE_OFF;
-       ORTEPublicationSend(orte.publication_laser_cmd);
+               actlib_laser_off();
 }
 
 void RobomonAtlantis::showMap()
@@ -992,6 +992,8 @@ void RobomonAtlantis::createOrte()
        setDrives(0);
        setLaser(0);
 
+       actlib_init(&orte);
+
        /* set actions to do when we receive data from orte */
        connect(this, SIGNAL(motionStatusReceivedSignal()), 
                        this, SLOT(motionStatusReceived()));
index cf8381b089787d4e419f56283daa24ed77cd3dae..ef581bbec336a93c1a31a938f187878178bbabb6 100644 (file)
@@ -79,7 +79,7 @@ private slots:
        void setDrives(int value);
        void setLeftBrushDriveCB(int value);
        void setRightBrushDriveCB(int value);
-       void setBagrDriveCB(int value);
+       void setlift_posDriveCB(int value);
        void stopMotors();
        void moveServos(int value);
        void moveLeftBrush(int state);
@@ -173,12 +173,12 @@ private:
 
        QDial *leftBrushDial;
        QDial *rightBrushDial;
-       QDial *bagrDial;
-       QDial *carouselDial;
+       QDial *lift_posDial;
+       QDial *pusherDial;
 
        QCheckBox *leftBrushDriveCheckBox;
        QCheckBox *rightBrushDriveCheckBox;
-       QCheckBox *bagrDriveCheckBox;
+       QCheckBox *lift_posDriveCheckBox;
 
        /* power management */
        QCheckBox *voltage33CheckBox;
index 58e8400916b3187f918c7d172b0ea144a9cfef5b..7c99f039fda0c3fc1788bafb5a52b5f9f45ba658 100644 (file)
@@ -88,30 +88,30 @@ void RobomonTuning::createMotorsGroupBox()
        
        brushLeft = new QDial();
        brushRight = new QDial();
-       roboBagr = new QDial();
-       carousel = new QDial();
+       liftPos = new QDial();
+       pusher = new QDial();
 
        brushLeftLEdit = new QLineEdit();
        brushRightLEdit = new QLineEdit();
-       roboBagrLEdit = new QLineEdit();
-       carouselLEdit = new QLineEdit();
+       liftPosLEdit = new QLineEdit();
+       pusherLEdit = new QLineEdit();
 
        brushLeft->setMinimum(0);
-       brushLeft->setMaximum(200);
-       brushLeft->setValue(100);
+       brushLeft->setMaximum(100);
+       brushLeft->setValue(0);
        
        brushRight->setMinimum(0);
-       brushRight->setMaximum(200);
-       brushRight->setValue(100);
+       brushRight->setMaximum(100);
+       brushRight->setValue(0);
        
-       roboBagr->setMinimum(0);
-       roboBagr->setMaximum(200);
-       roboBagr->setValue(100);
-
-       carousel->setMinimum(1);
-       carousel->setMaximum(5);
-       carousel->setValue(1);
-       carousel->setNotchesVisible(1);
+       liftPos->setMinimum(1);
+       liftPos->setMaximum(4);
+       liftPos->setValue(1);
+
+       pusher->setMinimum(1);
+       pusher->setMaximum(2);
+       pusher->setValue(1);
+       pusher->setNotchesVisible(1);
        
        layout->addWidget(brushLeft,0,0);
        layout->addWidget(MiscGui::createLabel("Left brush", Qt::AlignLeft), 1, 0);
@@ -119,12 +119,12 @@ void RobomonTuning::createMotorsGroupBox()
        layout->addWidget(brushRight,0,1);
        layout->addWidget(MiscGui::createLabel("Right brush", Qt::AlignLeft), 1, 1);
        layout->addWidget(brushRightLEdit, 2, 1);
-       layout->addWidget(roboBagr,3,0);
-       layout->addWidget(MiscGui::createLabel("Robo bagr", Qt::AlignLeft), 4, 0);
-       layout->addWidget(roboBagrLEdit, 5, 0);
-       layout->addWidget(carousel,3,1);
-       layout->addWidget(MiscGui::createLabel("Carousel", Qt::AlignLeft), 4, 1);
-       layout->addWidget(carouselLEdit, 5, 1);
+       layout->addWidget(liftPos,3,0);
+       layout->addWidget(MiscGui::createLabel("Lift position", Qt::AlignLeft), 4, 0);
+       layout->addWidget(liftPosLEdit, 5, 0);
+       layout->addWidget(pusher,3,1);
+       layout->addWidget(MiscGui::createLabel("Pusher", Qt::AlignLeft), 4, 1);
+       layout->addWidget(pusherLEdit, 5, 1);
 
 
        enginesGroupBox->setLayout(layout);
@@ -183,16 +183,13 @@ void RobomonTuning::createServosGroupBox()
 
        servoBrushLeft = new QDial();
        servoBrushRight = new QDial();
-       servoDoorTop = new QDial();
-       servoDoorBottom = new QDial();
-       servoDoorBack = new QDial();
+       servoHolder = new QDial();
        servoReserve = new QDial();
        
        servoBrushLeftLEdit = new QLineEdit();
        servoBrushRightLEdit = new QLineEdit();
-       servoDoorTopLEdit = new QLineEdit();
-       servoDoorBackLEdit = new QLineEdit();
-       servoDoorBottomLEdit = new QLineEdit();
+       servoHolderLEdit = new QLineEdit();
+       servoReserveLEdit = new QLineEdit();
 
        servoBrushLeft->setMinimum(0);
        servoBrushLeft->setMaximum(255);
@@ -202,17 +199,9 @@ void RobomonTuning::createServosGroupBox()
        servoBrushRight->setMaximum(255);
        servoBrushRight->setValue(127);
 
-       servoDoorTop->setMinimum(0);
-       servoDoorTop->setMaximum(255);
-       servoDoorTop->setValue(127);
-
-       servoDoorBottom->setMinimum(0);
-       servoDoorBottom->setMaximum(255);
-       servoDoorBottom->setValue(127);
-
-       servoDoorBack->setMinimum(0);
-       servoDoorBack->setMaximum(255);
-       servoDoorBack->setValue(127);
+       servoHolder->setMinimum(0);
+       servoHolder->setMaximum(255);
+       servoHolder->setValue(127);
 
        servoReserve->setMinimum(0);
        servoReserve->setMaximum(255);
@@ -224,15 +213,15 @@ void RobomonTuning::createServosGroupBox()
        layout->addWidget(servoBrushRight, 0, 1);
        layout->addWidget(MiscGui::createLabel("Right brush", Qt::AlignLeft), 1, 1);
        layout->addWidget(servoBrushRightLEdit, 2, 1);
-       layout->addWidget(servoDoorTop, 0, 2);
-       layout->addWidget(MiscGui::createLabel("Top door", Qt::AlignLeft), 1, 2);
-       layout->addWidget(servoDoorTopLEdit, 2, 2);
-       layout->addWidget(servoDoorBottom, 3, 0);
-       layout->addWidget(MiscGui::createLabel("Bottom Door", Qt::AlignLeft), 4, 0);
-       layout->addWidget(servoDoorBottomLEdit, 5, 0);
-       layout->addWidget(servoDoorBack, 3, 1);
-       layout->addWidget(MiscGui::createLabel("Back door", Qt::AlignLeft), 4, 1);
-       layout->addWidget(servoDoorBackLEdit, 5, 1);
+       layout->addWidget(servoHolder, 0, 2);
+       layout->addWidget(MiscGui::createLabel("Holder", Qt::AlignLeft), 1, 2);
+       layout->addWidget(servoHolderLEdit, 2, 2);
+//     layout->addWidget(servoDoorBottom, 3, 0);
+//     layout->addWidget(MiscGui::createLabel("Bottom Door", Qt::AlignLeft), 4, 0);
+//     layout->addWidget(servoDoorBottomLEdit, 5, 0);
+//     layout->addWidget(servoDoorBack, 3, 1);
+//     layout->addWidget(MiscGui::createLabel("Back door", Qt::AlignLeft), 4, 1);
+//     layout->addWidget(servoDoorBackLEdit, 5, 1);
        layout->addWidget(servoReserve, 3, 2);
        layout->addWidget(MiscGui::createLabel("Reserve", Qt::AlignLeft), 4, 2);
        servosGroupBox->setLayout(layout);
@@ -250,9 +239,9 @@ void RobomonTuning::createActions()
                        this, SLOT(setMotors(int)));
        connect(brushRight, SIGNAL(valueChanged(int)), 
                        this, SLOT(setMotors(int)));
-       connect(roboBagr, SIGNAL(valueChanged(int)), 
+       connect(liftPos, SIGNAL(valueChanged(int)), 
                        this, SLOT(setMotors(int)));
-       connect(carousel, SIGNAL(valueChanged(int)), 
+       connect(pusher, SIGNAL(valueChanged(int)), 
                        this, SLOT(setMotors(int)));
 
 
@@ -261,11 +250,9 @@ void RobomonTuning::createActions()
                        this, SLOT(setServos(int)));
        connect(servoBrushRight, SIGNAL(valueChanged(int)), 
                        this, SLOT(setServos(int)));
-       connect(servoDoorTop, SIGNAL(valueChanged(int)), 
-                       this, SLOT(setServos(int)));
-       connect(servoDoorBack, SIGNAL(valueChanged(int)), 
+       connect(servoHolder, SIGNAL(valueChanged(int)), 
                        this, SLOT(setServos(int)));
-       connect(servoDoorBottom, SIGNAL(valueChanged(int)), 
+       connect(servoReserve, SIGNAL(valueChanged(int)), 
                        this, SLOT(setServos(int)));
 
        connect(pwrAlertCBox, SIGNAL(stateChanged(int)), 
@@ -282,6 +269,10 @@ void RobomonTuning::setServos(int value)
        servoBrushLeftLEdit->setText(QString("%1").arg(orte.servos.brush_left));
        orte.servos.brush_right = (u_int8_t)servoBrushRight->value();
        servoBrushRightLEdit->setText(QString("%1").arg(orte.servos.brush_right));
+       orte.servos.holder = (u_int8_t)servoHolder->value();
+       servoHolderLEdit->setText(QString("%1").arg(orte.servos.holder));
+       orte.servos.reserve = (u_int8_t)servoReserve->value();
+       servoReserveLEdit->setText(QString("%1").arg(orte.servos.reserve));
 
        ORTEPublicationSend(orte.publication_servos);
 }
@@ -319,14 +310,14 @@ void RobomonTuning::setMotors(int state)
 {
        orte.drives.brush_left = brushLeft->value();
        orte.drives.brush_right = brushRight->value();
-       orte.drives.bagr = roboBagr->value();
-       orte.drives.carousel_pos = carousel->value();
+       orte.drives.lift_pos = liftPos->value();
+       orte.drives.pusher = pusher->value();
        ORTEPublicationSend(orte.publication_drives);
 
        brushLeftLEdit->setText(QString("%1").arg(orte.drives.brush_left));
        brushRightLEdit->setText(QString("%1").arg(orte.drives.brush_right));
-       roboBagrLEdit->setText(QString("%1").arg(orte.drives.bagr));
-       carouselLEdit->setText(QString("%1").arg(orte.drives.carousel_pos));
+       liftPosLEdit->setText(QString("%1").arg(orte.drives.lift_pos));
+       pusherLEdit->setText(QString("%1").arg(orte.drives.pusher));
 }
 
 
index 7683173a54d26db68726ae3538f8a5e0686a505d..aa4870d3f3266d25df4b61aca236d8b47af2f059 100644 (file)
@@ -78,7 +78,6 @@ private:
        void createPwrGroupBox();
        void createCanGroupBox();
 
-
        void createActions();
 
        QGroupBox *enginesGroupBox;
@@ -86,34 +85,30 @@ private:
        QGroupBox *pwrGroupBox;
        QGroupBox *canGroupBox;
 
-
        QVBoxLayout *leftLayout;
        QVBoxLayout *rightLayout;
 
        /* motors control */
        QDial *brushLeft;
        QDial *brushRight;
-       QDial *roboBagr;
-       QDial *carousel;
+       QDial *liftPos;
+       QDial *pusher;
        
        QLineEdit *brushLeftLEdit;
        QLineEdit *brushRightLEdit;
-       QLineEdit *roboBagrLEdit;
-       QLineEdit *carouselLEdit;
+       QLineEdit *liftPosLEdit;
+       QLineEdit *pusherLEdit;
 
        /* servos control */
        QDial *servoBrushLeft;
        QDial *servoBrushRight;
-       QDial *servoDoorBottom;
-       QDial *servoDoorTop;
-       QDial *servoDoorBack;
+       QDial *servoHolder;
        QDial *servoReserve;
 
        QLineEdit *servoBrushLeftLEdit;
        QLineEdit *servoBrushRightLEdit;
-       QLineEdit *servoDoorBottomLEdit;
-       QLineEdit *servoDoorTopLEdit;
-       QLineEdit *servoDoorBackLEdit;
+       QLineEdit *servoHolderLEdit;
+       QLineEdit *servoReserveLEdit;
 
        QLineEdit *canData1;
        QLineEdit *canData2;
index 8556480ab3ae4a578def71d0a3fed93bbb016a04..f9a709140eddb486666ad07bcf375979cb8ae601 100644 (file)
@@ -43,7 +43,8 @@ HEADERS += MainWindow.h \
            MiscGui.h \
            robomon_orte.h
 
-LIBS += -lm -lpthread -lmcl -llaser-nav -lrobodim -lrobomath -lroboorte -lrobottype -lorte  -lsharp -lmap
+LIBS += -lm -lpthread -lmcl -llaser-nav -lrobodim -lrobomath -lroboorte \
+               -lrobottype -lorte  -lsharp -lmap -lactlib
 
 OBJECTS_DIR = ../../build/linux/_build/user/robomon2/
 MOC_DIR = ../../build/linux/_build/user/robomon2/