Merge "Fix typo for bulk endpoints"
diff --git a/aos/common/logging/implementations_test.cc b/aos/common/logging/implementations_test.cc
index aade0d1..9663fd2 100644
--- a/aos/common/logging/implementations_test.cc
+++ b/aos/common/logging/implementations_test.cc
@@ -211,10 +211,10 @@
// Make sure rounding works correctly.
ASSERT_EQ(18, snprintf(buffer, sizeof(buffer), AOS_TIME_FORMAT,
AOS_TIME_ARGS(2, 999)));
- EXPECT_EQ("0000000002.000001s", ::std::string(buffer));
+ EXPECT_EQ("0000000002.000000s", ::std::string(buffer));
ASSERT_EQ(18, snprintf(buffer, sizeof(buffer), AOS_TIME_FORMAT,
AOS_TIME_ARGS(2, 500)));
- EXPECT_EQ("0000000002.000001s", ::std::string(buffer));
+ EXPECT_EQ("0000000002.000000s", ::std::string(buffer));
ASSERT_EQ(18, snprintf(buffer, sizeof(buffer), AOS_TIME_FORMAT,
AOS_TIME_ARGS(2, 499)));
EXPECT_EQ("0000000002.000000s", ::std::string(buffer));
@@ -223,6 +223,11 @@
ASSERT_EQ(18, snprintf(buffer, sizeof(buffer), AOS_TIME_FORMAT,
AOS_TIME_ARGS(1, 995000000)));
EXPECT_EQ("0000000001.995000s", ::std::string(buffer));
+
+ // This used to result in "0000000001.099500s".
+ ASSERT_EQ(18, snprintf(buffer, sizeof(buffer), AOS_TIME_FORMAT,
+ AOS_TIME_ARGS(1, 999999999)));
+ EXPECT_EQ("0000000001.999999s", ::std::string(buffer));
}
TEST(LoggingPrintFormatTest, Base) {
diff --git a/aos/common/logging/printf_formats.h b/aos/common/logging/printf_formats.h
index b098865..60960a4 100644
--- a/aos/common/logging/printf_formats.h
+++ b/aos/common/logging/printf_formats.h
@@ -11,9 +11,7 @@
#define AOS_TIME_FORMAT \
"%010" PRId32 ".%0" STRINGIFY(AOS_TIME_NSECONDS_DIGITS) PRId32 "s"
-#define AOS_TIME_ARGS(sec, nsec) \
- sec, (nsec + (AOS_TIME_NSECONDS_DENOMINATOR / 2)) / \
- AOS_TIME_NSECONDS_DENOMINATOR
+#define AOS_TIME_ARGS(sec, nsec) sec, (nsec / AOS_TIME_NSECONDS_DENOMINATOR)
#define AOS_LOGGING_BASE_FORMAT \
"%.*s(%" PRId32 ")(%05" PRIu16 "): %-7s at " AOS_TIME_FORMAT ": "
diff --git a/motors/little_schematic/board.pcb b/motors/little_schematic/board.pcb
index cac913d..72a32a2 100644
--- a/motors/little_schematic/board.pcb
+++ b/motors/little_schematic/board.pcb
@@ -9,7 +9,7 @@
PolyArea[3100.006200]
Thermal[0.500000]
DRC[6.00mil 10.00mil 6.00mil 8.00mil 11.81mil 8.00mil]
-Flags("showdrc,nameonpcb,clearnew,snappin,locknames")
+Flags("showdrc,nameonpcb,clearnew,snappin,onlynames")
Groups("1,c:3:2:4,s:5:6")
Styles["Signal,10.00mil,36.00mil,20.00mil,7.00mil:Power,25.00mil,60.00mil,35.00mil,10.00mil:Fat,50.00mil,85.00mil,50.00mil,10.00mil:Skinny,16.00mil,46.00mil,28.00mil,7.00mil"]
@@ -2322,7 +2322,7 @@
)
-Element["" "0603" "R63" "120" 2510.00mil 2050.00mil 31.50mil 31.50mil 2 100 ""]
+Element["" "0603" "R63" "120" 2510.00mil 2050.00mil -41.50mil 18.50mil 0 100 ""]
(
Pad[25.59mil -4.92mil 25.59mil 4.92mil 29.52mil 20.00mil 35.52mil "1" "1" "square"]
Pad[-25.59mil -4.92mil -25.59mil 4.92mil 29.52mil 20.00mil 35.52mil "2" "2" "square"]
diff --git a/setup_roborio.sh b/setup_roborio.sh
new file mode 100755
index 0000000..d7a4144
--- /dev/null
+++ b/setup_roborio.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+cd $(dirname $0)
+pwd
+
+set -e
+
+if [ $# != 1 ];
+then
+ echo "Usage: setup_robot.sh 971"
+ exit 1
+fi
+
+readonly ROBOT_HOSTNAME="$1"
+
+bazel build -c opt @arm_frc_linux_gnueabi_repo//...
+
+ssh-copy-id "admin@${ROBOT_HOSTNAME}"
+
+if $(ssh "admin@${ROBOT_HOSTNAME}" "cat /etc/profile" | grep -Fq "alias l");
+then
+ echo "Already has l alias"
+else
+ echo "Adding l alias"
+ ssh "admin@${ROBOT_HOSTNAME}" 'echo "alias l=\"ls -la\"" >> /etc/profile'
+fi
+
+ssh "admin@${ROBOT_HOSTNAME}" 'PATH="${PATH}":/usr/local/natinst/bin/ /usr/local/frc/bin/frcKillRobot.sh -r -t'
+
+echo "Deploying robotCommand startup script"
+scp aos/config/robotCommand "admin@${ROBOT_HOSTNAME}:/home/lvuser/"
+
+scp bazel-971-Robot-Code/external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/lib/libstdc++.so.6.0.20 "admin@${ROBOT_HOSTNAME}:/usr/lib/"
diff --git a/y2014/control_loops/claw/BUILD b/y2014/control_loops/claw/BUILD
index 5602bbc..45a77b0 100644
--- a/y2014/control_loops/claw/BUILD
+++ b/y2014/control_loops/claw/BUILD
@@ -69,11 +69,12 @@
'claw_lib_test.cc',
],
deps = [
- '//aos/testing:googletest',
- ':claw_queue',
':claw_lib',
- '//frc971/control_loops:state_feedback_loop',
+ ':claw_queue',
'//aos/common/controls:control_loop_test',
+ '//aos/testing:googletest',
+ '//frc971/control_loops:state_feedback_loop',
+ '//frc971/control_loops:team_number_test_environment',
],
)
diff --git a/y2014/control_loops/claw/claw_lib_test.cc b/y2014/control_loops/claw/claw_lib_test.cc
index 8444cea..8a7e9c3 100644
--- a/y2014/control_loops/claw/claw_lib_test.cc
+++ b/y2014/control_loops/claw/claw_lib_test.cc
@@ -4,7 +4,7 @@
#include <memory>
#include "aos/common/controls/control_loop_test.h"
-#include "aos/common/network/team_number.h"
+#include "frc971/control_loops/team_number_test_environment.h"
#include "gtest/gtest.h"
#include "y2014/constants.h"
#include "y2014/control_loops/claw/claw.h"
@@ -28,15 +28,6 @@
CLAW_COUNT
} ClawType;
-class TeamNumberEnvironment : public ::testing::Environment {
- public:
- // Override this to define how to set up the environment.
- virtual void SetUp() { aos::network::OverrideTeamNumber(1); }
-};
-
-::testing::Environment* const team_number_env =
- ::testing::AddGlobalTestEnvironment(new TeamNumberEnvironment);
-
// Class which simulates the wrist and sends out queue messages containing the
// position.
class ClawMotorSimulation {
diff --git a/y2014/control_loops/shooter/BUILD b/y2014/control_loops/shooter/BUILD
index c10baae..8195060 100644
--- a/y2014/control_loops/shooter/BUILD
+++ b/y2014/control_loops/shooter/BUILD
@@ -68,11 +68,12 @@
'shooter_lib_test.cc',
],
deps = [
- '//aos/testing:googletest',
- ':shooter_queue',
':shooter_lib',
+ ':shooter_queue',
'//aos/common/controls:control_loop_test',
+ '//aos/testing:googletest',
'//frc971/control_loops:state_feedback_loop',
+ '//frc971/control_loops:team_number_test_environment',
],
)
diff --git a/y2014/control_loops/shooter/shooter_lib_test.cc b/y2014/control_loops/shooter/shooter_lib_test.cc
index df3f5fd..851e617 100644
--- a/y2014/control_loops/shooter/shooter_lib_test.cc
+++ b/y2014/control_loops/shooter/shooter_lib_test.cc
@@ -3,13 +3,14 @@
#include <chrono>
#include <memory>
-#include "gtest/gtest.h"
-#include "aos/common/network/team_number.h"
#include "aos/common/controls/control_loop_test.h"
-#include "y2014/control_loops/shooter/shooter.q.h"
-#include "y2014/control_loops/shooter/shooter.h"
-#include "y2014/control_loops/shooter/unaugmented_shooter_motor_plant.h"
+#include "aos/common/network/team_number.h"
+#include "frc971/control_loops/team_number_test_environment.h"
+#include "gtest/gtest.h"
#include "y2014/constants.h"
+#include "y2014/control_loops/shooter/shooter.h"
+#include "y2014/control_loops/shooter/shooter.q.h"
+#include "y2014/control_loops/shooter/unaugmented_shooter_motor_plant.h"
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -20,18 +21,7 @@
using ::y2014::control_loops::shooter::kMaxExtension;
using ::y2014::control_loops::shooter::MakeRawShooterPlant;
-
-static const int kTestTeam = 1;
-
-class TeamNumberEnvironment : public ::testing::Environment {
- public:
- // Override this to define how to set up the environment.
- virtual void SetUp() { aos::network::OverrideTeamNumber(kTestTeam); }
-};
-
-::testing::Environment *const team_number_env =
- ::testing::AddGlobalTestEnvironment(new TeamNumberEnvironment);
-
+using ::frc971::control_loops::testing::kTeamNumber;
// Class which simulates the shooter and sends out queue messages containing the
// position.
@@ -463,9 +453,8 @@
shooter_motor_.Iterate();
shooter_motor_plant_.Simulate();
SimulateTimestep(true);
- EXPECT_LT(
- shooter_motor_plant_.GetAbsolutePosition(),
- constants::GetValuesForTeam(kTestTeam).shooter.upper_limit);
+ EXPECT_LT(shooter_motor_plant_.GetAbsolutePosition(),
+ constants::GetValuesForTeam(kTeamNumber).shooter.upper_limit);
}
EXPECT_EQ(ShooterMotor::STATE_READY, shooter_motor_.state());
}
@@ -725,12 +714,12 @@
::testing::Bool(), ::testing::Bool(), ::testing::Bool(),
::testing::Values(
0.05,
- constants::GetValuesForTeam(kTestTeam).shooter.upper_limit - 0.05,
- HallEffectMiddle(constants::GetValuesForTeam(kTestTeam)
+ constants::GetValuesForTeam(kTeamNumber).shooter.upper_limit - 0.05,
+ HallEffectMiddle(constants::GetValuesForTeam(kTeamNumber)
.shooter.pusher_proximal),
- HallEffectMiddle(constants::GetValuesForTeam(kTestTeam)
- .shooter.pusher_distal),
- constants::GetValuesForTeam(kTestTeam)
+ HallEffectMiddle(
+ constants::GetValuesForTeam(kTeamNumber).shooter.pusher_distal),
+ constants::GetValuesForTeam(kTeamNumber)
.shooter.latch_max_safe_position -
0.001)));
diff --git a/y2017_bot3/BUILD b/y2017_bot3/BUILD
index 9ff13fd..9fc50f8 100644
--- a/y2017_bot3/BUILD
+++ b/y2017_bot3/BUILD
@@ -1,6 +1,27 @@
load('/aos/downloader/downloader', 'aos_downloader')
cc_binary(
+ name = 'joystick_reader',
+ srcs = [
+ 'joystick_reader.cc',
+ ],
+ deps = [
+ '//aos/common/actions:action_lib',
+ '//aos/common/logging',
+ '//aos/common/util:log_interval',
+ '//aos/common:time',
+ '//aos/input:drivetrain_input',
+ '//aos/input:joystick_input',
+ '//aos/linux_code:init',
+ '//frc971/autonomous:auto_queue',
+ '//frc971/control_loops/drivetrain:drivetrain_queue',
+ '//frc971/autonomous:base_autonomous_actor',
+ '//y2017_bot3/control_loops/superstructure:superstructure_queue',
+ '//y2017_bot3/control_loops/superstructure:superstructure_lib',
+ ],
+)
+
+cc_binary(
name = 'wpilib_interface',
srcs = [
'wpilib_interface.cc',
@@ -43,6 +64,7 @@
start_srcs = [
'//aos:prime_start_binaries',
'//y2017_bot3/control_loops/drivetrain:drivetrain',
+ '//y2017_bot3/control_loops/superstructure:superstructure',
':wpilib_interface',
],
srcs = [
@@ -56,6 +78,7 @@
start_srcs = [
'//aos:prime_start_binaries_stripped',
'//y2017_bot3/control_loops/drivetrain:drivetrain.stripped',
+ '//y2017_bot3/control_loops/superstructure:superstructure.stripped',
':wpilib_interface.stripped',
],
srcs = [
diff --git a/y2017_bot3/joystick_reader.cc b/y2017_bot3/joystick_reader.cc
index 0d43efd..40a8d12 100644
--- a/y2017_bot3/joystick_reader.cc
+++ b/y2017_bot3/joystick_reader.cc
@@ -14,7 +14,6 @@
#include "frc971/autonomous/auto.q.h"
#include "frc971/autonomous/base_autonomous_actor.h"
#include "frc971/control_loops/drivetrain/drivetrain.q.h"
-#include "y2017_bot3/actors/autonomous_actor.h"
#include "y2017_bot3/control_loops/superstructure/superstructure.q.h"
using ::frc971::control_loops::drivetrain_queue;
@@ -46,7 +45,12 @@
}
void RunIteration(const ::aos::input::driver_station::Data &data) override {
- bool last_auto_running = auto_running_;
+ if (!data.GetControlBit(ControlBit::kEnabled)) {
+ action_queue_.CancelAllActions();
+ LOG(DEBUG, "Canceling\n");
+ }
+
+ const bool last_auto_running = auto_running_;
auto_running_ = data.GetControlBit(ControlBit::kAutonomous) &&
data.GetControlBit(ControlBit::kEnabled);
if (auto_running_ != last_auto_running) {
@@ -67,11 +71,6 @@
was_running_ = action_queue_.Running();
}
- if (!data.GetControlBit(ControlBit::kEnabled)) {
- action_queue_.CancelAllActions();
- LOG(DEBUG, "Canceling\n");
- }
-
void HandleDrivetrain(const ::aos::input::driver_station::Data &data) {
drivetrain_input_reader_->HandleDrivetrain(data);
robot_velocity_ = drivetrain_input_reader_->robot_velocity();