Autogen rules written for elevator module.
Put most things in the y2015 namespace since codegen wants to place
the controller gains in that namespace.
Change-Id: Ib3ef6eb38200bf0d80cba972cbe06ea366522ec6
diff --git a/y2015/actors/can_pickup_action.q b/y2015/actors/can_pickup_action.q
index 4846722..bf61a0f 100644
--- a/y2015/actors/can_pickup_action.q
+++ b/y2015/actors/can_pickup_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
diff --git a/y2015/actors/can_pickup_actor.cc b/y2015/actors/can_pickup_actor.cc
index d2a191f..166b246 100644
--- a/y2015/actors/can_pickup_actor.cc
+++ b/y2015/actors/can_pickup_actor.cc
@@ -7,9 +7,10 @@
#include "y2015/constants.h"
#include "y2015/control_loops/claw/claw.q.h"
-using ::frc971::control_loops::fridge_queue;
+using ::y2015::control_loops::fridge::fridge_queue;
+using ::y2015::control_loops::claw_queue;
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
constexpr ProfileParams kHorizontalMove{1.1, 1.8};
@@ -45,7 +46,7 @@
bool CanPickupActor::RunAction(const CanPickupParams ¶ms) {
// Make sure the claw is down.
{
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = 0.0;
message->angular_velocity = 0.0;
message->intake = 0.0;
@@ -68,7 +69,7 @@
return false;
}
{
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = 0.0;
message->angular_velocity = 0.0;
message->intake = 0.0;
@@ -115,8 +116,8 @@
::std::unique_ptr<CanPickupAction> MakeCanPickupAction(
const CanPickupParams ¶ms) {
return ::std::unique_ptr<CanPickupAction>(
- new CanPickupAction(&::frc971::actors::can_pickup_action, params));
+ new CanPickupAction(&::y2015::actors::can_pickup_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/can_pickup_actor.h b/y2015/actors/can_pickup_actor.h
index f0b1ec9..10677b9 100644
--- a/y2015/actors/can_pickup_actor.h
+++ b/y2015/actors/can_pickup_actor.h
@@ -10,7 +10,7 @@
#include "y2015/actors/can_pickup_action.q.h"
#include "y2015/actors/fridge_profile_lib.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class CanPickupActor : public FridgeActorBase<CanPickupActionQueueGroup> {
@@ -32,6 +32,6 @@
const CanPickupParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif
diff --git a/y2015/actors/can_pickup_actor_main.cc b/y2015/actors/can_pickup_actor_main.cc
index 1afb500..b23d981 100644
--- a/y2015/actors/can_pickup_actor_main.cc
+++ b/y2015/actors/can_pickup_actor_main.cc
@@ -7,7 +7,7 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- ::frc971::actors::CanPickupActor can_pickup(&::frc971::actors::can_pickup_action);
+ ::y2015::actors::CanPickupActor can_pickup(&::y2015::actors::can_pickup_action);
can_pickup.Run();
::aos::Cleanup();
diff --git a/y2015/actors/drivetrain_action.q b/y2015/actors/drivetrain_action.q
index 9ad55d3..1c13f2b 100644
--- a/y2015/actors/drivetrain_action.q
+++ b/y2015/actors/drivetrain_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
diff --git a/y2015/actors/drivetrain_actor.cc b/y2015/actors/drivetrain_actor.cc
index 32db222..945d923 100644
--- a/y2015/actors/drivetrain_actor.cc
+++ b/y2015/actors/drivetrain_actor.cc
@@ -15,10 +15,11 @@
#include "y2015/actors/drivetrain_actor.h"
#include "y2015/constants.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace chrono = ::std::chrono;
+using ::frc971::control_loops::drivetrain_queue;
DrivetrainActor::DrivetrainActor(actors::DrivetrainActionQueueGroup* s)
: aos::common::actions::ActorBase<actors::DrivetrainActionQueueGroup>(s) {}
@@ -49,9 +50,9 @@
while (true) {
::aos::time::PhasedLoopXMS(5, 2500);
- control_loops::drivetrain_queue.status.FetchLatest();
- if (control_loops::drivetrain_queue.status.get()) {
- const auto& status = *control_loops::drivetrain_queue.status;
+ drivetrain_queue.status.FetchLatest();
+ if (drivetrain_queue.status.get()) {
+ const auto& status = *drivetrain_queue.status;
if (::std::abs(status.uncapped_left_voltage -
status.uncapped_right_voltage) > 24) {
LOG(DEBUG, "spinning in place\n");
@@ -118,7 +119,7 @@
LOG(DEBUG, "Driving left to %f, right to %f\n",
left_goal_state(0, 0) + params.left_initial_position,
right_goal_state(0, 0) + params.right_initial_position);
- control_loops::drivetrain_queue.goal.MakeWithBuilder()
+ drivetrain_queue.goal.MakeWithBuilder()
.control_loop_driving(true)
//.highgear(false)
.left_goal(left_goal_state(0, 0) + params.left_initial_position)
@@ -128,25 +129,25 @@
.Send();
}
if (ShouldCancel()) return true;
- control_loops::drivetrain_queue.status.FetchLatest();
- while (!control_loops::drivetrain_queue.status.get()) {
+ drivetrain_queue.status.FetchLatest();
+ while (!drivetrain_queue.status.get()) {
LOG(WARNING,
"No previous drivetrain status packet, trying to fetch again\n");
- control_loops::drivetrain_queue.status.FetchNextBlocking();
+ drivetrain_queue.status.FetchNextBlocking();
if (ShouldCancel()) return true;
}
while (true) {
if (ShouldCancel()) return true;
const double kPositionThreshold = 0.05;
- const double left_error = ::std::abs(
- control_loops::drivetrain_queue.status->estimated_left_position -
- (left_goal_state(0, 0) + params.left_initial_position));
- const double right_error = ::std::abs(
- control_loops::drivetrain_queue.status->estimated_right_position -
- (right_goal_state(0, 0) + params.right_initial_position));
+ const double left_error =
+ ::std::abs(drivetrain_queue.status->estimated_left_position -
+ (left_goal_state(0, 0) + params.left_initial_position));
+ const double right_error =
+ ::std::abs(drivetrain_queue.status->estimated_right_position -
+ (right_goal_state(0, 0) + params.right_initial_position));
const double velocity_error =
- ::std::abs(control_loops::drivetrain_queue.status->robot_speed);
+ ::std::abs(drivetrain_queue.status->robot_speed);
if (left_error < kPositionThreshold && right_error < kPositionThreshold &&
velocity_error < 0.2) {
break;
@@ -154,17 +155,17 @@
LOG(DEBUG, "Drivetrain error is %f, %f, %f\n", left_error, right_error,
velocity_error);
}
- control_loops::drivetrain_queue.status.FetchNextBlocking();
+ drivetrain_queue.status.FetchNextBlocking();
}
LOG(INFO, "Done moving\n");
return true;
}
::std::unique_ptr<DrivetrainAction> MakeDrivetrainAction(
- const ::frc971::actors::DrivetrainActionParams& params) {
+ const ::y2015::actors::DrivetrainActionParams& params) {
return ::std::unique_ptr<DrivetrainAction>(
- new DrivetrainAction(&::frc971::actors::drivetrain_action, params));
+ new DrivetrainAction(&::y2015::actors::drivetrain_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/drivetrain_actor.h b/y2015/actors/drivetrain_actor.h
index 369c6ed..0927f38 100644
--- a/y2015/actors/drivetrain_actor.h
+++ b/y2015/actors/drivetrain_actor.h
@@ -7,7 +7,7 @@
#include "aos/common/actions/actor.h"
#include "aos/common/actions/actions.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class DrivetrainActor
@@ -23,9 +23,9 @@
// Makes a new DrivetrainActor action.
::std::unique_ptr<DrivetrainAction> MakeDrivetrainAction(
- const ::frc971::actors::DrivetrainActionParams& params);
+ const ::y2015::actors::DrivetrainActionParams& params);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif
diff --git a/y2015/actors/drivetrain_actor_main.cc b/y2015/actors/drivetrain_actor_main.cc
index 6f567d7..76519f2 100644
--- a/y2015/actors/drivetrain_actor_main.cc
+++ b/y2015/actors/drivetrain_actor_main.cc
@@ -9,8 +9,8 @@
int main(int /*argc*/, char * /*argv*/[]) {
::aos::Init(-1);
- frc971::actors::DrivetrainActor drivetrain(
- &::frc971::actors::drivetrain_action);
+ y2015::actors::DrivetrainActor drivetrain(
+ &::y2015::actors::drivetrain_action);
drivetrain.Run();
::aos::Cleanup();
diff --git a/y2015/actors/fridge_profile_lib.h b/y2015/actors/fridge_profile_lib.h
index ce75f75..8980848 100644
--- a/y2015/actors/fridge_profile_lib.h
+++ b/y2015/actors/fridge_profile_lib.h
@@ -7,7 +7,7 @@
#include "aos/common/util/phased_loop.h"
#include "y2015/control_loops/fridge/fridge.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
struct ProfileParams {
@@ -34,7 +34,8 @@
ProfileParams elevator_parameters,
ProfileParams arm_parameters, bool top_grabbers,
bool front_grabbers, bool back_grabbers) {
- auto new_fridge_goal = control_loops::fridge_queue.goal.MakeMessage();
+ auto new_fridge_goal =
+ control_loops::fridge::fridge_queue.goal.MakeMessage();
new_fridge_goal->profiling_type = 0;
new_fridge_goal->max_velocity = elevator_parameters.velocity;
new_fridge_goal->max_acceleration = elevator_parameters.acceleration;
@@ -65,29 +66,30 @@
bool front_grabbers, bool back_grabbers) {
if (this->ShouldCancel()) {
LOG(INFO, "Canceling fridge movement\n");
- if (!control_loops::fridge_queue.status.get()) {
+ if (!control_loops::fridge::fridge_queue.status.get()) {
LOG(WARNING, "no fridge status so can't really cancel\n");
return CANCELED;
}
- auto new_fridge_goal = control_loops::fridge_queue.goal.MakeMessage();
+ auto new_fridge_goal =
+ control_loops::fridge::fridge_queue.goal.MakeMessage();
new_fridge_goal->profiling_type = 0;
new_fridge_goal->max_velocity = elevator_parameters.velocity;
new_fridge_goal->max_acceleration = elevator_parameters.acceleration;
new_fridge_goal->height =
- control_loops::fridge_queue.status->height +
- (control_loops::fridge_queue.status->goal_velocity *
- ::std::abs(control_loops::fridge_queue.status->goal_velocity)) /
+ control_loops::fridge::fridge_queue.status->height +
+ (control_loops::fridge::fridge_queue.status->goal_velocity *
+ ::std::abs(control_loops::fridge::fridge_queue.status->goal_velocity)) /
(2.0 * new_fridge_goal->max_acceleration);
height = new_fridge_goal->height;
new_fridge_goal->velocity = 0.0;
new_fridge_goal->max_angular_velocity = arm_parameters.velocity;
new_fridge_goal->max_angular_acceleration = arm_parameters.acceleration;
new_fridge_goal->angle =
- control_loops::fridge_queue.status->angle +
- (control_loops::fridge_queue.status->goal_angular_velocity *
+ control_loops::fridge::fridge_queue.status->angle +
+ (control_loops::fridge::fridge_queue.status->goal_angular_velocity *
::std::abs(
- control_loops::fridge_queue.status->goal_angular_velocity)) /
+ control_loops::fridge::fridge_queue.status->goal_angular_velocity)) /
(2.0 * new_fridge_goal->max_angular_acceleration);
angle = new_fridge_goal->angle;
new_fridge_goal->angular_velocity = 0.0;
@@ -101,29 +103,30 @@
}
return CANCELED;
}
- control_loops::fridge_queue.status.FetchAnother();
+ control_loops::fridge::fridge_queue.status.FetchAnother();
constexpr double kProfileError = 1e-5;
constexpr double kAngleEpsilon = 0.02, kHeightEpsilon = 0.015;
- if (control_loops::fridge_queue.status->state != 4) {
+ if (control_loops::fridge::fridge_queue.status->state != 4) {
LOG(ERROR, "Fridge no longer running, aborting action\n");
return CANCELED;
}
- if (::std::abs(control_loops::fridge_queue.status->goal_angle - angle) <
+ if (::std::abs(control_loops::fridge::fridge_queue.status->goal_angle -
+ angle) < kProfileError &&
+ ::std::abs(control_loops::fridge::fridge_queue.status->goal_height -
+ height) < kProfileError &&
+ ::std::abs(
+ control_loops::fridge::fridge_queue.status->goal_angular_velocity) <
kProfileError &&
- ::std::abs(control_loops::fridge_queue.status->goal_height - height) <
- kProfileError &&
- ::std::abs(control_loops::fridge_queue.status->goal_angular_velocity) <
- kProfileError &&
- ::std::abs(control_loops::fridge_queue.status->goal_velocity) <
+ ::std::abs(control_loops::fridge::fridge_queue.status->goal_velocity) <
kProfileError) {
LOG(INFO, "Profile done.\n");
- if (::std::abs(control_loops::fridge_queue.status->angle - angle) <
- kAngleEpsilon &&
- ::std::abs(control_loops::fridge_queue.status->height -
- height) < kHeightEpsilon) {
+ if (::std::abs(control_loops::fridge::fridge_queue.status->angle -
+ angle) < kAngleEpsilon &&
+ ::std::abs(control_loops::fridge::fridge_queue.status->height -
+ height) < kHeightEpsilon) {
LOG(INFO, "Near goal, done.\n");
return DONE;
}
@@ -179,28 +182,31 @@
bool top_grabbers, bool front_grabbers,
bool back_grabbers) {
LOG(INFO, "Canceling fridge movement\n");
- if (!control_loops::fridge_queue.status.get()) {
+ if (!control_loops::fridge::fridge_queue.status.get()) {
LOG(WARNING, "no fridge status so can't really cancel\n");
return;
}
- auto new_fridge_goal = control_loops::fridge_queue.goal.MakeMessage();
+ auto new_fridge_goal =
+ control_loops::fridge::fridge_queue.goal.MakeMessage();
new_fridge_goal->profiling_type = 1;
new_fridge_goal->max_x_velocity = x_parameters.velocity;
new_fridge_goal->max_x_acceleration = x_parameters.acceleration;
new_fridge_goal->x =
- control_loops::fridge_queue.status->x +
- (control_loops::fridge_queue.status->goal_x_velocity *
- ::std::abs(control_loops::fridge_queue.status->goal_x_velocity)) /
+ control_loops::fridge::fridge_queue.status->x +
+ (control_loops::fridge::fridge_queue.status->goal_x_velocity *
+ ::std::abs(
+ control_loops::fridge::fridge_queue.status->goal_x_velocity)) /
(2.0 * new_fridge_goal->max_x_acceleration);
new_fridge_goal->x_velocity = 0.0;
new_fridge_goal->max_y_velocity = y_parameters.velocity;
new_fridge_goal->max_y_acceleration = y_parameters.acceleration;
new_fridge_goal->y =
- control_loops::fridge_queue.status->y +
- (control_loops::fridge_queue.status->goal_y_velocity *
- ::std::abs(control_loops::fridge_queue.status->goal_y_velocity)) /
+ control_loops::fridge::fridge_queue.status->y +
+ (control_loops::fridge::fridge_queue.status->goal_y_velocity *
+ ::std::abs(
+ control_loops::fridge::fridge_queue.status->goal_y_velocity)) /
(2.0 * new_fridge_goal->max_y_acceleration);
new_fridge_goal->y_velocity = 0.0;
@@ -222,27 +228,31 @@
back_grabbers);
return CANCELED;
}
- control_loops::fridge_queue.status.FetchAnother();
+ control_loops::fridge::fridge_queue.status.FetchAnother();
constexpr double kProfileError = 1e-5;
constexpr double kXEpsilon = 0.02, kYEpsilon = 0.02;
- if (control_loops::fridge_queue.status->state != 4) {
+ if (control_loops::fridge::fridge_queue.status->state != 4) {
LOG(ERROR, "Fridge no longer running, aborting action\n");
return CANCELED;
}
- if (::std::abs(control_loops::fridge_queue.status->goal_x - x) <
+ if (::std::abs(control_loops::fridge::fridge_queue.status->goal_x - x) <
kProfileError &&
- ::std::abs(control_loops::fridge_queue.status->goal_y - y) <
+ ::std::abs(control_loops::fridge::fridge_queue.status->goal_y - y) <
kProfileError &&
- ::std::abs(control_loops::fridge_queue.status->goal_x_velocity) <
+ ::std::abs(
+ control_loops::fridge::fridge_queue.status->goal_x_velocity) <
kProfileError &&
- ::std::abs(control_loops::fridge_queue.status->goal_y_velocity) <
+ ::std::abs(
+ control_loops::fridge::fridge_queue.status->goal_y_velocity) <
kProfileError) {
LOG(INFO, "Profile done.\n");
- if (::std::abs(control_loops::fridge_queue.status->x - x) < kXEpsilon &&
- ::std::abs(control_loops::fridge_queue.status->y - y) < kYEpsilon) {
+ if (::std::abs(control_loops::fridge::fridge_queue.status->x - x) <
+ kXEpsilon &&
+ ::std::abs(control_loops::fridge::fridge_queue.status->y - y) <
+ kYEpsilon) {
LOG(INFO, "Near goal, done.\n");
return DONE;
}
@@ -254,7 +264,8 @@
bool StartFridgeXYProfile(double x, double y, ProfileParams x_parameters,
ProfileParams y_parameters, bool top_grabbers,
bool front_grabbers, bool back_grabbers) {
- auto new_fridge_goal = control_loops::fridge_queue.goal.MakeMessage();
+ auto new_fridge_goal =
+ control_loops::fridge::fridge_queue.goal.MakeMessage();
new_fridge_goal->profiling_type = 1;
new_fridge_goal->max_x_velocity = x_parameters.velocity;
new_fridge_goal->max_x_acceleration = x_parameters.acceleration;
@@ -280,6 +291,6 @@
};
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif // Y2015_ACTORS_FRIDGE_PROFILE_LIB_H_
diff --git a/y2015/actors/held_to_lift_action.q b/y2015/actors/held_to_lift_action.q
index c2dd689..d3d456e 100644
--- a/y2015/actors/held_to_lift_action.q
+++ b/y2015/actors/held_to_lift_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
import "y2015/actors/lift_action_params.q";
diff --git a/y2015/actors/held_to_lift_actor.cc b/y2015/actors/held_to_lift_actor.cc
index 29d68ef..942488d 100644
--- a/y2015/actors/held_to_lift_actor.cc
+++ b/y2015/actors/held_to_lift_actor.cc
@@ -8,7 +8,7 @@
#include "y2015/actors/lift_actor.h"
#include "y2015/control_loops/claw/claw.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
constexpr ProfileParams kArmMove{0.6, 2.0};
@@ -18,13 +18,15 @@
} // namespace
namespace chrono = ::std::chrono;
+using ::y2015::control_loops::fridge::fridge_queue;
+using ::y2015::control_loops::claw_queue;
HeldToLiftActor::HeldToLiftActor(HeldToLiftActionQueueGroup *queues)
: FridgeActorBase<HeldToLiftActionQueueGroup>(queues) {}
bool HeldToLiftActor::RunAction(const HeldToLiftParams ¶ms) {
- control_loops::fridge_queue.status.FetchLatest();
- if (!control_loops::fridge_queue.status.get()) {
+ fridge_queue.status.FetchLatest();
+ if (!fridge_queue.status.get()) {
return false;
}
@@ -32,14 +34,14 @@
{
bool send_goal = true;
double claw_goal = params.claw_out_angle;
- control_loops::claw_queue.status.FetchLatest();
- if (control_loops::claw_queue.status.get()) {
- if (control_loops::claw_queue.status->goal_angle < claw_goal) {
+ claw_queue.status.FetchLatest();
+ if (claw_queue.status.get()) {
+ if (claw_queue.status->goal_angle < claw_goal) {
send_goal = false;
}
}
if (send_goal) {
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.claw_out_angle;
message->angular_velocity = 0.0;
message->intake = 0.0;
@@ -52,17 +54,16 @@
}
}
- control_loops::fridge_queue.status.FetchLatest();
- if (!control_loops::fridge_queue.status.get()) {
+ fridge_queue.status.FetchLatest();
+ if (!fridge_queue.status.get()) {
return false;
}
- if (control_loops::fridge_queue.status->goal_height != params.bottom_height ||
- control_loops::fridge_queue.status->goal_angle != 0.0) {
+ if (fridge_queue.status->goal_height != params.bottom_height ||
+ fridge_queue.status->goal_angle != 0.0) {
// Lower with the fridge clamps open and move it forwards slightly to clear.
- DoFridgeProfile(control_loops::fridge_queue.status->goal_height,
- params.arm_clearance, kFastElevatorMove, kFastArmMove,
- false);
+ DoFridgeProfile(fridge_queue.status->goal_height, params.arm_clearance,
+ kFastElevatorMove, kFastArmMove, false);
if (ShouldCancel()) return true;
DoFridgeProfile(params.bottom_height, params.arm_clearance,
@@ -111,8 +112,8 @@
::std::unique_ptr<HeldToLiftAction> MakeHeldToLiftAction(
const HeldToLiftParams ¶ms) {
return ::std::unique_ptr<HeldToLiftAction>(
- new HeldToLiftAction(&::frc971::actors::held_to_lift_action, params));
+ new HeldToLiftAction(&::y2015::actors::held_to_lift_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/held_to_lift_actor.h b/y2015/actors/held_to_lift_actor.h
index 369fea4..f431f9c 100644
--- a/y2015/actors/held_to_lift_actor.h
+++ b/y2015/actors/held_to_lift_actor.h
@@ -10,7 +10,7 @@
#include "y2015/actors/held_to_lift_action.q.h"
#include "y2015/actors/fridge_profile_lib.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class HeldToLiftActor : public FridgeActorBase<HeldToLiftActionQueueGroup> {
@@ -28,6 +28,6 @@
const HeldToLiftParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif // Y2015_ACTORS_HELD_TO_LIFT_ACTOR_H_
diff --git a/y2015/actors/held_to_lift_actor_main.cc b/y2015/actors/held_to_lift_actor_main.cc
index 705a073..008a259 100644
--- a/y2015/actors/held_to_lift_actor_main.cc
+++ b/y2015/actors/held_to_lift_actor_main.cc
@@ -7,8 +7,7 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- ::frc971::actors::HeldToLiftActor lift(
- &::frc971::actors::held_to_lift_action);
+ ::y2015::actors::HeldToLiftActor lift(&::y2015::actors::held_to_lift_action);
lift.Run();
::aos::Cleanup();
diff --git a/y2015/actors/horizontal_can_pickup_action.q b/y2015/actors/horizontal_can_pickup_action.q
index c1a1c55..51238d8 100644
--- a/y2015/actors/horizontal_can_pickup_action.q
+++ b/y2015/actors/horizontal_can_pickup_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
diff --git a/y2015/actors/horizontal_can_pickup_actor.cc b/y2015/actors/horizontal_can_pickup_actor.cc
index 82d01a7..25a45e1 100644
--- a/y2015/actors/horizontal_can_pickup_actor.cc
+++ b/y2015/actors/horizontal_can_pickup_actor.cc
@@ -9,7 +9,7 @@
#include "y2015/constants.h"
#include "y2015/control_loops/claw/claw.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
constexpr ProfileParams kClawPickup{3.0, 2.0};
@@ -28,6 +28,7 @@
} // namespace
namespace chrono = ::std::chrono;
+using ::y2015::control_loops::claw_queue;
HorizontalCanPickupActor::HorizontalCanPickupActor(
HorizontalCanPickupActionQueueGroup *queues)
@@ -35,10 +36,10 @@
bool HorizontalCanPickupActor::WaitUntilGoalNear(double angle) {
while (true) {
- control_loops::claw_queue.status.FetchAnother();
+ claw_queue.status.FetchAnother();
if (ShouldCancel()) return false;
- const double goal_angle = control_loops::claw_queue.status->goal_angle;
- LOG_STRUCT(DEBUG, "Got claw status", *control_loops::claw_queue.status);
+ const double goal_angle = claw_queue.status->goal_angle;
+ LOG_STRUCT(DEBUG, "Got claw status", *claw_queue.status);
if (::std::abs(goal_angle - angle) < kGoalAngleEpsilon) {
return true;
@@ -48,10 +49,10 @@
bool HorizontalCanPickupActor::WaitUntilNear(double angle) {
while (true) {
- control_loops::claw_queue.status.FetchAnother();
+ claw_queue.status.FetchAnother();
if (ShouldCancel()) return false;
- const double current_angle = control_loops::claw_queue.status->angle;
- LOG_STRUCT(DEBUG, "Got claw status", *control_loops::claw_queue.status);
+ const double current_angle = claw_queue.status->angle;
+ LOG_STRUCT(DEBUG, "Got claw status", *claw_queue.status);
if (::std::abs(current_angle - angle) < kAngleEpsilon) {
return true;
@@ -64,7 +65,7 @@
void HorizontalCanPickupActor::MoveArm(double angle, double intake_power,
const ProfileParams profile_params) {
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = angle;
message->max_velocity = profile_params.velocity;
message->max_acceleration = profile_params.acceleration;
@@ -84,9 +85,9 @@
return true;
}
- control_loops::claw_queue.status.FetchAnother();
+ claw_queue.status.FetchAnother();
- MoveArm(control_loops::claw_queue.status->angle, params.spit_power);
+ MoveArm(claw_queue.status->angle, params.spit_power);
if (!WaitOrCancel(chrono::duration_cast<::aos::monotonic_clock::duration>(
chrono::duration<double>(params.spit_time)))) {
@@ -159,8 +160,8 @@
const HorizontalCanPickupParams ¶ms) {
return ::std::unique_ptr<HorizontalCanPickupAction>(
new HorizontalCanPickupAction(
- &::frc971::actors::horizontal_can_pickup_action, params));
+ &::y2015::actors::horizontal_can_pickup_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/horizontal_can_pickup_actor.h b/y2015/actors/horizontal_can_pickup_actor.h
index 5510178..486e8f8 100644
--- a/y2015/actors/horizontal_can_pickup_actor.h
+++ b/y2015/actors/horizontal_can_pickup_actor.h
@@ -10,7 +10,7 @@
#include "y2015/actors/horizontal_can_pickup_action.q.h"
#include "y2015/actors/fridge_profile_lib.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class HorizontalCanPickupActor
@@ -40,6 +40,6 @@
const HorizontalCanPickupParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif // Y2015_ACTORS_HORIZONTAL_CAN_PICKUP_ACTOR_H_
diff --git a/y2015/actors/horizontal_can_pickup_actor_main.cc b/y2015/actors/horizontal_can_pickup_actor_main.cc
index fbe8c0d..f88bdc9 100644
--- a/y2015/actors/horizontal_can_pickup_actor_main.cc
+++ b/y2015/actors/horizontal_can_pickup_actor_main.cc
@@ -7,8 +7,8 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- ::frc971::actors::HorizontalCanPickupActor horizontal_can_pickup(
- &::frc971::actors::horizontal_can_pickup_action);
+ ::y2015::actors::HorizontalCanPickupActor horizontal_can_pickup(
+ &::y2015::actors::horizontal_can_pickup_action);
horizontal_can_pickup.Run();
::aos::Cleanup();
diff --git a/y2015/actors/lift_action.q b/y2015/actors/lift_action.q
index 37fba8d..0e7e90e 100644
--- a/y2015/actors/lift_action.q
+++ b/y2015/actors/lift_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
import "y2015/actors/lift_action_params.q";
diff --git a/y2015/actors/lift_action_params.q b/y2015/actors/lift_action_params.q
index b31982b..dd812c3 100644
--- a/y2015/actors/lift_action_params.q
+++ b/y2015/actors/lift_action_params.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
// Parameters to send with start.
struct LiftParams {
diff --git a/y2015/actors/lift_actor.cc b/y2015/actors/lift_actor.cc
index c057eef..96069ab 100644
--- a/y2015/actors/lift_actor.cc
+++ b/y2015/actors/lift_actor.cc
@@ -6,7 +6,7 @@
#include "y2015/actors/fridge_profile_lib.h"
#include "y2015/control_loops/claw/claw.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
constexpr ProfileParams kArmMove{0.6, 1.0};
@@ -14,12 +14,15 @@
constexpr ProfileParams kElevatorFixMove{0.9, 2.0};
} // namespace
+using ::y2015::control_loops::claw_queue;
+using ::y2015::control_loops::fridge::fridge_queue;
+
LiftActor::LiftActor(LiftActionQueueGroup *queues)
: FridgeActorBase<LiftActionQueueGroup>(queues) {}
bool LiftActor::RunAction(const LiftParams ¶ms) {
- control_loops::fridge_queue.status.FetchLatest();
- if (!control_loops::fridge_queue.status.get()) {
+ fridge_queue.status.FetchLatest();
+ if (!fridge_queue.status.get()) {
return false;
}
@@ -28,36 +31,34 @@
if (params.second_lift) {
DoFridgeProfile(params.intermediate_lift_height, 0.0, kElevatorFixMove,
- kArmMove,
- control_loops::fridge_queue.status->grabbers.top_front,
- control_loops::fridge_queue.status->grabbers.bottom_front,
- control_loops::fridge_queue.status->grabbers.bottom_back);
+ kArmMove, fridge_queue.status->grabbers.top_front,
+ fridge_queue.status->grabbers.bottom_front,
+ fridge_queue.status->grabbers.bottom_back);
if (ShouldCancel()) return true;
}
- if (!StartFridgeProfile(
- params.lift_height, 0.0, kElevatorMove, kArmMove,
- control_loops::fridge_queue.status->grabbers.top_front,
- control_loops::fridge_queue.status->grabbers.bottom_front,
- control_loops::fridge_queue.status->grabbers.bottom_back)) {
+ if (!StartFridgeProfile(params.lift_height, 0.0, kElevatorMove, kArmMove,
+ fridge_queue.status->grabbers.top_front,
+ fridge_queue.status->grabbers.bottom_front,
+ fridge_queue.status->grabbers.bottom_back)) {
return true;
}
bool has_started_back = false;
while (true) {
- if (control_loops::fridge_queue.status->goal_height > 0.1) {
+ if (fridge_queue.status->goal_height > 0.1) {
if (!has_started_back) {
- if (!StartFridgeProfile(
- params.lift_height, params.lift_arm, kElevatorMove, kArmMove,
- control_loops::fridge_queue.status->grabbers.top_front,
- control_loops::fridge_queue.status->grabbers.bottom_front,
- control_loops::fridge_queue.status->grabbers.bottom_back)) {
+ if (!StartFridgeProfile(params.lift_height, params.lift_arm,
+ kElevatorMove, kArmMove,
+ fridge_queue.status->grabbers.top_front,
+ fridge_queue.status->grabbers.bottom_front,
+ fridge_queue.status->grabbers.bottom_back)) {
return true;
}
goal_angle = params.lift_arm;
has_started_back = true;
if (params.pack_claw) {
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.pack_claw_angle;
message->angular_velocity = 0.0;
message->intake = 0.0;
@@ -71,11 +72,11 @@
}
}
- ProfileStatus status = IterateProfile(
- goal_height, goal_angle, kElevatorMove, kArmMove,
- control_loops::fridge_queue.status->grabbers.top_front,
- control_loops::fridge_queue.status->grabbers.bottom_front,
- control_loops::fridge_queue.status->grabbers.bottom_back);
+ ProfileStatus status =
+ IterateProfile(goal_height, goal_angle, kElevatorMove, kArmMove,
+ fridge_queue.status->grabbers.top_front,
+ fridge_queue.status->grabbers.bottom_front,
+ fridge_queue.status->grabbers.bottom_back);
if (status == DONE || status == CANCELED) {
return true;
}
@@ -85,8 +86,8 @@
::std::unique_ptr<LiftAction> MakeLiftAction(const LiftParams ¶ms) {
return ::std::unique_ptr<LiftAction>(
- new LiftAction(&::frc971::actors::lift_action, params));
+ new LiftAction(&::y2015::actors::lift_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/lift_actor.h b/y2015/actors/lift_actor.h
index cbd79ec..4a1cd43 100644
--- a/y2015/actors/lift_actor.h
+++ b/y2015/actors/lift_actor.h
@@ -10,7 +10,7 @@
#include "y2015/actors/lift_action.q.h"
#include "y2015/actors/fridge_profile_lib.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class LiftActor : public FridgeActorBase<LiftActionQueueGroup> {
@@ -26,6 +26,6 @@
::std::unique_ptr<LiftAction> MakeLiftAction(const LiftParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif // Y2015_ACTORS_LIFT_ACTOR_H_
diff --git a/y2015/actors/lift_actor_main.cc b/y2015/actors/lift_actor_main.cc
index 68389ca..1a86780 100644
--- a/y2015/actors/lift_actor_main.cc
+++ b/y2015/actors/lift_actor_main.cc
@@ -7,7 +7,7 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- ::frc971::actors::LiftActor lift(&::frc971::actors::lift_action);
+ ::y2015::actors::LiftActor lift(&::y2015::actors::lift_action);
lift.Run();
::aos::Cleanup();
diff --git a/y2015/actors/pickup_action.q b/y2015/actors/pickup_action.q
index 237337a..ca0d6f5 100644
--- a/y2015/actors/pickup_action.q
+++ b/y2015/actors/pickup_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
diff --git a/y2015/actors/pickup_actor.cc b/y2015/actors/pickup_actor.cc
index 4ae988e..3aa0c18 100644
--- a/y2015/actors/pickup_actor.cc
+++ b/y2015/actors/pickup_actor.cc
@@ -8,7 +8,7 @@
#include "aos/common/time.h"
#include "y2015/control_loops/claw/claw.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
constexpr double kClawPickupVelocity = 3.00;
@@ -19,6 +19,8 @@
constexpr double kClawMoveUpAcceleration = 25.0;
} // namespace
+using ::y2015::control_loops::claw_queue;
+
PickupActor::PickupActor(PickupActionQueueGroup* queues)
: aos::common::actions::ActorBase<PickupActionQueueGroup>(queues) {}
@@ -26,7 +28,7 @@
constexpr double kAngleEpsilon = 0.10;
// Start lifting the tote.
{
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.pickup_angle;
message->max_velocity = kClawPickupVelocity;
message->max_acceleration = kClawPickupAcceleration;
@@ -38,10 +40,10 @@
message.Send();
}
while (true) {
- control_loops::claw_queue.status.FetchAnother();
+ claw_queue.status.FetchAnother();
if (ShouldCancel()) return true;
- const double current_angle = control_loops::claw_queue.status->angle;
- LOG_STRUCT(DEBUG, "Got claw status", *control_loops::claw_queue.status);
+ const double current_angle = claw_queue.status->angle;
+ LOG_STRUCT(DEBUG, "Got claw status", *claw_queue.status);
if (current_angle > params.suck_angle ||
::std::abs(current_angle - params.pickup_angle) < kAngleEpsilon) {
@@ -51,7 +53,7 @@
// Once above params.suck_angle, start sucking while lifting.
{
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.pickup_angle;
message->max_velocity = kClawPickupVelocity;
message->max_acceleration = kClawPickupAcceleration;
@@ -64,10 +66,10 @@
}
while (true) {
- control_loops::claw_queue.status.FetchAnother();
+ claw_queue.status.FetchAnother();
if (ShouldCancel()) return true;
- const double current_angle = control_loops::claw_queue.status->angle;
- LOG_STRUCT(DEBUG, "Got claw status", *control_loops::claw_queue.status);
+ const double current_angle = claw_queue.status->angle;
+ LOG_STRUCT(DEBUG, "Got claw status", *claw_queue.status);
if (::std::abs(current_angle - params.pickup_angle) < kAngleEpsilon) {
break;
@@ -76,7 +78,7 @@
// Now that we have reached the upper height, come back down while intaking.
{
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.suck_angle_finish;
message->max_velocity = kClawMoveDownVelocity;
message->max_acceleration = kClawMoveDownAcceleration;
@@ -101,7 +103,7 @@
// Lift the claw back up to pack the box back in.
{
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.pickup_finish_angle;
message->max_velocity = kClawMoveUpVelocity;
message->max_acceleration = kClawMoveUpAcceleration;
@@ -114,10 +116,10 @@
}
while (true) {
- control_loops::claw_queue.status.FetchAnother();
+ claw_queue.status.FetchAnother();
if (ShouldCancel()) return true;
- const double current_angle = control_loops::claw_queue.status->angle;
- LOG_STRUCT(DEBUG, "Got claw status", *control_loops::claw_queue.status);
+ const double current_angle = claw_queue.status->angle;
+ LOG_STRUCT(DEBUG, "Got claw status", *claw_queue.status);
if (::std::abs(current_angle - params.pickup_finish_angle) <
kAngleEpsilon) {
@@ -127,7 +129,7 @@
// Stop the motors...
{
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.pickup_finish_angle;
message->max_velocity = kClawMoveUpVelocity;
message->max_acceleration = kClawMoveUpAcceleration;
@@ -145,8 +147,8 @@
::std::unique_ptr<PickupAction> MakePickupAction(const PickupParams& params) {
return ::std::unique_ptr<PickupAction>(
- new PickupAction(&::frc971::actors::pickup_action, params));
+ new PickupAction(&::y2015::actors::pickup_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/pickup_actor.h b/y2015/actors/pickup_actor.h
index 1f09718..6b2822c 100644
--- a/y2015/actors/pickup_actor.h
+++ b/y2015/actors/pickup_actor.h
@@ -5,7 +5,7 @@
#include "aos/common/actions/actor.h"
#include "y2015/actors/pickup_action.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class PickupActor
@@ -22,6 +22,6 @@
::std::unique_ptr<PickupAction> MakePickupAction(const PickupParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif // Y2015_ACTORS_PICKUP_ACTOR_H_
diff --git a/y2015/actors/pickup_actor_main.cc b/y2015/actors/pickup_actor_main.cc
index 0ddda42..f8b53f1 100644
--- a/y2015/actors/pickup_actor_main.cc
+++ b/y2015/actors/pickup_actor_main.cc
@@ -7,7 +7,7 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- frc971::actors::PickupActor pickup(&::frc971::actors::pickup_action);
+ y2015::actors::PickupActor pickup(&::y2015::actors::pickup_action);
pickup.Run();
::aos::Cleanup();
diff --git a/y2015/actors/score_action.q b/y2015/actors/score_action.q
index 5b14210..1937d5d 100644
--- a/y2015/actors/score_action.q
+++ b/y2015/actors/score_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
diff --git a/y2015/actors/score_actor.cc b/y2015/actors/score_actor.cc
index 45c0bc4..92ddfac 100644
--- a/y2015/actors/score_actor.cc
+++ b/y2015/actors/score_actor.cc
@@ -10,11 +10,11 @@
#include "y2015/constants.h"
#include "y2015/control_loops/fridge/fridge.q.h"
-using ::frc971::control_loops::fridge_queue;
+using ::y2015::control_loops::fridge::fridge_queue;
namespace chrono = ::std::chrono;
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
@@ -245,7 +245,7 @@
double max_x_velocity, double max_y_velocity,
double max_x_acceleration,
double max_y_acceleration) {
- auto new_fridge_goal = control_loops::fridge_queue.goal.MakeMessage();
+ auto new_fridge_goal = fridge_queue.goal.MakeMessage();
new_fridge_goal->x = x;
new_fridge_goal->y = y;
new_fridge_goal->profiling_type = 1;
@@ -299,8 +299,8 @@
::std::unique_ptr<ScoreAction> MakeScoreAction(const ScoreParams& params) {
return ::std::unique_ptr<ScoreAction>(
- new ScoreAction(&::frc971::actors::score_action, params));
+ new ScoreAction(&::y2015::actors::score_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/score_actor.h b/y2015/actors/score_actor.h
index c9ed71f..6202403 100644
--- a/y2015/actors/score_actor.h
+++ b/y2015/actors/score_actor.h
@@ -6,7 +6,7 @@
#include "y2015/util/kinematics.h"
#include "y2015/actors/score_action.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class ScoreActor
@@ -38,6 +38,6 @@
::std::unique_ptr<ScoreAction> MakeScoreAction(const ScoreParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif
diff --git a/y2015/actors/score_actor_main.cc b/y2015/actors/score_actor_main.cc
index 754d3bd..d62589d 100644
--- a/y2015/actors/score_actor_main.cc
+++ b/y2015/actors/score_actor_main.cc
@@ -7,7 +7,7 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- frc971::actors::ScoreActor score(&::frc971::actors::score_action);
+ y2015::actors::ScoreActor score(&::y2015::actors::score_action);
score.Run();
::aos::Cleanup();
diff --git a/y2015/actors/score_actor_test.cc b/y2015/actors/score_actor_test.cc
index f859875..25d1bc2 100644
--- a/y2015/actors/score_actor_test.cc
+++ b/y2015/actors/score_actor_test.cc
@@ -13,24 +13,26 @@
using ::aos::time::Time;
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace testing {
+using ::y2015::control_loops::fridge::fridge_queue;
+
class ScoreActionTest : public ::testing::Test {
protected:
ScoreActionTest() {
- frc971::actors::score_action.goal.Clear();
- frc971::actors::score_action.status.Clear();
- control_loops::fridge_queue.status.Clear();
- control_loops::fridge_queue.goal.Clear();
+ y2015::actors::score_action.goal.Clear();
+ y2015::actors::score_action.status.Clear();
+ fridge_queue.status.Clear();
+ fridge_queue.goal.Clear();
}
virtual ~ScoreActionTest() {
- frc971::actors::score_action.goal.Clear();
- frc971::actors::score_action.status.Clear();
- control_loops::fridge_queue.status.Clear();
- control_loops::fridge_queue.goal.Clear();
+ y2015::actors::score_action.goal.Clear();
+ y2015::actors::score_action.status.Clear();
+ fridge_queue.status.Clear();
+ fridge_queue.goal.Clear();
}
// Bring up and down Core.
@@ -40,12 +42,12 @@
// Tests that cancel stops not only the score action, but also the underlying
// profile action.
TEST_F(ScoreActionTest, PlaceTheStackCancel) {
- ScoreActor score(&frc971::actors::score_action);
+ ScoreActor score(&y2015::actors::score_action);
- frc971::actors::score_action.goal.MakeWithBuilder().run(true).Send();
+ y2015::actors::score_action.goal.MakeWithBuilder().run(true).Send();
// Tell it the fridge is zeroed.
- ASSERT_TRUE(control_loops::fridge_queue.status.MakeWithBuilder()
+ ASSERT_TRUE(fridge_queue.status.MakeWithBuilder()
.zeroed(true)
.angle(0.0)
.height(0.0)
@@ -56,7 +58,7 @@
// the action has started, so now cancel it and it should cancel
// the underlying profile
- frc971::actors::score_action.goal.MakeWithBuilder().run(false).Send();
+ y2015::actors::score_action.goal.MakeWithBuilder().run(false).Send();
// let the action start running, if we return from this call it has worked.
const ScoreParams params = {true, true, 0.14, 0.13, -0.7, -0.7, -0.10, -0.5, 0.1};
@@ -68,12 +70,12 @@
// Tests that cancel stops not only the score action, but also the underlying
// profile action.
TEST_F(ScoreActionTest, MoveStackIntoPositionCancel) {
- ScoreActor score(&frc971::actors::score_action);
+ ScoreActor score(&y2015::actors::score_action);
- frc971::actors::score_action.goal.MakeWithBuilder().run(true).Send();
+ y2015::actors::score_action.goal.MakeWithBuilder().run(true).Send();
// Tell it the fridge is zeroed.
- ASSERT_TRUE(control_loops::fridge_queue.status.MakeWithBuilder()
+ ASSERT_TRUE(fridge_queue.status.MakeWithBuilder()
.zeroed(true)
.angle(0.0)
.height(0.0)
@@ -84,7 +86,7 @@
// the action has started, so now cancel it and it should cancel
// the underlying profile
- frc971::actors::score_action.goal.MakeWithBuilder().run(false).Send();
+ y2015::actors::score_action.goal.MakeWithBuilder().run(false).Send();
// let the action start running, if we return from this call it has worked.
const ScoreParams params = {false, true, 0.14, 0.13, -0.7, -0.7, -0.10, -0.5, 0.1};
@@ -95,4 +97,4 @@
} // namespace testing
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/stack_action.q b/y2015/actors/stack_action.q
index b4389b8..814b6ba 100644
--- a/y2015/actors/stack_action.q
+++ b/y2015/actors/stack_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
import "y2015/actors/stack_action_params.q";
diff --git a/y2015/actors/stack_action_params.q b/y2015/actors/stack_action_params.q
index 3958f7d..a7be764 100644
--- a/y2015/actors/stack_action_params.q
+++ b/y2015/actors/stack_action_params.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
// Parameters to send with start.
struct StackParams {
diff --git a/y2015/actors/stack_actor.cc b/y2015/actors/stack_actor.cc
index 539018f..20dc66a 100644
--- a/y2015/actors/stack_actor.cc
+++ b/y2015/actors/stack_actor.cc
@@ -8,7 +8,7 @@
#include "y2015/constants.h"
#include "y2015/control_loops/claw/claw.q.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
constexpr ProfileParams kArmWithStackMove{1.75, 4.20};
@@ -20,23 +20,26 @@
constexpr ProfileParams kReallyFastElevatorMove{1.2, 6.0};
} // namespace
+using ::y2015::control_loops::claw_queue;
+using ::y2015::control_loops::fridge::fridge_queue;
+
StackActor::StackActor(StackActionQueueGroup *queues)
: FridgeActorBase<StackActionQueueGroup>(queues) {}
bool StackActor::RunAction(const StackParams ¶ms) {
const auto &values = constants::GetValues();
- control_loops::fridge_queue.status.FetchLatest();
- if (!control_loops::fridge_queue.status.get()) {
+ fridge_queue.status.FetchLatest();
+ if (!fridge_queue.status.get()) {
LOG(ERROR, "Got no fridge status packet.\n");
return false;
}
// If we are really high, probably have a can. Move over before down.
- if (control_loops::fridge_queue.status->goal_height >
+ if (fridge_queue.status->goal_height >
params.over_box_before_place_height + 0.1) {
// Set the current stack down on top of the bottom box.
- DoFridgeProfile(control_loops::fridge_queue.status->goal_height, 0.0,
+ DoFridgeProfile(fridge_queue.status->goal_height, 0.0,
kSlowElevatorMove, kArmWithStackMove, true);
if (ShouldCancel()) return true;
}
@@ -50,15 +53,15 @@
if (!params.only_place) {
// Move the claw out of the way only if we are supposed to pick up.
bool send_goal = true;
- control_loops::claw_queue.status.FetchLatest();
- if (control_loops::claw_queue.status.get()) {
- if (control_loops::claw_queue.status->goal_angle <
+ claw_queue.status.FetchLatest();
+ if (claw_queue.status.get()) {
+ if (claw_queue.status->goal_angle <
params.claw_out_angle) {
send_goal = false;
}
}
if (send_goal) {
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.claw_out_angle;
message->angular_velocity = 0.0;
message->intake = 0.0;
@@ -89,8 +92,8 @@
::std::unique_ptr<StackAction> MakeStackAction(const StackParams ¶ms) {
return ::std::unique_ptr<StackAction>(
- new StackAction(&::frc971::actors::stack_action, params));
+ new StackAction(&::y2015::actors::stack_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/stack_actor.h b/y2015/actors/stack_actor.h
index 5f2f7fb..986c35b 100644
--- a/y2015/actors/stack_actor.h
+++ b/y2015/actors/stack_actor.h
@@ -10,7 +10,7 @@
#include "y2015/actors/stack_action.q.h"
#include "y2015/actors/fridge_profile_lib.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class StackActor : public FridgeActorBase<StackActionQueueGroup> {
@@ -26,6 +26,6 @@
::std::unique_ptr<StackAction> MakeStackAction(const StackParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif
diff --git a/y2015/actors/stack_actor_main.cc b/y2015/actors/stack_actor_main.cc
index 03a3055..cac8535 100644
--- a/y2015/actors/stack_actor_main.cc
+++ b/y2015/actors/stack_actor_main.cc
@@ -7,7 +7,7 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- ::frc971::actors::StackActor stack(&::frc971::actors::stack_action);
+ ::y2015::actors::StackActor stack(&::y2015::actors::stack_action);
stack.Run();
::aos::Cleanup();
diff --git a/y2015/actors/stack_actor_test.cc b/y2015/actors/stack_actor_test.cc
index 35b3604..c62b6ce 100644
--- a/y2015/actors/stack_actor_test.cc
+++ b/y2015/actors/stack_actor_test.cc
@@ -15,24 +15,26 @@
using ::aos::time::Time;
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace testing {
+using ::y2015::control_loops::fridge::fridge_queue;
+
class StackActionTest : public ::testing::Test {
protected:
StackActionTest() {
- frc971::actors::stack_action.goal.Clear();
- frc971::actors::stack_action.status.Clear();
- control_loops::fridge_queue.status.Clear();
- control_loops::fridge_queue.goal.Clear();
+ y2015::actors::stack_action.goal.Clear();
+ y2015::actors::stack_action.status.Clear();
+ fridge_queue.status.Clear();
+ fridge_queue.goal.Clear();
}
virtual ~StackActionTest() {
- frc971::actors::stack_action.goal.Clear();
- frc971::actors::stack_action.status.Clear();
- control_loops::fridge_queue.status.Clear();
- control_loops::fridge_queue.goal.Clear();
+ y2015::actors::stack_action.goal.Clear();
+ y2015::actors::stack_action.status.Clear();
+ fridge_queue.status.Clear();
+ fridge_queue.goal.Clear();
}
// Bring up and down Core.
@@ -42,12 +44,12 @@
// Tests that cancel stops not only the stack action, but the underlying profile
// action.
TEST_F(StackActionTest, StackCancel) {
- StackActor stack(&frc971::actors::stack_action);
+ StackActor stack(&y2015::actors::stack_action);
- frc971::actors::stack_action.goal.MakeWithBuilder().run(true).Send();
+ y2015::actors::stack_action.goal.MakeWithBuilder().run(true).Send();
// tell it the fridge is zeroed
- control_loops::fridge_queue.status.MakeWithBuilder()
+ fridge_queue.status.MakeWithBuilder()
.zeroed(true)
.angle(0.0)
.height(0.0)
@@ -58,7 +60,7 @@
// the action has started, so now cancel it and it should cancel
// the underlying profile
- frc971::actors::stack_action.goal.MakeWithBuilder().run(false).Send();
+ y2015::actors::stack_action.goal.MakeWithBuilder().run(false).Send();
// let the action start running, if we return from this call it has worked.
StackParams s;
@@ -69,4 +71,4 @@
} // namespace testing
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/stack_and_hold_action.q b/y2015/actors/stack_and_hold_action.q
index 42e98ed..4dd82fc 100644
--- a/y2015/actors/stack_and_hold_action.q
+++ b/y2015/actors/stack_and_hold_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
import "y2015/actors/stack_action_params.q";
diff --git a/y2015/actors/stack_and_hold_actor.cc b/y2015/actors/stack_and_hold_actor.cc
index 41a650c..e12b54c 100644
--- a/y2015/actors/stack_and_hold_actor.cc
+++ b/y2015/actors/stack_and_hold_actor.cc
@@ -9,7 +9,7 @@
#include "y2015/control_loops/claw/claw.q.h"
#include "y2015/actors/stack_actor.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace {
constexpr ProfileParams kReallySlowArmMove{0.1, 1.0};
@@ -21,6 +21,8 @@
namespace chrono = ::std::chrono;
+using ::y2015::control_loops::claw_queue;
+
StackAndHoldActor::StackAndHoldActor(StackAndHoldActionQueueGroup *queues)
: FridgeActorBase<StackAndHoldActionQueueGroup>(queues) {}
@@ -32,15 +34,15 @@
// Move the arm out of the way.
{
bool send_goal = true;
- control_loops::claw_queue.status.FetchLatest();
- if (control_loops::claw_queue.status.get()) {
- if (control_loops::claw_queue.status->goal_angle <
+ claw_queue.status.FetchLatest();
+ if (claw_queue.status.get()) {
+ if (claw_queue.status->goal_angle <
params.claw_out_angle) {
send_goal = false;
}
}
if (send_goal) {
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.claw_out_angle;
message->angular_velocity = 0.0;
message->intake = 0.0;
@@ -103,7 +105,7 @@
if (params.place_not_stack) {
// Clamp the stack with the claw.
- auto message = control_loops::claw_queue.goal.MakeMessage();
+ auto message = claw_queue.goal.MakeMessage();
message->angle = params.claw_clamp_angle;
message->angular_velocity = 0.0;
message->intake = 0.0;
@@ -129,8 +131,8 @@
::std::unique_ptr<StackAndHoldAction> MakeStackAndHoldAction(
const StackAndHoldParams ¶ms) {
return ::std::unique_ptr<StackAndHoldAction>(
- new StackAndHoldAction(&::frc971::actors::stack_and_hold_action, params));
+ new StackAndHoldAction(&::y2015::actors::stack_and_hold_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/stack_and_hold_actor.h b/y2015/actors/stack_and_hold_actor.h
index b3bf2c5..4b4cf9a 100644
--- a/y2015/actors/stack_and_hold_actor.h
+++ b/y2015/actors/stack_and_hold_actor.h
@@ -10,7 +10,7 @@
#include "y2015/actors/stack_and_hold_action.q.h"
#include "y2015/actors/fridge_profile_lib.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class StackAndHoldActor : public FridgeActorBase<StackAndHoldActionQueueGroup> {
@@ -28,6 +28,6 @@
const StackAndHoldParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif // Y2015_ACTORS_STACK_AND_HOLD_ACTOR_H_
diff --git a/y2015/actors/stack_and_hold_actor_main.cc b/y2015/actors/stack_and_hold_actor_main.cc
index b193dba..925afe9 100644
--- a/y2015/actors/stack_and_hold_actor_main.cc
+++ b/y2015/actors/stack_and_hold_actor_main.cc
@@ -7,8 +7,8 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- ::frc971::actors::StackAndHoldActor stack_and_hold(
- &::frc971::actors::stack_and_hold_action);
+ ::y2015::actors::StackAndHoldActor stack_and_hold(
+ &::y2015::actors::stack_and_hold_action);
stack_and_hold.Run();
::aos::Cleanup();
diff --git a/y2015/actors/stack_and_lift_action.q b/y2015/actors/stack_and_lift_action.q
index 0ec971b..85f2a4f 100644
--- a/y2015/actors/stack_and_lift_action.q
+++ b/y2015/actors/stack_and_lift_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2015.actors;
import "aos/common/actions/actions.q";
diff --git a/y2015/actors/stack_and_lift_actor.cc b/y2015/actors/stack_and_lift_actor.cc
index 84b5c2c..24eb11e 100644
--- a/y2015/actors/stack_and_lift_actor.cc
+++ b/y2015/actors/stack_and_lift_actor.cc
@@ -11,20 +11,22 @@
#include "y2015/actors/stack_actor.h"
#include "y2015/actors/lift_actor.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
namespace chrono = ::std::chrono;
+using ::y2015::control_loops::claw_queue;
+using ::y2015::control_loops::fridge::fridge_queue;
StackAndLiftActor::StackAndLiftActor(StackAndLiftActionQueueGroup *queues)
: FridgeActorBase<StackAndLiftActionQueueGroup>(queues) {}
bool StackAndLiftActor::RunAction(const StackAndLiftParams ¶ms) {
- control_loops::claw_queue.goal.FetchLatest();
+ claw_queue.goal.FetchLatest();
double claw_goal_start;
bool have_claw_goal_start;
- if (control_loops::claw_queue.goal.get()) {
- claw_goal_start = control_loops::claw_queue.goal->angle;
+ if (claw_queue.goal.get()) {
+ claw_goal_start = claw_queue.goal->angle;
have_claw_goal_start = true;
} else {
claw_goal_start = 0;
@@ -51,12 +53,12 @@
}
{
- control_loops::fridge_queue.goal.FetchLatest();
- if (!control_loops::fridge_queue.goal.get()) {
+ fridge_queue.goal.FetchLatest();
+ if (!fridge_queue.goal.get()) {
return false;
}
- auto new_fridge_goal = control_loops::fridge_queue.goal.MakeMessage();
- *new_fridge_goal = *control_loops::fridge_queue.goal;
+ auto new_fridge_goal = fridge_queue.goal.MakeMessage();
+ *new_fridge_goal = *fridge_queue.goal;
new_fridge_goal->grabbers.top_front = params.grab_after_stack;
new_fridge_goal->grabbers.top_back = params.grab_after_stack;
new_fridge_goal->grabbers.bottom_front = params.grab_after_stack;
@@ -92,12 +94,12 @@
}
{
- control_loops::fridge_queue.goal.FetchLatest();
- if (!control_loops::fridge_queue.goal.get()) {
+ fridge_queue.goal.FetchLatest();
+ if (!fridge_queue.goal.get()) {
return false;
}
- auto new_fridge_goal = control_loops::fridge_queue.goal.MakeMessage();
- *new_fridge_goal = *control_loops::fridge_queue.goal;
+ auto new_fridge_goal = fridge_queue.goal.MakeMessage();
+ *new_fridge_goal = *fridge_queue.goal;
new_fridge_goal->grabbers.top_front = params.grab_after_lift;
new_fridge_goal->grabbers.top_back = params.grab_after_lift;
new_fridge_goal->grabbers.bottom_front = params.grab_after_lift;
@@ -113,8 +115,8 @@
::std::unique_ptr<StackAndLiftAction> MakeStackAndLiftAction(
const StackAndLiftParams ¶ms) {
return ::std::unique_ptr<StackAndLiftAction>(
- new StackAndLiftAction(&::frc971::actors::stack_and_lift_action, params));
+ new StackAndLiftAction(&::y2015::actors::stack_and_lift_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2015
diff --git a/y2015/actors/stack_and_lift_actor.h b/y2015/actors/stack_and_lift_actor.h
index 1d5fe29..f93cc39 100644
--- a/y2015/actors/stack_and_lift_actor.h
+++ b/y2015/actors/stack_and_lift_actor.h
@@ -10,7 +10,7 @@
#include "y2015/actors/stack_and_lift_action.q.h"
#include "y2015/actors/fridge_profile_lib.h"
-namespace frc971 {
+namespace y2015 {
namespace actors {
class StackAndLiftActor : public FridgeActorBase<StackAndLiftActionQueueGroup> {
@@ -28,6 +28,6 @@
const StackAndLiftParams ¶ms);
} // namespace actors
-} // namespace frc971
+} // namespace y2015
#endif // Y2015_ACTORS_STACK_AND_LIFT_ACTOR_H_
diff --git a/y2015/actors/stack_and_lift_actor_main.cc b/y2015/actors/stack_and_lift_actor_main.cc
index 2118a32..b2f941d 100644
--- a/y2015/actors/stack_and_lift_actor_main.cc
+++ b/y2015/actors/stack_and_lift_actor_main.cc
@@ -7,8 +7,8 @@
int main(int /*argc*/, char* /*argv*/ []) {
::aos::Init(-1);
- ::frc971::actors::StackAndLiftActor stack_and_lift(
- &::frc971::actors::stack_and_lift_action);
+ ::y2015::actors::StackAndLiftActor stack_and_lift(
+ &::y2015::actors::stack_and_lift_action);
stack_and_lift.Run();
::aos::Cleanup();