position
parent
f200685ffb
commit
c0495a64af
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
]
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
]
|
||||
}
|
|
@ -16,11 +16,11 @@
|
|||
#define LINE_THRESH 90
|
||||
#define EXTIME 100
|
||||
|
||||
class DataSourceCtrlLines : public DataSourceCtrl {
|
||||
class DSCtrlLines : public DataSourceCtrl {
|
||||
|
||||
public:
|
||||
DataSourceCtrlLines();
|
||||
DataSourceCtrlLines(vector<DataSource*> in_, vector<DataSource*> out);
|
||||
DSCtrlLines();
|
||||
DSCtrlLines(vector<DataSource*> in_, vector<DataSource*> out);
|
||||
|
||||
void read() override;
|
||||
void postProcess() override;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#include "vars.h"
|
||||
#include "ds_ctrl.h"
|
||||
#include "ds_ctrl_lines.h"
|
||||
|
||||
class DSCtrlPosition : public DataSourceController {
|
||||
|
||||
public:
|
||||
DSCtrlPosition();
|
||||
|
||||
};
|
|
@ -25,8 +25,8 @@ s_extr vector<DataSource*> lIn;
|
|||
s_extr vector<DataSource*> lOut;
|
||||
s_extr vector<DataSource*> dUs;
|
||||
|
||||
s_extr DataSourceCtrl* usCtrl;
|
||||
s_extr DataSourceCtrlLines* linesCtrl;
|
||||
s_extr DSCtrlLines* usCtrl;
|
||||
s_extr DSCtrlLines* linesCtrl;
|
||||
|
||||
s_extr DataSourceBNO055* compass;
|
||||
s_extr DataSourceBall* ball;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "sensors.h"
|
||||
|
||||
using namespace std;
|
||||
DataSourceCtrlLines::DataSourceCtrlLines() {}
|
||||
DataSourceCtrlLines::DataSourceCtrlLines(vector<DataSource*> in_, vector<DataSource*> out_){
|
||||
DSCtrlLines::DSCtrlLines() {}
|
||||
DSCtrlLines::DSCtrlLines(vector<DataSource*> in_, vector<DataSource*> out_){
|
||||
this->in = in_;
|
||||
this->out = out_;
|
||||
|
||||
|
@ -24,7 +24,7 @@ DataSourceCtrlLines::DataSourceCtrlLines(vector<DataSource*> in_, vector<DataSou
|
|||
exitTimer = 0;
|
||||
}
|
||||
|
||||
void DataSourceCtrlLines::read(){
|
||||
void DSCtrlLines::read(){
|
||||
inV = 0;
|
||||
outV = 0;
|
||||
for(DataSource* d : in) d->readSensor();
|
||||
|
@ -49,7 +49,7 @@ void DataSourceCtrlLines::read(){
|
|||
inV = inV | outV;
|
||||
}
|
||||
|
||||
void DataSourceCtrlLines::postProcess(){
|
||||
void DSCtrlLines::postProcess(){
|
||||
if ((inV > 0) || (outV > 0)) {
|
||||
fboundsOX = true;
|
||||
fboundsOY = true;
|
||||
|
@ -63,12 +63,12 @@ void DataSourceCtrlLines::postProcess(){
|
|||
outOfBounds();
|
||||
}
|
||||
|
||||
void DataSourceCtrlLines::outOfBounds(){
|
||||
void DSCtrlLines::outOfBounds(){
|
||||
handleExtern();
|
||||
handleIntern();
|
||||
}
|
||||
|
||||
void DataSourceCtrlLines::handleIntern(){
|
||||
void DSCtrlLines::handleIntern(){
|
||||
|
||||
if(fboundsX == true) {
|
||||
if(inV & 0x02) inVOldX = 2;
|
||||
|
@ -162,14 +162,14 @@ void DataSourceCtrlLines::handleIntern(){
|
|||
else slow = false;
|
||||
}
|
||||
|
||||
void DataSourceCtrlLines::handleExtern(){
|
||||
void DSCtrlLines::handleExtern(){
|
||||
if((outV & 0b00000001) == 1) drive->vyp = 1; // esclusione
|
||||
if((outV & 0b00000100) == 4) drive->vyn = 1;
|
||||
if((outV & 0b00000010) == 2) drive->vxp = 1;
|
||||
if((outV & 0b00001000) == 8) drive->vxn = 1;
|
||||
}
|
||||
|
||||
void DataSourceCtrlLines::test(){
|
||||
void DSCtrlLines::test(){
|
||||
update();
|
||||
DEBUG.print("In: ");
|
||||
for(DataSource* d : in){
|
||||
|
|
|
@ -16,7 +16,7 @@ void initSensors(){
|
|||
ball = new DataSourceBall(&Serial4, 57600);
|
||||
camera = new DataSourceCamera(&Serial2, 19200);
|
||||
usCtrl = new DataSourceCtrl(dUs);
|
||||
linesCtrl = new DataSourceCtrlLines(lIn, lOut);
|
||||
linesCtrl = new DSCtrlLines(lIn, lOut);
|
||||
bt = new DataSourceBT(&Serial3, 115200);
|
||||
|
||||
/*game = new Game();
|
||||
|
|
Loading…
Reference in New Issue