Skip to content

Commit

Permalink
Rename function to continue_position_commands
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-caron committed May 17, 2023
1 parent 3794c44 commit 44a25ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion actuation/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Interface {
*
* \param[out] commands Servo commands.
*/
inline void write_position_continue_commands() noexcept {
inline void continue_position_commands() noexcept {
for (auto& command : commands_) {
if (command.mode == actuation::moteus::Mode::kPosition) {
command.mode = actuation::moteus::Mode::kPositionContinue;
Expand Down
14 changes: 7 additions & 7 deletions actuation/tests/InterfaceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,35 @@ TEST_F(InterfaceTest, ForwardVelocityCommands) {
}
}

TEST_F(InterfaceTest, PositionContinueAfterFault) {
TEST_F(InterfaceTest, ContinuePositionAfterFault) {
for (auto& command : interface_->commands()) {
command.mode = actuation::moteus::Mode::kFault;
}
interface_->write_position_continue_commands();
interface_->continue_position_commands();
for (const auto& command : interface_->commands()) {
ASSERT_EQ(command.mode, actuation::moteus::Mode::kFault);
}
}

TEST_F(InterfaceTest, PositionContinueAfterStop) {
TEST_F(InterfaceTest, ContinuePositionAfterStop) {
interface_->write_stop_commands();
interface_->write_position_continue_commands();
interface_->continue_position_commands();
for (const auto& command : interface_->commands()) {
ASSERT_EQ(command.mode, actuation::moteus::Mode::kStopped);
}
}

TEST_F(InterfaceTest, PositionContinueAfterPosition) {
TEST_F(InterfaceTest, ContinuePositionAfterPosition) {
Dictionary action;
for (auto servo_name :
{"left_pump", "left_grinder", "right_pump", "right_grinder"}) {
action("servo")(servo_name)("position") = 2 * M_PI; // [rad]
action("servo")(servo_name)("velocity") = M_PI; // [rad] / [s]
}
interface_->write_position_commands(action);
interface_->write_position_continue_commands();
interface_->continue_position_commands();
for (const auto& command : interface_->commands()) {
ASSERT_EQ(command.mode, actuation::moteus::Mode::kPositionContinue);
ASSERT_EQ(command.mode, actuation::moteus::Mode::kContinuePosition);
}
}

Expand Down
2 changes: 1 addition & 1 deletion spine/Spine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void Spine::cycle_actuation() {
spdlog::info("[Spine::cycle_actuation] position");
} else {
spdlog::info("[Spine::cycle_actuation] position continue");
actuation_.write_position_continue_commands();
actuation_.continue_position_commands();
}
} catch (const std::exception& e) {
spdlog::error("[Spine::cycle_actuation] Caught an exception: {}", e.what());
Expand Down

0 comments on commit 44a25ea

Please sign in to comment.