Merge "Calibrated superstructure again and redid buttons."
diff --git a/motors/button_board.cc b/motors/button_board.cc
index 3fa3915..89ca864 100644
--- a/motors/button_board.cc
+++ b/motors/button_board.cc
@@ -72,7 +72,7 @@
report[4] = (GPIO_BITBAND(GPIOD_PDIR, 5) << 0) |
(GPIO_BITBAND(GPIOD_PDIR, 6) << 1) |
- (GPIO_BITBAND(GPIOD_PDIR, 16) << 2) |
+ (GPIO_BITBAND(GPIOB_PDIR, 0) << 2) |
(GPIO_BITBAND(GPIOB_PDIR, 1) << 3) |
(GPIO_BITBAND(GPIOA_PDIR, 14) << 4) |
(GPIO_BITBAND(GPIOE_PDIR, 26) << 5) |
@@ -232,7 +232,7 @@
// BTN1
PORTD_PCR6 = PORT_PCR_MUX(1);
// BTN2
- PORTD_PCR16 = PORT_PCR_MUX(1);
+ PORTB_PCR0 = PORT_PCR_MUX(1);
// BTN3
PORTB_PCR1 = PORT_PCR_MUX(1);
// BTN4
diff --git a/motors/encoder_schematic/board-main.sch b/motors/encoder_schematic/board-main.sch
index df92a26..7133f37 100644
--- a/motors/encoder_schematic/board-main.sch
+++ b/motors/encoder_schematic/board-main.sch
@@ -7,6 +7,8 @@
refdes=U1
T 43100 43600 5 10 0 0 0 0 1
footprint=MSSOP28
+T 43100 43600 5 10 0 0 0 0 1
+pn=AM4096PT
}
C 52200 46000 1 0 0 connector5-1.sym
{
@@ -16,6 +18,8 @@
refdes=CONN4
T 52200 46000 5 10 0 0 90 0 1
footprint=B05B-PASK-dual
+T 52200 46000 5 10 0 0 0 0 1
+pn=B05B-PASK-1(LF)(SN)
}
C 54500 47600 1 270 0 3.3V-plus-1.sym
C 55400 47000 1 90 0 gnd-1.sym
@@ -31,9 +35,11 @@
T 44000 42100 5 10 1 1 270 0 1
refdes=C106
T 43300 42100 5 10 1 1 270 0 1
-value=100 nF
+value=.15 uF
T 43500 42300 5 10 0 0 0 0 1
footprint=0603
+T 43500 42300 5 10 0 0 0 0 1
+pn=GRM188R71H154KAC4D
}
C 43600 40900 1 0 0 gnd-1.sym
N 43700 41400 43700 41200 4
@@ -65,6 +71,8 @@
value=2.2 uF
T 44600 42300 5 10 0 0 0 0 1
footprint=0805
+T 44600 42300 5 10 0 0 0 0 1
+pn=CL21A225KAFNNNG
}
C 44700 40900 1 0 0 gnd-1.sym
N 44800 42500 44800 42300 4
@@ -80,9 +88,11 @@
T 41800 43300 5 10 1 1 270 0 1
refdes=C104
T 41100 43300 5 10 1 1 270 0 1
-value=100 nF
+value=.15 uF
T 41300 43500 5 10 0 0 0 0 1
footprint=0603
+T 41300 43500 5 10 0 0 0 0 1
+pn=GRM188R71H154KAC4D
}
C 41400 42100 1 0 0 gnd-1.sym
N 41500 43700 41500 43500 4
@@ -96,9 +106,11 @@
T 42900 43300 5 10 1 1 270 0 1
refdes=C105
T 42200 43300 5 10 1 1 270 0 1
-value=2.2uF
+value=2.2 uF
T 42400 43500 5 10 0 0 0 0 1
footprint=0805
+T 42400 43500 5 10 0 0 0 0 1
+pn=CL21A225KAFNNNG
}
C 42500 42100 1 0 0 gnd-1.sym
N 42600 43700 42600 43500 4
@@ -113,9 +125,11 @@
T 39700 43900 5 10 1 1 270 0 1
refdes=C102
T 39000 43900 5 10 1 1 270 0 1
-value=100 nF
+value=.15 uF
T 39200 44100 5 10 0 0 0 0 1
footprint=0603
+T 39200 44100 5 10 0 0 0 0 1
+pn=GRM188R71H154KAC4D
}
C 39300 42700 1 0 0 gnd-1.sym
N 39400 44300 39400 44100 4
@@ -129,9 +143,11 @@
T 40800 43900 5 10 1 1 270 0 1
refdes=C103
T 40100 43900 5 10 1 1 270 0 1
-value=2.2uF
+value=2.2 uF
T 40300 44100 5 10 0 0 0 0 1
footprint=0805
+T 40300 44100 5 10 0 0 0 0 1
+pn=CL21A225KAFNNNG
}
C 40400 42700 1 0 0 gnd-1.sym
N 40500 44300 40500 44100 4
@@ -142,13 +158,15 @@
T 46300 47600 5 10 1 1 0 0 1
refdes=C108
T 46300 46900 5 10 1 1 0 0 1
-value=100 nF
+value=.15 uF
T 46300 47800 5 10 0 0 0 0 1
device=CAPACITOR
T 46300 48000 5 10 0 0 0 0 1
symversion=0.1
T 46100 47100 5 10 0 0 0 0 1
footprint=0603
+T 46100 47100 5 10 0 0 0 0 1
+pn=GRM188R71H154KAC4D
}
C 47400 47200 1 90 0 gnd-1.sym
C 41600 44700 1 90 0 capacitor-1.sym
@@ -164,7 +182,7 @@
T 41600 44700 5 10 0 0 0 0 1
footprint=0603
T 41600 44700 5 10 0 0 0 0 1
-partnumber=C1608C0G1E103J080AA
+pn=C1608C0G1E103J080AA
}
C 41500 46100 1 180 0 gnd-1.sym
N 41400 45600 41400 45800 4
@@ -181,7 +199,7 @@
T 42500 45000 5 10 0 0 0 0 1
footprint=0603
T 42500 45000 5 10 0 0 0 0 1
-partnumber=C1608C0G1E103J080AA
+pn=C1608C0G1E103J080AA
}
C 42400 46400 1 180 0 gnd-1.sym
N 42300 45900 42300 46100 4
diff --git a/y2018/control_loops/superstructure/superstructure.cc b/y2018/control_loops/superstructure/superstructure.cc
index 1c5a4e5..2cddf83 100644
--- a/y2018/control_loops/superstructure/superstructure.cc
+++ b/y2018/control_loops/superstructure/superstructure.cc
@@ -37,15 +37,15 @@
intake_left_.Iterate(unsafe_goal != nullptr
? &(unsafe_goal->intake.left_intake_angle)
: nullptr,
- &(position->intake.left),
- output != nullptr ? &(output->intake.left) : nullptr,
+ &(position->left_intake),
+ output != nullptr ? &(output->left_intake) : nullptr,
&(status->left_intake));
intake_right_.Iterate(unsafe_goal != nullptr
? &(unsafe_goal->intake.right_intake_angle)
: nullptr,
- &(position->intake.right),
- output != nullptr ? &(output->intake.right) : nullptr,
+ &(position->right_intake),
+ output != nullptr ? &(output->right_intake) : nullptr,
&(status->right_intake));
arm_.Iterate(
@@ -68,18 +68,18 @@
kMaxIntakeRollerVoltage));
constexpr int kReverseTime = 15;
if (unsafe_goal->intake.roller_voltage < 0.0) {
- output->intake.left.voltage_rollers = roller_voltage;
- output->intake.right.voltage_rollers = roller_voltage;
+ output->left_intake.voltage_rollers = roller_voltage;
+ output->right_intake.voltage_rollers = roller_voltage;
rotation_state_ = RotationState::NOT_ROTATING;
rotation_count_ = 0;
} else {
switch (rotation_state_) {
case RotationState::NOT_ROTATING:
- if (position->intake.left.beam_break) {
+ if (position->left_intake.beam_break) {
rotation_state_ = RotationState::ROTATING_RIGHT;
rotation_count_ = kReverseTime;
break;
- } else if (position->intake.right.beam_break) {
+ } else if (position->right_intake.beam_break) {
rotation_state_ = RotationState::ROTATING_LEFT;
rotation_count_ = kReverseTime;
break;
@@ -87,7 +87,7 @@
break;
}
case RotationState::ROTATING_LEFT:
- if (position->intake.right.beam_break) {
+ if (position->right_intake.beam_break) {
rotation_count_ = kReverseTime;
} else {
--rotation_count_;
@@ -97,7 +97,7 @@
}
break;
case RotationState::ROTATING_RIGHT:
- if (position->intake.left.beam_break) {
+ if (position->left_intake.beam_break) {
rotation_count_ = kReverseTime;
} else {
--rotation_count_;
@@ -110,16 +110,16 @@
switch (rotation_state_) {
case RotationState::NOT_ROTATING:
- output->intake.left.voltage_rollers = roller_voltage;
- output->intake.right.voltage_rollers = roller_voltage;
+ output->left_intake.voltage_rollers = roller_voltage;
+ output->right_intake.voltage_rollers = roller_voltage;
break;
case RotationState::ROTATING_LEFT:
- output->intake.left.voltage_rollers = roller_voltage;
- output->intake.right.voltage_rollers = -roller_voltage;
+ output->left_intake.voltage_rollers = roller_voltage;
+ output->right_intake.voltage_rollers = -roller_voltage;
break;
case RotationState::ROTATING_RIGHT:
- output->intake.left.voltage_rollers = -roller_voltage;
- output->intake.right.voltage_rollers = roller_voltage;
+ output->left_intake.voltage_rollers = -roller_voltage;
+ output->right_intake.voltage_rollers = roller_voltage;
break;
}
}
diff --git a/y2018/control_loops/superstructure/superstructure.q b/y2018/control_loops/superstructure/superstructure.q
index 93d5935..75198fa 100644
--- a/y2018/control_loops/superstructure/superstructure.q
+++ b/y2018/control_loops/superstructure/superstructure.q
@@ -60,16 +60,6 @@
bool beam_break;
};
-struct IntakePosition {
- // Values of the series elastic encoders on the left side of the robot from
- // the rear perspective in radians.
- IntakeElasticSensors left;
-
- // Values of the series elastic encoders on the right side of the robot from
- // the rear perspective in radians.
- IntakeElasticSensors right;
-};
-
struct ArmStatus {
// State of the estimators.
.frc971.AbsoluteEstimatorState proximal_estimator_state;
@@ -128,15 +118,6 @@
double voltage_rollers;
};
-struct IntakeOutput {
- // Voltage sent to the parts on the left side of the intake.
- IntakeVoltage left;
-
- // Voltage sent to the parts on the right side of the intake.
- IntakeVoltage right;
-};
-
-
queue_group SuperstructureQueue {
implements aos.control_loops.ControlLoop;
@@ -166,7 +147,14 @@
};
message Position {
- IntakePosition intake;
+ // Values of the series elastic encoders on the left side of the robot from
+ // the rear perspective in radians.
+ IntakeElasticSensors left_intake;
+
+ // Values of the series elastic encoders on the right side of the robot from
+ // the rear perspective in radians.
+ IntakeElasticSensors right_intake;
+
ArmPosition arm;
// Value of the beam breaker sensor. This value is true if the beam is
@@ -175,7 +163,11 @@
};
message Output {
- IntakeOutput intake;
+ // Voltage sent to the parts on the left side of the intake.
+ IntakeVoltage left_intake;
+
+ // Voltage sent to the parts on the right side of the intake.
+ IntakeVoltage right_intake;
// Voltage sent to the motors on the proximal joint of the arm.
double voltage_proximal;
diff --git a/y2018/control_loops/superstructure/superstructure_lib_test.cc b/y2018/control_loops/superstructure/superstructure_lib_test.cc
index 697c408..1430a45 100644
--- a/y2018/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2018/control_loops/superstructure/superstructure_lib_test.cc
@@ -219,10 +219,9 @@
::aos::ScopedMessagePtr<SuperstructureQueue::Position> position =
superstructure_queue_.position.MakeMessage();
- left_intake_.GetSensorValues(&position->intake.left);
- right_intake_.GetSensorValues(&position->intake.right);
+ left_intake_.GetSensorValues(&position->left_intake);
+ right_intake_.GetSensorValues(&position->right_intake);
arm_.GetSensorValues(&position->arm);
-
LOG_STRUCT(INFO, "sim position", *position);
position.Send();
}
@@ -246,8 +245,8 @@
EXPECT_TRUE(superstructure_queue_.output.FetchLatest());
EXPECT_TRUE(superstructure_queue_.status.FetchLatest());
- left_intake_.Simulate(superstructure_queue_.output->intake.left);
- right_intake_.Simulate(superstructure_queue_.output->intake.right);
+ left_intake_.Simulate(superstructure_queue_.output->left_intake);
+ right_intake_.Simulate(superstructure_queue_.output->right_intake);
arm_.Simulate((::Eigen::Matrix<double, 2, 1>()
<< superstructure_queue_.output->voltage_proximal,
superstructure_queue_.output->voltage_distal)
@@ -337,8 +336,8 @@
superstructure_.intake_left().state());
EXPECT_EQ(intake::IntakeSide::State::RUNNING,
superstructure_.intake_right().state());
- EXPECT_EQ(superstructure_queue_.output->intake.left.voltage_elastic, 0.0);
- EXPECT_EQ(superstructure_queue_.output->intake.right.voltage_elastic, 0.0);
+ EXPECT_EQ(superstructure_queue_.output->left_intake.voltage_elastic, 0.0);
+ EXPECT_EQ(superstructure_queue_.output->right_intake.voltage_elastic, 0.0);
}
// Tests that the intake loop can reach a goal.
diff --git a/y2018/wpilib_interface.cc b/y2018/wpilib_interface.cc
index dcbe314..6ccc6f9 100644
--- a/y2018/wpilib_interface.cc
+++ b/y2018/wpilib_interface.cc
@@ -438,27 +438,27 @@
values.arm_distal.potentiometer_offset);
CopyPosition(left_intake_encoder_,
- &superstructure_message->intake.left.motor_position,
+ &superstructure_message->left_intake.motor_position,
Values::kIntakeMotorEncoderCountsPerRevolution(),
Values::kIntakeMotorEncoderRatio(), intake_pot_translate,
false, values.left_intake.potentiometer_offset);
CopyPosition(right_intake_encoder_,
- &superstructure_message->intake.right.motor_position,
+ &superstructure_message->right_intake.motor_position,
Values::kIntakeMotorEncoderCountsPerRevolution(),
Values::kIntakeMotorEncoderRatio(), intake_pot_translate,
true, values.right_intake.potentiometer_offset);
- superstructure_message->intake.left.spring_angle =
+ superstructure_message->left_intake.spring_angle =
intake_spring_translate(left_intake_spring_angle_->GetVoltage()) +
values.left_intake.spring_offset;
- superstructure_message->intake.left.beam_break =
+ superstructure_message->left_intake.beam_break =
left_intake_cube_detector_->Get();
- superstructure_message->intake.right.spring_angle =
+ superstructure_message->right_intake.spring_angle =
-intake_spring_translate(right_intake_spring_angle_->GetVoltage()) +
values.right_intake.spring_offset;
- superstructure_message->intake.right.beam_break =
+ superstructure_message->right_intake.beam_break =
right_intake_cube_detector_->Get();
superstructure_message.Send();
@@ -711,22 +711,22 @@
LOG_STRUCT(DEBUG, "will output", *queue);
left_intake_elastic_victor_->SetSpeed(
- ::aos::Clip(-queue->intake.left.voltage_elastic, -kMaxBringupPower,
+ ::aos::Clip(-queue->left_intake.voltage_elastic, -kMaxBringupPower,
kMaxBringupPower) /
12.0);
right_intake_elastic_victor_->SetSpeed(
- ::aos::Clip(queue->intake.right.voltage_elastic, -kMaxBringupPower,
+ ::aos::Clip(queue->right_intake.voltage_elastic, -kMaxBringupPower,
kMaxBringupPower) /
12.0);
left_intake_rollers_victor_->SetSpeed(
- ::aos::Clip(-queue->intake.left.voltage_rollers, -kMaxBringupPower,
+ ::aos::Clip(-queue->left_intake.voltage_rollers, -kMaxBringupPower,
kMaxBringupPower) /
12.0);
right_intake_rollers_victor_->SetSpeed(
- ::aos::Clip(queue->intake.right.voltage_rollers, -kMaxBringupPower,
+ ::aos::Clip(queue->right_intake.voltage_rollers, -kMaxBringupPower,
kMaxBringupPower) /
12.0);