Skip to content

Additional fixes for documentation in demos. #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions composition/Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# All settings not listed here will use the Doxygen default values.

PROJECT_NAME = "composition"
PROJECT_NUMBER = master
PROJECT_BRIEF = "Examples for composing multiple nodes in a single process."

INPUT = ./include
RECURSIVE = YES
OUTPUT_DIRECTORY = docs_output

EXTRACT_ALL = YES
SORT_MEMBER_DOCS = NO

GENERATE_LATEX = NO
GENERATE_XML = YES
EXCLUDE_SYMBOLS = detail details

ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED += COMPOSITION_PUBLIC
21 changes: 21 additions & 0 deletions image_tools/Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# All settings not listed here will use the Doxygen default values.

PROJECT_NAME = "image_tools"
PROJECT_NUMBER = master
PROJECT_BRIEF = "Tools to capture and play back images to and from DDS subscriptions and publications."

INPUT = ./include
RECURSIVE = YES
OUTPUT_DIRECTORY = docs_output

EXTRACT_ALL = YES
SORT_MEMBER_DOCS = NO

GENERATE_LATEX = NO
GENERATE_XML = YES
EXCLUDE_SYMBOLS = detail details

ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED += IMAGE_TOOLS_PUBLIC
18 changes: 13 additions & 5 deletions intra_process_demo/include/image_pipeline/camera_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,19 @@

#include "common.hpp"

// Node which captures images from a camera using OpenCV and publishes them.
// Images are annotated with this process's id as well as the message's ptr.
class CameraNode : public rclcpp::Node
/// Node which captures images from a camera using OpenCV and publishes them.
/// Images are annotated with this process's id as well as the message's ptr.
class CameraNode final : public rclcpp::Node
{
public:
CameraNode(
/// \brief Construct a new CameraNode object for capturing video
/// \param output The output topic name to use
/// \param node_name The node name to use
/// \param watermark Whether to add a watermark to the image before publishing
/// \param device Which camera device to use
/// \param width What video width to capture at
/// \param height What video height to capture at
explicit CameraNode(
const std::string & output, const std::string & node_name = "camera_node",
bool watermark = true, int device = 0, int width = 320, int height = 240)
: Node(node_name, rclcpp::NodeOptions().use_intra_process_comms(true)),
Expand All @@ -57,7 +64,7 @@ class CameraNode : public rclcpp::Node
thread_ = std::thread(std::bind(&CameraNode::loop, this));
}

virtual ~CameraNode()
~CameraNode()
{
// Make sure to join the thread on shutdown.
canceled_.store(true);
Expand All @@ -66,6 +73,7 @@ class CameraNode : public rclcpp::Node
}
}

