Skip to content

Commit

Permalink
fix toString being redefined so that we can actually build the C++ code
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbrownmsm committed Mar 3, 2024
1 parent 3b291c8 commit 6c5125e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions autonav_ws/src/scr/include/scr/states.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace SCR
ERRORED = 5
};

std::string toString(DeviceState state)
std::string getAsString(DeviceState state)
{
switch (state)
{
Expand Down Expand Up @@ -42,7 +42,7 @@ namespace SCR
SHUTDOWN = 3
};

std::string toString(SystemState state)
std::string getAsString(SystemState state)
{
switch (state)
{
Expand All @@ -65,7 +65,7 @@ namespace SCR
PRACTICE = 2,
};

std::string toString(SystemMode state)
std::string getAsString(SystemMode state)
{
switch (state)
{
Expand Down
8 changes: 4 additions & 4 deletions autonav_ws/src/scr/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ namespace SCR
SCR::SystemMode newMode = static_cast<SCR::SystemMode>(msg.mode);
SCR::SystemMode oldMode = static_cast<SCR::SystemMode>(oldState.mode);

RCLCPP_WARN(this->get_logger(), "SYSTEM STATE CHANGE: %s -> %s", SCR::toString(oldStateEnum).c_str(), SCR::toString(newStateEnum).c_str());
RCLCPP_WARN(this->get_logger(), "SYSTEM MODE CHANGE: %s -> %s", SCR::toString(oldMode).c_str(), SCR::toString(newMode).c_str());
RCLCPP_WARN(this->get_logger(), "SYSTEM STATE CHANGE: %s -> %s", SCR::getAsString(oldStateEnum).c_str(), SCR::getAsString(newStateEnum).c_str());
RCLCPP_WARN(this->get_logger(), "SYSTEM MODE CHANGE: %s -> %s", SCR::getAsString(oldMode).c_str(), SCR::getAsString(newMode).c_str());
RCLCPP_WARN(this->get_logger(), "MOBILITY CHANGE: %d -> %d", oldState.mobility, msg.mobility);

system_state_transition(oldState, msg);
Expand All @@ -76,7 +76,7 @@ namespace SCR
}

device_state = static_cast<SCR::DeviceState>(msg.state);
RCLCPP_INFO(this->get_logger(), "Received Topic: Device state changed to %s", SCR::toString(device_state).c_str());
RCLCPP_INFO(this->get_logger(), "Received Topic: Device state changed to %s", SCR::getAsString(device_state).c_str());

if (device_state == SCR::DeviceState::BOOTING)
{
Expand Down Expand Up @@ -166,7 +166,7 @@ namespace SCR
auto result = result_future.get();
if (!result)
{
RCLCPP_ERROR(this->get_logger(), "Failed to set device state to: %s", SCR::toString(state).c_str());
RCLCPP_ERROR(this->get_logger(), "Failed to set device state to: %s", SCR::getAsString(state).c_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion autonav_ws/src/scr_controller/src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class CoreNode : public rclcpp::Node
}

// Update the device state
RCLCPP_INFO(this->get_logger(), "Device %s state changed to %s", request->device.c_str(), SCR::toString((SCR::DeviceState)request->state).c_str());
RCLCPP_INFO(this->get_logger(), "Device %s state changed to %s", request->device.c_str(), SCR::getAsString((SCR::DeviceState)request->state).c_str());
if (device_states.find(request->device) == device_states.end())
{
// This is the first time we've seen this device, so we need to publish the system state, device state, and all known configs
Expand Down

0 comments on commit 6c5125e

Please sign in to comment.