Skip to content

Commit

Permalink
More Verbose CpOdomTracker
Browse files Browse the repository at this point in the history
  • Loading branch information
brettpac committed Dec 11, 2024
1 parent 9a4d926 commit 9b2ff16
Show file tree
Hide file tree
Showing 84 changed files with 33 additions and 21,908 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

namespace cl_keyboard
{
//----------------- TIMER sc::event DEFINITION ----------------------------------------------
//----------------- KEYBOARD EVENT DEFINITIONS ----------------------------------------------
template <typename TSource, typename TOrthogonal>
struct EvKeyPressA : sc::event<EvKeyPressA<TSource, TOrthogonal>>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ void CpOdomTracker::onInitialize()
*/
void CpOdomTracker::setWorkingMode(WorkingMode workingMode)
{
// RCLCPP_INFO(getLogger(),"odom_tracker m_mutex acquire");
std::lock_guard<std::mutex> lock(m_mutex_);

switch (workingMode)
Expand All @@ -126,6 +125,14 @@ void CpOdomTracker::setWorkingMode(WorkingMode workingMode)
RCLCPP_INFO_STREAM(getLogger(), "[CpOdomTracker] setting working mode to <UNKNOWN>");
}

if (this->odomSub_->get_publisher_count() == 0)
{
RCLCPP_ERROR_STREAM(
getLogger(),
"[CpOdomTracker] Odom tracker cannot record the path because there is no publisher to the "
"odometry topic");
}

workingMode_ = workingMode;
// RCLCPP_INFO(getLogger(),"odom_tracker m_mutex release");
}
Expand All @@ -150,7 +157,15 @@ void CpOdomTracker::pushPath(std::string pathname)
{
RCLCPP_INFO(getLogger(), "odom_tracker m_mutex acquire");
std::lock_guard<std::mutex> lock(m_mutex_);

this->logStateString(false);
if (this->odomSub_->get_publisher_count() == 0)
{
RCLCPP_ERROR_STREAM(
getLogger(),
"[CpOdomTracker] Odom tracker cannot record the path because there is no publisher to the "
"odometry topic");
}

pathInfos_.push_back({currentPathName_, this->currentMotionGoal_});
pathStack_.push_back(baseTrajectory_);
Expand Down Expand Up @@ -182,6 +197,14 @@ void CpOdomTracker::popPath(int popCount, bool keepPreviousPath)
RCLCPP_INFO(getLogger(), "POP PATH ENTRY");
this->logStateString();

if (this->odomSub_->get_publisher_count() == 0)
{
RCLCPP_ERROR_STREAM(
getLogger(),
"[CpOdomTracker] Odom tracker cannot record the path because there is no publisher to the "
"odometry topic");
}

if (!keepPreviousPath)
{
baseTrajectory_.poses.clear();
Expand Down Expand Up @@ -239,6 +262,14 @@ void CpOdomTracker::logStateString(bool debug)
}
ss << "---";

if (this->odomSub_->get_publisher_count() == 0)
{
ss << std::endl
<< "[CpOdomTracker] Odom tracker cannot record the path because there is no publisher to "
"the odometry topic"
<< std::endl;
}

if (debug)
RCLCPP_DEBUG(getLogger(), ss.str().c_str());
else
Expand Down
Loading

0 comments on commit 9b2ff16

Please sign in to comment.