/// \brief Capture and publish data until the program is closed
void loop()
{
// While running...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@

#include "common.hpp"

// Node which receives sensor_msgs/Image messages and renders them using OpenCV.
class ImageViewNode : public rclcpp::Node
/// Node which receives sensor_msgs/Image messages and renders them using OpenCV.
class ImageViewNode final : public rclcpp::Node
{
public:
/// \brief Construct a new ImageViewNode for visualizing image data
/// \param input The topic name to subscribe to
/// \param node_name The node name to use
/// \param watermark Whether to add a watermark to the image before displaying
explicit ImageViewNode(
const std::string & input, const std::string & node_name = "image_view_node",
bool watermark = true)
Expand Down
11 changes: 8 additions & 3 deletions intra_process_demo/include/image_pipeline/watermark_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@

#include "common.hpp"

// Node that receives an image, adds some text as a watermark, and publishes it again.
class WatermarkNode : public rclcpp::Node
/// Node that receives an image, adds some text as a watermark, and publishes it again.
class WatermarkNode final : public rclcpp::Node
{
public:
WatermarkNode(
/// \brief Construct a WatermarkNode that accepts an image, adds a watermark, and republishes it
/// \param input The name of the topic to subscribe to
/// \param output The topic to publish watermarked images to
/// \param text The text to add to the image
/// \param node_name The node name to use
explicit WatermarkNode(
const std::string & input, const std::string & output, const std::string & text,
const std::string & node_name = "watermark_node")
: Node(node_name, rclcpp::NodeOptions().use_intra_process_comms(true))
Expand Down
21 changes: 21 additions & 0 deletions logging_demo/Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# All settings not listed here will use the Doxygen default values.

PROJECT_NAME = "logging_demo"
PROJECT_NUMBER = master
PROJECT_BRIEF = "Examples for using and configuring loggers."

INPUT = ./include
RECURSIVE = YES
OUTPUT_DIRECTORY = docs_output

EXTRACT_ALL = YES
SORT_MEMBER_DOCS = NO

GENERATE_LATEX = NO
GENERATE_XML = YES
EXCLUDE_SYMBOLS = detail details

ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED += LOGGING_DEMO_PUBLIC
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@
#ifndef PENDULUM_CONTROL__PENDULUM_CONTROLLER_HPP_
#define PENDULUM_CONTROL__PENDULUM_CONTROLLER_HPP_

// Needed for M_PI on Windows
#ifdef _MSC_VER
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#endif

#include <chrono>
#include <cmath>
#include <memory>

#include "pendulum_msgs/msg/joint_command.hpp"
#include "pendulum_msgs/msg/joint_state.hpp"

#ifndef PI
#define PI 3.14159265359
#endif

namespace pendulum_control
{

Expand All @@ -39,7 +42,7 @@ struct PIDProperties
/// Derivative constant.
double d = 0;
/// Desired state of the plant.
double command = PI / 2;
double command = M_PI / 2;
};

/// Provides a simple PID controller for the inverted pendulum.
Expand Down Expand Up @@ -85,8 +88,8 @@ class PendulumController
// Calculate the message based on PID gains
command_message_.position = msg->position + p_gain + i_gain_ + d_gain;
// Enforce positional limits
if (command_message_.position > PI) {
command_message_.position = PI;
if (command_message_.position > M_PI) {
command_message_.position = M_PI;
} else if (command_message_.position < 0) {
command_message_.position = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@

constexpr char DEFAULT_TOPIC_NAME[] = "qos_chatter";

class Talker : public rclcpp::Node
/// Node class to publish data at a specified rate, optionally pausing to test liveliness
class Talker final : public rclcpp::Node
{
public:
/// Standard Constructor
/**
* \param[in] topic_name Topic to publish to.
* \param[in] qos_profile QoS profile for Publisher.
* \param[in] publisher_options Additional options for Publisher.
* \param[in] topic_name Topic to publish to.
* \param[in] publish_count (Optional) Number of messages to publish before stopping.
* 0 (default) means publish forever.
* \param[in] publish_period (Optional) How often to publish
* \param[in] assert_topic_period (Optional) How often to manually assert Publisher liveliness.
* 0 (default) means never.
**/
Talker(
explicit Talker(
const rclcpp::QoS & qos_profile,
const std::string & topic_name = DEFAULT_TOPIC_NAME,
size_t publish_count = 0,
Expand Down Expand Up @@ -97,18 +99,18 @@ class Talker : public rclcpp::Node
rclcpp::TimerBase::SharedPtr assert_topic_timer_ = nullptr;
};

class Listener : public rclcpp::Node
/// Node class to listen to listen to incoming data from the Talker
class Listener final : public rclcpp::Node
{
public:
/// Standard Constructor.
/**
* \param[in] topic_name Topic to subscribe to.
* \param[in] qos_profile QoS profile for Subscription.
* \param[in] sub_options Additional options for Subscription.
* \param[in] topic_name Topic to subscribe to.
* \param[in] defer_subscribe (Optional) don't create Subscription until user calls
* start_listening().
*/
Listener(
explicit Listener(
const rclcpp::QoS & qos_profile,
const std::string & topic_name = DEFAULT_TOPIC_NAME,
bool defer_subscribe = false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TopicStatisticsListener : public rclcpp::Node
/// Return string representation of a MetricsMessage.
/**
* \param[in] results Statistics heard form the subscribed topic.
* \param[out] String representation of the input statistics.
* \return String representation of the input statistics.
*/
std::string MetricsMessageToString(const statistics_msgs::msg::MetricsMessage & results);

Expand Down