Commit 5303167f authored by Arnaud Cadot's avatar Arnaud Cadot

- Added Parasol actuator class

- Fixed some more warnings
parent 7749594d
......@@ -105,7 +105,8 @@ HEADERS += \
../../include/vector.h \
../../include/strategie/krabijunior2016.h \
../../include/strategie/krabi2016.h \
../../include/actionneurs/fishingNet.h
../../include/actionneurs/fishingNet.h \
../../include/actionneurs/parasol.h
SOURCES += \
......@@ -185,7 +186,8 @@ SOURCES += \
../../src/strategie/krabi2016.cpp \
../../src/strategie/cabine.cpp \
../../src/strategie/zoneConstruction.cpp \
../../src/actionneurs/fishingNet.cpp
../../src/actionneurs/fishingNet.cpp \
../../src/actionneurs/parasol.cpp
FORMS += \
../../include/simul/remotedebug.ui \
......
#ifndef PARASOL_H
#define PARASOL_H
/**
* @brief This singleton class handles the parasol actuator.
* @see getSingleton
*/
class Parasol
{
/**
* The ID of the servo
*/
static const int SERVO_ID = 0; // To update
/**
* Those constantes are angles for the relevant action (names are pretty explicit)
*/
static const int SERVO_CLOSED_POS = 0x00;
static const int SERVO_DEPLOYED_POS = 0x00;
public:
/**
* @brief Parasol is a singleton. This static method will return the only possible instance of Parasol (and create it if deemed necessary)
*/
static Parasol* getSingleton();
/**
* @brief Closes the parasol
*/
void close();
/**
* @brief Deploys the parasol
*/
void deploy();
private:
/**
* @brief Constructor
* @see getSingleton
*/
Parasol();
};
#endif
#include "parasol.h"
#ifdef ROBOTHW
#include "interfaceServosNumeriques.h"
#endif
Parasol* Parasol::getSingleton()
{
static Parasol* instance = 0;
if(instance == 0)
instance = new Parasol();
return instance;
}
Parasol::Parasol()
{
close();
}
void Parasol::close()
{
#ifdef ROBOTHW
ServosNumeriques::moveTo(SERVO_CLOSED_POS, SERVO_ID);
#endif
}
void Parasol::deploy()
{
#ifdef ROBOTHW
ServosNumeriques::moveTo(SERVO_DEPLOYED_POS, SERVO_ID);
#endif
}
......@@ -7,7 +7,7 @@
#include <QPainter>
#include "asservissement.h"
Graph::Graph(QWidget* widget) : QWidget(widget), vAngular(1000), vLinear(1000)
Graph::Graph(QWidget* widget) : QWidget(widget), vLinear(1000), vAngular(1000)
{
dt=0;
setAutoFillBackground(true);
......@@ -26,7 +26,7 @@ void Graph::update(int dt)
this->dt = dt;
repaint();
}
void Graph::paintEvent(QPaintEvent* evt)
void Graph::paintEvent(QPaintEvent*)
{
int diameter = 1;
......@@ -42,12 +42,12 @@ void Graph::paintEvent(QPaintEvent* evt)
p.fillRect(0,0,gWidth,gHeight,QColor(255,255,255));
p.setPen(QColor(Qt::black));
for (int i=0; i+1 < vLinear.size(); i++)
for (size_t i=0; i+1 < vLinear.size(); i++)
{
p.drawLine(i,-(gHeight/4)*(vLinear[i]/VITESSE_LINEAIRE_MAX)+gHeight/4,i+1,-(gHeight/4)*(vLinear[i+1]/VITESSE_LINEAIRE_MAX)+gHeight/4);
//p.drawEllipse(QRectF(i -diameter / 2.0, (gHeight/2)*(vLinear[i]/VITESSE_LINEAIRE_MAX)+gHeight/2 -diameter / 2.0, diameter, diameter));
}
for (int i=0; i+1 < vLinear.size(); i++)
for (size_t i=0; i+1 < vLinear.size(); i++)
{
p.drawLine(i,-(gHeight/4)*(vAngular[i]/VITESSE_ANGULAIRE_MAX)+3*gHeight/4,i+1,-(gHeight/4)*(vAngular[i+1]/VITESSE_ANGULAIRE_MAX)+3*gHeight/4);
//p.drawEllipse(QRectF(i -diameter / 2.0, (gHeight/2)*(vLinear[i]/VITESSE_LINEAIRE_MAX)+gHeight/2 -diameter / 2.0, diameter, diameter));
......@@ -56,7 +56,7 @@ void Graph::paintEvent(QPaintEvent* evt)
}
void Graph::keyPressEvent(QKeyEvent* evt, bool press)
void Graph::keyPressEvent(QKeyEvent*, bool)
{
}
......
......@@ -69,7 +69,7 @@ void Shape::drawSelf(QPainter* painter)
painter->setPen(p_color);
}
void Shape::createSolid(b2Body* body)
void Shape::createSolid(b2Body*)
{
}
......
......@@ -74,13 +74,13 @@ void MainWindow::resizeEvent(QResizeEvent* event)
table->resize(proportion*s.height(),s.height());
}
void MainWindow::moveEvent(QMoveEvent * event)
void MainWindow::moveEvent(QMoveEvent*)
{
if (DebugWindow::getInstance()->isAttached())
DebugWindow::getInstance()->moveWithoutEvent(this->mapToGlobal(QPoint()) + QPoint(this->width() + 16, -QApplication::style()->pixelMetric(QStyle::PM_TitleBarHeight)));
}
void MainWindow::closeEvent(QCloseEvent *event)
void MainWindow::closeEvent(QCloseEvent*)
{
DebugWindow::getInstance()->close();
}
......
......@@ -612,7 +612,7 @@ Command* StrategieV2::setCurrentGoalSmooth(Position goal, Position nextGoal, flo
return currentCommand;
}
Command* StrategieV2::setCurrentGoal(Position goal, Position center, float vitesse, bool goBack, Angle precisionAngle)
Command* StrategieV2::setCurrentGoal(Position goal, Position center, float vitesse, bool goBack, Angle /*precisionAngle*/)
{
if (currentCommand != NULL)
delete currentCommand;
......@@ -668,6 +668,7 @@ bool StrategieV2::willCollide()
somethingDetected = true;
Asservissement::asservissement->setCommandSpeeds(NULL); // stoppe le robot
Asservissement::asservissement->resetAsserv();
return false;
}
bool StrategieV2::isYellow()
......@@ -751,6 +752,8 @@ bool StrategieV2::sharpDetects(SharpSensor::SharpName name)
for (int i = 0; i < SharpSensor::END_SHARP_NAME; i++)
if (sharps[i]->getName() == name && sharpsToCheck[i] == true && !tourneSurSoiMeme)
return sharps[i]->getValue().b;
return false;
}
void StrategieV2::setTourneSurSoiMeme(bool tourne)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment