forked from rbmj/612-code
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtwo_jags.cpp
More file actions
31 lines (27 loc) · 683 Bytes
/
Copy pathtwo_jags.cpp
File metadata and controls
31 lines (27 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "612.h"
#include <vxWorks.h>
#include <SpeedController.h>
#ifdef USE_JAGUARPWM
#include <Jaguar.h>
#else
#include <CANJaguar.h>
#endif
#include "two_jags.h"
#include "utility.h"
two_jags::two_jags(SpeedController& a, SpeedController& b) : speed(0.0) {
jag1 = static_cast<SPEEDCONTROLLER*>(&a);
jag2 = static_cast<SPEEDCONTROLLER*>(&b);
}
void two_jags::PIDWrite(float output) {
speed = coerce(output + speed, -1.0f, 1.0f);
jag1->PIDWrite(speed);
jag2->PIDWrite(speed);
}
void two_jags::Set(float value, UINT8 sync) {
speed = coerce(value, -1.0f, 1.0f);
jag1->Set(value, sync);
jag2->Set(value, sync);
}
void two_jags::reset() {
Set(0.0);
}