Skip to content

Class nebula::agnocast_wrapper::diagnostic_updater::Updater

ClassList > nebula > agnocast_wrapper > diagnostic_updater > Updater

Curated Updater for the non-Agnocast build.More...

  • #include <diagnostic_updater.hpp>

Public Attributes

Type Name
bool & verbose_

Public Functions

Type Name
Updater (nebula::agnocast_wrapper::Node * node, double period=1.0)
Construct from a wrapper Node and update period.
Updater (const Updater &) = delete
Updater (Updater &&) = delete
void add (const std::string & name, ::diagnostic_updater::TaskFunction f)
Register a diagnostic task by name and callable.
void add (::diagnostic_updater::DiagnosticTask & task)
Register a diagnostic task object by reference.
void add (const std::string name, T * c, void(T::*)(::diagnostic_updater::DiagnosticStatusWrapper &) f)
Register a diagnostic task by name and member function pointer.
void broadcast (unsigned char lvl, const std::string msg)
Publish a single status with the given level and message across all known DiagnosticStatus tasks.
void force_update ()
Force an immediate update of all known DiagnosticStatus tasks, bypassing the period interval.
auto getPeriod () const
Get the current update period as rclcpp::Duration.
Updater & operator= (const Updater &) = delete
Updater & operator= (Updater &&) = delete
bool removeByName (const std::string name)
Remove a previously added task by name.
void setHardwareID (const std::string & hwid)
Set the hardware ID embedded in every published DiagnosticStatus.
void setHardwareIDf (const char * format, ...)
printf-style variant of setHardwareID. See the Agnocast-build overload above for why this pre-formats instead of forwarding varargs.
void setPeriod (rclcpp::Duration period)
Set the update period from rclcpp::Duration.
void setPeriod (double period)
Set the update period in seconds.

Detailed Description

Holds a ::diagnostic_updater::Updater by value and forwards only the curated member set shared with the Agnocast build, instead of deriving from it. This keeps the public surface identical to the Agnocast-build Updater, so code that compiles under ENABLE_AGNOCAST=0 also compiles under =1. Deriving from ::diagnostic_updater::Updater would instead leak its full API (e.g. the upstream template / interface-pointer constructors, setVerbose, etc.) into the =0 build, allowing =0-only code that breaks under =1.

Public Attributes Documentation

variable verbose_

bool& nebula::agnocast_wrapper::diagnostic_updater::Updater::verbose_;

Mirrors diagnostic_updater::Updater::verbose_. Bound by reference so updater.verbose_ = true; writes through to the underlying impl, matching the field-access idiom of the Agnocast-build Updater.


Public Functions Documentation

function Updater [1/3]

Construct from a wrapper Node and update period.

inline explicit nebula::agnocast_wrapper::diagnostic_updater::Updater::Updater (
    nebula::agnocast_wrapper::Node * node,
    double period=1.0
) 

In this build, nebula::agnocast_wrapper::Node owns an internal rclcpp::Node, so the call forwards to ::diagnostic_updater::Updater built on node->get_rclcpp_node().

Parameters:

  • node Wrapper node providing the underlying rclcpp::Node via get_rclcpp_node().
  • period Default update period in seconds; overridden by the diagnostic_updater.period ros2 parameter if set.

Note:

The upstream ::diagnostic_updater::Updater exposes a third starting_up_status parameter (the DiagnosticStatus level sent as the first message). It is intentionally not surfaced here because ::agnocast::Updater does not support it, and the wrapper keeps a single signature shared by both backends.


function Updater [2/3]

nebula::agnocast_wrapper::diagnostic_updater::Updater::Updater (
    const Updater &
) = delete

function Updater [3/3]

nebula::agnocast_wrapper::diagnostic_updater::Updater::Updater (
    Updater &&
) = delete

function add [1/3]

Register a diagnostic task by name and callable.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::add (
    const std::string & name,
    ::diagnostic_updater::TaskFunction f
) 

Dispatches to diagnostic_updater::Updater::add().

Parameters:

  • name Diagnostic task name surfaced in the published DiagnosticStatus.
  • f Callable invoked each update cycle to fill in a DiagnosticStatusWrapper.

function add [2/3]

Register a diagnostic task object by reference.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::add (
    ::diagnostic_updater::DiagnosticTask & task
) 

The task is stored by reference inside the underlying Updater; the caller must ensure the task outlives this Updater. Useful for adding pre-built task types such as FrequencyStatus, TimeStampStatus, or Heartbeat.


function add [3/3]

Register a diagnostic task by name and member function pointer.

template<class T>
inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::add (
    const std::string name,
    T * c,
    void(T::*)(::diagnostic_updater::DiagnosticStatusWrapper &) f
) 

Template parameters:

  • T Class type owning the diagnostic method.

Parameters:

  • name Diagnostic task name.
  • c Pointer to the owning instance; must outlive this Updater.
  • f Member function called each update cycle.

function broadcast

Publish a single status with the given level and message across all known DiagnosticStatus tasks.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::broadcast (
    unsigned char lvl,
    const std::string msg
) 

Parameters:

  • lvl Diagnostic level (diagnostic_msgs::msg::DiagnosticStatus::OK / WARN / ERROR / STALE).
  • msg Status message attached to every task in the broadcast.

function force_update

Force an immediate update of all known DiagnosticStatus tasks, bypassing the period interval.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::force_update () 

Useful when something drastic happens (shutdown, self-test) and the latest status must be published immediately rather than waiting for the next tick.


function getPeriod

Get the current update period as rclcpp::Duration.

inline auto nebula::agnocast_wrapper::diagnostic_updater::Updater::getPeriod () const


function operator=

Updater & nebula::agnocast_wrapper::diagnostic_updater::Updater::operator= (
    const Updater &
) = delete

function operator=

Updater & nebula::agnocast_wrapper::diagnostic_updater::Updater::operator= (
    Updater &&
) = delete

function removeByName

Remove a previously added task by name.

inline bool nebula::agnocast_wrapper::diagnostic_updater::Updater::removeByName (
    const std::string name
) 

Parameters:

  • name Task name passed to a prior add() call.

Returns:

true if a task with that name was found and removed; false otherwise.


function setHardwareID

Set the hardware ID embedded in every published DiagnosticStatus.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::setHardwareID (
    const std::string & hwid
) 

Parameters:

  • hwid Hardware identifier string (free-form).

function setHardwareIDf

printf-style variant of setHardwareID. See the Agnocast-build overload above for why this pre-formats instead of forwarding varargs.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::setHardwareIDf (
    const char * format,
    ...
) 


function setPeriod [1/2]

Set the update period from rclcpp::Duration.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::setPeriod (
    rclcpp::Duration period
) 

Resets the internal timer to the new period.


function setPeriod [2/2]

Set the update period in seconds.

inline void nebula::agnocast_wrapper::diagnostic_updater::Updater::setPeriod (
    double period
) 

Convenience overload that converts to rclcpp::Duration internally.



The documentation for this class was generated from the following file src/nebula_core/nebula_core_ros/include/nebula_core_ros/agnocast_wrapper/diagnostic_updater.hpp