Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrhm committed Dec 6, 2024
1 parent afcc159 commit 092251e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion state_machine/state_machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class StateMachine{
* \brief Returns the demangled name of the current state in the state machine
* \return A constant reference to the current state's demangled state name
*/
auto getCurrentState() const -> std::string const& {
auto getCurrentStateName() const -> std::string const& {
return getStateName(currState);
}

Expand Down Expand Up @@ -142,6 +142,9 @@ class StateMachine{
std::vector<std::reference_wrapper<std::type_info const>> types{std::ref(typeid(To))...};
for(auto const& type : types){
demangledName = abi::__cxa_demangle(type.get().name(), nullptr, nullptr, &status);
if(status){
throw std::runtime_error("C++ demangle failed!");
}
addNameToDecoder(type.get().hash_code(), demangledName);
free(demangledName);
}
Expand Down
6 changes: 3 additions & 3 deletions state_machine/state_publisher_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace mrover{
void publishState(){
auto stateMachineUpdate = mrover::msg::StateMachineStateUpdate();
stateMachineUpdate.state_machine_name = mStateMachine.getName();
stateMachineUpdate.state = mStateMachine.getCurrentState();
stateMachineUpdate.state = mStateMachine.getCurrentStateName();
mStatePub->publish(stateMachineUpdate);
}

Expand All @@ -74,8 +74,8 @@ namespace mrover{
mStructurePub = node->create_publisher<mrover::msg::StateMachineStructure>(structureTopicName, 1);
mStatePub = node->create_publisher<mrover::msg::StateMachineStateUpdate>(stateTopicName, 1);

mStructureTimer = node->create_wall_timer(std::chrono::milliseconds(static_cast<std::size_t>(1 / structureTopicHz)), [&](){publishStructure();});
mStateTimer = node->create_wall_timer(std::chrono::milliseconds(static_cast<std::size_t>(1 / stateTopicHz)), [&](){publishState();});
mStructureTimer = node->create_wall_timer(std::chrono::milliseconds(static_cast<std::size_t>(1000 / structureTopicHz)), [&](){publishStructure();});
mStateTimer = node->create_wall_timer(std::chrono::milliseconds(static_cast<std::size_t>(1000 / stateTopicHz)), [&](){publishState();});
}
};
}

0 comments on commit 092251e

Please sign in to comment.