diff --git a/README.md b/README.md
index cd05416e..1cc0e6ae 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Ariles
pkg_catkin_2
- (ROS/catkin package)
+ (ROS/ROS2 packages)
|
pkg_freebsd_2
@@ -66,10 +66,10 @@ Contents
Links
=====
-* Documentation (Doxygen): https://asherikov.github.io/ariles/2/
-* GitHub: https://github.com/asherikov/ariles
-* Legacy 1.x.x version: https://github.com/asherikov/ariles/tree/head_1
- (migration guide https://asherikov.github.io/ariles/2/md_doc_migration_1to2.html)
+* Documentation (Doxygen):
+* GitHub:
+* Legacy 1.x.x version:
+ (migration guide )
@@ -79,8 +79,9 @@ Introduction
Loosely speaking, `ariles` is a C++ reflection library, i.e., it provides
meta-programming APIs for implementation of class visitors (processors). It
also provides a number of (de)serializers based on these APIs, e.g., `YAML`,
-`JSON`, `XML`, `ROS` parameter server; and serialization wrappers for some
-types, e.g., `STL` containers, smart pointers, `Eigen` matrices, etc.
+`JSON`, `XML`, `ROS` parameter server, `ROS2` parameters; and serialization
+wrappers for some types, e.g., `STL` containers, smart pointers, `Eigen`
+matrices, etc.
@@ -151,7 +152,10 @@ ariles2::apply("config.yaml", configurable);
ariles2::apply(nh, configurable, "/some_namespace/");
```
-See demo for more exaples: https://asherikov.github.io/ariles/2/DEMO.html
+Note that ROS/ROS2 packages are available in a separate branch
+.
+
+See demo for more exaples:
[`./tests/api_v2/demo_api_v2.cpp`]
@@ -164,30 +168,37 @@ Visitors
representation formats, in particular:
* `YAML` via `yaml-cpp`:
- https://asherikov.github.io/ariles/2/group__yaml__cpp.html.
+ .
* `msgpack` via `msgpack-c`:
- https://asherikov.github.io/ariles/2/group__msgpack.html.
+ .
* `JSON` via `RapidJSON`, with optional Jsonnet preprocessing:
- https://asherikov.github.io/ariles/2/group__rapidjson.html and
- https://asherikov.github.io/ariles/2/group__jsonnet.html.
+ and
+ .
* `XML` via `PugiXML`:
- https://asherikov.github.io/ariles/2/group__pugixml.html
+
* `Octave` script, output only, no dependencies:
- https://asherikov.github.io/ariles/2/group__octave.html
+
* `ROS` parameter server, via standard `ROS` libs:
- https://asherikov.github.io/ariles/2/group__ros.html
+
* A set of flattened key-value pairs, output only, no dependencies:
- https://asherikov.github.io/ariles/2/group__namevalue.html
+
* `graphviz` dot files for diagram generation:
- https://asherikov.github.io/ariles/2/group__graphviz.html
+
+* `ROS2` parameters, via standard `rclcpp` lib:
+ `ROS2`
+ parameters is not designed to fully reflect yaml structure as explained here
+ , so while `ariles` can dump and read
+ anything, there are certain workarounds in place that are described in more
+ details in the `ROS2` demo [`./tests/api_v2/demo_api_v2_ros2.cpp`]
+ .
There are also a few utility visitors, e.g.,
@@ -197,7 +208,7 @@ There are also a few utility visitors, e.g.,
The complete list of modules is available at
-https://asherikov.github.io/ariles/2/modules.html
+
@@ -211,7 +222,7 @@ Supported data types
* Some STL classes (WIP): `std::string`, `std::vector`, `std::map`, `std::pair`, `std::shared_ptr`, `std::unique_ptr`.
* `Eigen` types: matrices, transforms, quaternions.
* `Boost` classes: `boost::optional`, `boost::movelib::unique_ptr`. `boost::shared_ptr`.
-* Better enums -> https://github.com/aantron/better-enums.
+* Better enums -> .
@@ -222,8 +233,8 @@ Dependencies and compilation
Dependencies
------------
-- `cmake` >= 3.0
-- `C++11` compatible compiler
+- `cmake` >= 3.1
+- `C++17` compatible compiler
- `boost`
Visitors and corresponding dependencies can be enabled or disabled via cmake
@@ -234,7 +245,7 @@ Compilation with catkin
-----------------------
An example catkin package is provided in `pkg_catkin_2` branch of the main
-repository -> https://github.com/asherikov/ariles/tree/pkg_catkin_2.
+repository -> .
@@ -242,26 +253,26 @@ repository -> https://github.com/asherikov/ariles/tree/pkg_catkin_2.
Related software
================
-* https://github.com/PickNikRobotics/rosparam_shortcuts: a set of wrapper
+* : a set of wrapper
functions to read individual parameters from ROS parameter server. This tool
serves pretty much the same purpose as `ariles2::rosparam::Reader`, but its
functionality is more limited.
-* https://billyquith.github.io/ponder/: C++14 reflection library, supports
+* : C++14 reflection library, supports
serialization to XML and JSON. Unlike `ariles` it is more focused on
reflection per se rather than applications, for example, it allows to set
value by string name of a class member, handles class methods, etc. `Ponder`
does not rely as much on preprocessor macro, but is more verbose.
-* https://github.com/bytemaster/boost_reflect: discontinued C++ reflection
+* : discontinued C++ reflection
library, similar to `ponder`. Partially inspired `ariles` 2.x.x API.
-* https://github.com/apolukhin/magic_get (aka `pfr`): C++14 library providing
+* (aka `pfr`): C++14 library providing
tuple like methods for aggregate initializable structures. Addresses a
somewhat different but related problem.
* Serialization libraries, e.g., `boost::serialization`,
- https://github.com/USCiLab/cereal.
+ .
* A library with similar functionality in C++17
- https://github.com/injae/serdepp.
+ .
diff --git a/doc/Doxyfile b/doc/Doxyfile
index f2bb062d..4e515fe7 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -799,6 +799,7 @@ INPUT = ../README.md \
../extra_visitors \
../tests/api_v2/types/ariles_diagram.h \
../tests/api_v2/demo_api_v2.cpp \
+ ../tests/api_v2/demo_api_v2_ros2.cpp \
./doxygen_pages.dox \
./advanced_features.md \
./migration_1to2.md
@@ -920,7 +921,8 @@ EXCLUDE_SYMBOLS =
EXAMPLE_PATH = ../LICENSE \
../CHANGELOG.md \
- ../tests/api_v2/demo_api_v2.cpp
+ ../tests/api_v2/demo_api_v2.cpp \
+ ../tests/api_v2/demo_api_v2_ros2.cpp
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -1174,7 +1176,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET = ./doxygen.css
+#HTML_STYLESHEET = ./doxygen.css
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
diff --git a/doc/doxygen.css b/doc/doxygen.css
deleted file mode 100644
index f3cd582a..00000000
--- a/doc/doxygen.css
+++ /dev/null
@@ -1,1505 +0,0 @@
-/* The standard CSS for doxygen 1.8.12 */
-
-body, table, div, p, dl {
- font: 400 14px/22px Roboto,sans-serif;
-}
-
-/* @group Heading Levels */
-
-h1.groupheader {
- font-size: 150%;
-}
-
-.title {
- font: 400 14px/28px Roboto,sans-serif;
- font-size: 150%;
- font-weight: bold;
- margin: 10px 2px;
-}
-
-h2.groupheader {
- border-bottom: 1px solid #879ECB;
- color: #354C7B;
- font-size: 150%;
- font-weight: normal;
- margin-top: 1.75em;
- padding-top: 8px;
- padding-bottom: 4px;
- width: 100%;
-}
-
-h3.groupheader {
- font-size: 100%;
-}
-
-h1, h2, h3, h4, h5, h6 {
- -webkit-transition: text-shadow 0.5s linear;
- -moz-transition: text-shadow 0.5s linear;
- -ms-transition: text-shadow 0.5s linear;
- -o-transition: text-shadow 0.5s linear;
- transition: text-shadow 0.5s linear;
- margin-right: 15px;
-}
-
-h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow {
- text-shadow: 0 0 15px cyan;
-}
-
-dt {
- font-weight: bold;
-}
-
-div.multicol {
- -moz-column-gap: 1em;
- -webkit-column-gap: 1em;
- -moz-column-count: 3;
- -webkit-column-count: 3;
-}
-
-p.startli, p.startdd {
- margin-top: 2px;
-}
-
-p.starttd {
- margin-top: 0px;
-}
-
-p.endli {
- margin-bottom: 0px;
-}
-
-p.enddd {
- margin-bottom: 4px;
-}
-
-p.endtd {
- margin-bottom: 2px;
-}
-
-/* @end */
-
-caption {
- font-weight: bold;
-}
-
-span.legend {
- font-size: 70%;
- text-align: center;
-}
-
-h3.version {
- font-size: 90%;
- text-align: center;
-}
-
-div.qindex, div.navtab{
- background-color: #EBEFF6;
- border: 1px solid #A3B4D7;
- text-align: center;
-}
-
-div.qindex, div.navpath {
- width: 100%;
- line-height: 140%;
-}
-
-div.navtab {
- margin-right: 15px;
-}
-
-/* @group Link Styling */
-
-a {
- color: #3D578C;
- font-weight: normal;
- text-decoration: none;
-}
-
-.contents a:visited {
- color: #4665A2;
-}
-
-a:hover {
- text-decoration: underline;
-}
-
-a.qindex {
- font-weight: bold;
-}
-
-a.qindexHL {
- font-weight: bold;
- background-color: #9CAFD4;
- color: #ffffff;
- border: 1px double #869DCA;
-}
-
-.contents a.qindexHL:visited {
- color: #ffffff;
-}
-
-a.el {
- font-weight: bold;
-}
-
-a.elRef {
-}
-
-a.code, a.code:visited, a.line, a.line:visited {
- color: #4665A2;
-}
-
-a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
- color: #4665A2;
-}
-
-/* @end */
-
-dl.el {
- margin-left: -1cm;
-}
-
-pre.fragment {
- border: 1px solid #C4CFE5;
- background-color: #FBFCFD;
- padding: 4px 6px;
- margin: 4px 8px 4px 2px;
- overflow: auto;
- word-wrap: break-word;
- font-size: 9pt;
- line-height: 125%;
- font-family: monospace, fixed;
- font-size: 105%;
-}
-
-div.fragment {
- padding: 0px;
- margin: 4px 8px 4px 2px;
- background-color: #EBEFF6;
- border: 1px solid #C4CFE5;
-}
-
-div.line {
- font-family: monospace, fixed;
- font-size: 13px;
- min-height: 13px;
- line-height: 1.0;
- text-wrap: unrestricted;
- white-space: -moz-pre-wrap; /* Moz */
- white-space: -pre-wrap; /* Opera 4-6 */
- white-space: -o-pre-wrap; /* Opera 7 */
- white-space: pre-wrap; /* CSS3 */
- word-wrap: break-word; /* IE 5.5+ */
- text-indent: -53px;
- padding-left: 53px;
- padding-bottom: 0px;
- margin: 0px;
- -webkit-transition-property: background-color, box-shadow;
- -webkit-transition-duration: 0.5s;
- -moz-transition-property: background-color, box-shadow;
- -moz-transition-duration: 0.5s;
- -ms-transition-property: background-color, box-shadow;
- -ms-transition-duration: 0.5s;
- -o-transition-property: background-color, box-shadow;
- -o-transition-duration: 0.5s;
- transition-property: background-color, box-shadow;
- transition-duration: 0.5s;
-}
-
-div.line:after {
- content:"\000A";
- white-space: pre;
-}
-
-div.line.glow {
- background-color: cyan;
- box-shadow: 0 0 10px cyan;
-}
-
-
-span.lineno {
- padding-right: 4px;
- text-align: right;
- border-right: 2px solid #0F0;
- background-color: #E8E8E8;
- white-space: pre;
-}
-span.lineno a {
- background-color: #D8D8D8;
-}
-
-span.lineno a:hover {
- background-color: #C8C8C8;
-}
-
-.lineno {
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-div.ah, span.ah {
- background-color: black;
- font-weight: bold;
- color: #ffffff;
- margin-bottom: 3px;
- margin-top: 3px;
- padding: 0.2em;
- border: solid thin #333;
- border-radius: 0.5em;
- -webkit-border-radius: .5em;
- -moz-border-radius: .5em;
- box-shadow: 2px 2px 3px #999;
- -webkit-box-shadow: 2px 2px 3px #999;
- -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
- background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%);
-}
-
-div.classindex ul {
- list-style: none;
- padding-left: 0;
-}
-
-div.classindex span.ai {
- display: inline-block;
-}
-
-div.groupHeader {
- margin-left: 16px;
- margin-top: 12px;
- font-weight: bold;
-}
-
-div.groupText {
- margin-left: 16px;
- font-style: italic;
-}
-
-body {
- background-color: white;
- color: black;
- margin: 0;
-}
-
-div.contents {
- margin-top: 10px;
- margin-left: 12px;
- margin-right: 8px;
-}
-
-td.indexkey {
- background-color: #EBEFF6;
- font-weight: bold;
- border: 1px solid #C4CFE5;
- margin: 2px 0px 2px 0;
- padding: 2px 10px;
- vertical-align: top;
-}
-
-td.indexvalue {
- background-color: #EBEFF6;
- border: 1px solid #C4CFE5;
- padding: 2px 10px;
- margin: 2px 0px;
-}
-
-tr.memlist {
- background-color: #EEF1F7;
-}
-
-p.formulaDsp {
- text-align: center;
-}
-
-img.formulaDsp {
-
-}
-
-img.formulaInl {
- vertical-align: middle;
-}
-
-div.center {
- text-align: center;
- margin-top: 0px;
- margin-bottom: 0px;
- padding: 0px;
-}
-
-div.center img {
- border: 0px;
-}
-
-address.footer {
- text-align: right;
- padding-right: 12px;
-}
-
-img.footer {
- border: 0px;
- vertical-align: middle;
-}
-
-/* @group Code Colorization */
-
-span.keyword {
- color: #008000
-}
-
-span.keywordtype {
- color: #604020
-}
-
-span.keywordflow {
- color: #e08000
-}
-
-span.comment {
- color: #800000
-}
-
-span.preprocessor {
- color: #806020
-}
-
-span.stringliteral {
- color: #002080
-}
-
-span.charliteral {
- color: #008080
-}
-
-span.vhdldigit {
- color: #ff00ff
-}
-
-span.vhdlchar {
- color: #000000
-}
-
-span.vhdlkeyword {
- color: #700070
-}
-
-span.vhdllogic {
- color: #ff0000
-}
-
-blockquote {
- background-color: #F7F8FB;
- border-left: 2px solid #9CAFD4;
- margin: 0 24px 0 4px;
- padding: 0 12px 0 16px;
-}
-
-/* @end */
-
-/*
-.search {
- color: #003399;
- font-weight: bold;
-}
-
-form.search {
- margin-bottom: 0px;
- margin-top: 0px;
-}
-
-input.search {
- font-size: 75%;
- color: #000080;
- font-weight: normal;
- background-color: #e8eef2;
-}
-*/
-
-td.tiny {
- font-size: 75%;
-}
-
-.dirtab {
- padding: 4px;
- border-collapse: collapse;
- border: 1px solid #A3B4D7;
-}
-
-th.dirtab {
- background: #EBEFF6;
- font-weight: bold;
-}
-
-hr {
- height: 0px;
- border: none;
- border-top: 1px solid #4A6AAA;
-}
-
-hr.footer {
- height: 1px;
-}
-
-/* @group Member Descriptions */
-
-table.memberdecls {
- border-spacing: 0px;
- padding: 0px;
-}
-
-.memberdecls td, .fieldtable tr {
- -webkit-transition-property: background-color, box-shadow;
- -webkit-transition-duration: 0.5s;
- -moz-transition-property: background-color, box-shadow;
- -moz-transition-duration: 0.5s;
- -ms-transition-property: background-color, box-shadow;
- -ms-transition-duration: 0.5s;
- -o-transition-property: background-color, box-shadow;
- -o-transition-duration: 0.5s;
- transition-property: background-color, box-shadow;
- transition-duration: 0.5s;
-}
-
-.memberdecls td.glow, .fieldtable tr.glow {
- background-color: cyan;
- box-shadow: 0 0 15px cyan;
-}
-
-.mdescLeft, .mdescRight,
-.memItemLeft, .memItemRight,
-.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
- background-color: #F9FAFC;
- border: none;
- margin: 4px;
- padding: 1px 0 0 8px;
-}
-
-.mdescLeft, .mdescRight {
- padding: 0px 8px 4px 8px;
- color: #555;
-}
-
-.memSeparator {
- border-bottom: 1px solid #DEE4F0;
- line-height: 1px;
- margin: 0px;
- padding: 0px;
-}
-
-.memItemLeft, .memTemplItemLeft {
-}
-
-.memItemRight {
- width: 60%;
-}
-
-.memTemplParams {
- color: #4665A2;
- font-size: 80%;
-}
-
-/* @end */
-
-/* @group Member Details */
-
-/* Styles for detailed member documentation */
-
-.memtitle {
- padding: 8px;
- border-top: 1px solid #A8B8D9;
- border-left: 1px solid #A8B8D9;
- border-right: 1px solid #A8B8D9;
- border-top-right-radius: 4px;
- border-top-left-radius: 4px;
- margin-bottom: -1px;
- background-image: url('nav_f.png');
- background-repeat: repeat-x;
- background-color: #E2E8F2;
- line-height: 1.25;
- font-weight: 300;
- float:left;
-}
-
-.permalink
-{
- font-size: 65%;
- display: inline-block;
- vertical-align: middle;
-}
-
-.memtemplate {
- font-size: 80%;
- color: #4665A2;
- font-weight: normal;
- margin-left: 9px;
-}
-
-.memnav {
- background-color: #EBEFF6;
- border: 1px solid #A3B4D7;
- text-align: center;
- margin: 2px;
- margin-right: 15px;
- padding: 2px;
-}
-
-.mempage {
- width: 100%;
-}
-
-.memitem {
- padding: 0;
- margin-bottom: 10px;
- margin-right: 5px;
- -webkit-transition: box-shadow 0.5s linear;
- -moz-transition: box-shadow 0.5s linear;
- -ms-transition: box-shadow 0.5s linear;
- -o-transition: box-shadow 0.5s linear;
- transition: box-shadow 0.5s linear;
- display: table !important;
- width: 100%;
-}
-
-.memitem.glow {
- box-shadow: 0 0 15px cyan;
-}
-
-.memname {
- font-weight: 400;
- margin-left: 6px;
-}
-
-.memname td {
- vertical-align: bottom;
-}
-
-.memproto, dl.reflist dt {
- border-top: 1px solid #A8B8D9;
- border-left: 1px solid #A8B8D9;
- border-right: 1px solid #A8B8D9;
- padding: 6px 0px 6px 0px;
- color: #253555;
- font-weight: bold;
- text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
- background-color: #DFE5F1;
- /* opera specific markup */
- box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
- border-top-right-radius: 4px;
- /* firefox specific markup */
- -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
- -moz-border-radius-topright: 4px;
- /* webkit specific markup */
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
- -webkit-border-top-right-radius: 4px;
-
-}
-
-.overload {
- font-family: "courier new",courier,monospace;
- font-size: 65%;
-}
-
-.memdoc, dl.reflist dd {
- border-bottom: 1px solid #A8B8D9;
- border-left: 1px solid #A8B8D9;
- border-right: 1px solid #A8B8D9;
- padding: 6px 10px 2px 10px;
- background-color: #FBFCFD;
- border-top-width: 0;
- background-image:url('nav_g.png');
- background-repeat:repeat-x;
- background-color: #FFFFFF;
- /* opera specific markup */
- border-bottom-left-radius: 4px;
- border-bottom-right-radius: 4px;
- box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
- /* firefox specific markup */
- -moz-border-radius-bottomleft: 4px;
- -moz-border-radius-bottomright: 4px;
- -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
- /* webkit specific markup */
- -webkit-border-bottom-left-radius: 4px;
- -webkit-border-bottom-right-radius: 4px;
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-}
-
-dl.reflist dt {
- padding: 5px;
-}
-
-dl.reflist dd {
- margin: 0px 0px 10px 0px;
- padding: 5px;
-}
-
-.paramkey {
- text-align: right;
-}
-
-.paramtype {
- white-space: nowrap;
-}
-
-.paramname {
- color: #602020;
- white-space: nowrap;
-}
-.paramname em {
- font-style: normal;
-}
-.paramname code {
- line-height: 14px;
-}
-
-.params, .retval, .exception, .tparams {
- margin-left: 0px;
- padding-left: 0px;
-}
-
-.params .paramname, .retval .paramname {
- font-weight: bold;
- vertical-align: top;
-}
-
-.params .paramtype {
- font-style: italic;
- vertical-align: top;
-}
-
-.params .paramdir {
- font-family: "courier new",courier,monospace;
- vertical-align: top;
-}
-
-table.mlabels {
- border-spacing: 0px;
-}
-
-td.mlabels-left {
- width: 100%;
- padding: 0px;
-}
-
-td.mlabels-right {
- vertical-align: bottom;
- padding: 0px;
- white-space: nowrap;
-}
-
-span.mlabels {
- margin-left: 8px;
-}
-
-span.mlabel {
- background-color: #728DC1;
- border-top:1px solid #5373B4;
- border-left:1px solid #5373B4;
- border-right:1px solid #C4CFE5;
- border-bottom:1px solid #C4CFE5;
- text-shadow: none;
- color: white;
- margin-right: 4px;
- padding: 2px 3px;
- border-radius: 3px;
- font-size: 7pt;
- white-space: nowrap;
- vertical-align: middle;
-}
-
-
-
-/* @end */
-
-/* these are for tree view inside a (index) page */
-
-div.directory {
- margin: 10px 0px;
- border-top: 1px solid #9CAFD4;
- border-bottom: 1px solid #9CAFD4;
- width: 100%;
-}
-
-.directory table {
- border-collapse:collapse;
-}
-
-.directory td {
- margin: 0px;
- padding: 0px;
- vertical-align: top;
-}
-
-.directory td.entry {
- white-space: nowrap;
- padding-right: 6px;
- padding-top: 3px;
-}
-
-.directory td.entry a {
- outline:none;
-}
-
-.directory td.entry a img {
- border: none;
-}
-
-.directory td.desc {
- width: 100%;
- padding-left: 6px;
- padding-right: 6px;
- padding-top: 3px;
- border-left: 1px solid rgba(0,0,0,0.05);
-}
-
-.directory tr.even {
- padding-left: 6px;
- background-color: #F7F8FB;
-}
-
-.directory img {
- vertical-align: -30%;
-}
-
-.directory .levels {
- white-space: nowrap;
- width: 100%;
- text-align: right;
- font-size: 9pt;
-}
-
-.directory .levels span {
- cursor: pointer;
- padding-left: 2px;
- padding-right: 2px;
- color: #3D578C;
-}
-
-.arrow {
- color: #9CAFD4;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- cursor: pointer;
- font-size: 80%;
- display: inline-block;
- width: 16px;
- height: 22px;
-}
-
-.icon {
- font-family: Arial, Helvetica;
- font-weight: bold;
- font-size: 12px;
- height: 14px;
- width: 16px;
- display: inline-block;
- background-color: #728DC1;
- color: white;
- text-align: center;
- border-radius: 4px;
- margin-left: 2px;
- margin-right: 2px;
-}
-
-.icona {
- width: 24px;
- height: 22px;
- display: inline-block;
-}
-
-.iconfopen {
- width: 24px;
- height: 18px;
- margin-bottom: 4px;
- background-image:url('folderopen.png');
- background-position: 0px -4px;
- background-repeat: repeat-y;
- vertical-align:top;
- display: inline-block;
-}
-
-.iconfclosed {
- width: 24px;
- height: 18px;
- margin-bottom: 4px;
- background-image:url('folderclosed.png');
- background-position: 0px -4px;
- background-repeat: repeat-y;
- vertical-align:top;
- display: inline-block;
-}
-
-.icondoc {
- width: 24px;
- height: 18px;
- margin-bottom: 4px;
- background-image:url('doc.png');
- background-position: 0px -4px;
- background-repeat: repeat-y;
- vertical-align:top;
- display: inline-block;
-}
-
-table.directory {
- font: 400 14px Roboto,sans-serif;
-}
-
-/* @end */
-
-div.dynheader {
- margin-top: 8px;
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-address {
- font-style: normal;
- color: #2A3D61;
-}
-
-table.doxtable caption {
- caption-side: top;
-}
-
-table.doxtable {
- border-collapse:collapse;
- margin-top: 4px;
- margin-bottom: 4px;
-}
-
-table.doxtable td, table.doxtable th {
- border: 1px solid #2D4068;
- padding: 3px 7px 2px;
-}
-
-table.doxtable th {
- background-color: #374F7F;
- color: #FFFFFF;
- font-size: 110%;
- padding-bottom: 4px;
- padding-top: 5px;
-}
-
-table.fieldtable {
- /*width: 100%;*/
- margin-bottom: 10px;
- border: 1px solid #A8B8D9;
- border-spacing: 0px;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
- -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
- box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
-}
-
-.fieldtable td, .fieldtable th {
- padding: 3px 7px 2px;
-}
-
-.fieldtable td.fieldtype, .fieldtable td.fieldname {
- white-space: nowrap;
- border-right: 1px solid #A8B8D9;
- border-bottom: 1px solid #A8B8D9;
- vertical-align: top;
-}
-
-.fieldtable td.fieldname {
- padding-top: 3px;
-}
-
-.fieldtable td.fielddoc {
- border-bottom: 1px solid #A8B8D9;
- /*width: 100%;*/
-}
-
-.fieldtable td.fielddoc p:first-child {
- margin-top: 0px;
-}
-
-.fieldtable td.fielddoc p:last-child {
- margin-bottom: 2px;
-}
-
-.fieldtable tr:last-child td {
- border-bottom: none;
-}
-
-.fieldtable th {
- background-image:url('nav_f.png');
- background-repeat:repeat-x;
- background-color: #E2E8F2;
- font-size: 90%;
- color: #253555;
- padding-bottom: 4px;
- padding-top: 5px;
- text-align:left;
- font-weight: 400;
- -moz-border-radius-topleft: 4px;
- -moz-border-radius-topright: 4px;
- -webkit-border-top-left-radius: 4px;
- -webkit-border-top-right-radius: 4px;
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
- border-bottom: 1px solid #A8B8D9;
-}
-
-
-.tabsearch {
- top: 0px;
- left: 10px;
- height: 36px;
- background-image: url('tab_b.png');
- z-index: 101;
- overflow: hidden;
- font-size: 13px;
-}
-
-.navpath ul
-{
- font-size: 11px;
- background-image:url('tab_b.png');
- background-repeat:repeat-x;
- background-position: 0 -5px;
- height:30px;
- line-height:30px;
- color:#8AA0CC;
- border:solid 1px #C2CDE4;
- overflow:hidden;
- margin:0px;
- padding:0px;
-}
-
-.navpath li
-{
- list-style-type:none;
- float:left;
- padding-left:10px;
- padding-right:15px;
- background-image:url('bc_s.png');
- background-repeat:no-repeat;
- background-position:right;
- color:#364D7C;
-}
-
-.navpath li.navelem a
-{
- height:32px;
- display:block;
- text-decoration: none;
- outline: none;
- color: #283A5D;
- font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
- text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
- text-decoration: none;
-}
-
-.navpath li.navelem a:hover
-{
- color:#6884BD;
-}
-
-.navpath li.footer
-{
- list-style-type:none;
- float:right;
- padding-left:10px;
- padding-right:15px;
- background-image:none;
- background-repeat:no-repeat;
- background-position:right;
- color:#364D7C;
- font-size: 8pt;
-}
-
-
-div.summary
-{
- float: right;
- font-size: 8pt;
- padding-right: 5px;
- width: 50%;
- text-align: right;
-}
-
-div.summary a
-{
- white-space: nowrap;
-}
-
-table.classindex
-{
- margin: 10px;
- white-space: nowrap;
- margin-left: 3%;
- margin-right: 3%;
- width: 94%;
- border: 0;
- border-spacing: 0;
- padding: 0;
-}
-
-div.ingroups
-{
- font-size: 8pt;
- width: 50%;
- text-align: left;
-}
-
-div.ingroups a
-{
- white-space: nowrap;
-}
-
-div.header
-{
- background-image:url('nav_h.png');
- background-repeat:repeat-x;
- background-color: #F9FAFC;
- margin: 0px;
- border-bottom: 1px solid #C4CFE5;
-}
-
-div.headertitle
-{
- padding: 5px 5px 5px 10px;
-}
-
-dl
-{
- padding: 0 0 0 10px;
-}
-
-/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */
-dl.section
-{
- margin-left: 0px;
- padding-left: 0px;
-}
-
-dl.note
-{
- margin-left:-7px;
- padding-left: 3px;
- border-left:4px solid;
- border-color: #D0C000;
-}
-
-dl.warning, dl.attention
-{
- margin-left:-7px;
- padding-left: 3px;
- border-left:4px solid;
- border-color: #FF0000;
-}
-
-dl.pre, dl.post, dl.invariant
-{
- margin-left:-7px;
- padding-left: 3px;
- border-left:4px solid;
- border-color: #00D000;
-}
-
-dl.deprecated
-{
- margin-left:-7px;
- padding-left: 3px;
- border-left:4px solid;
- border-color: #505050;
-}
-
-dl.todo
-{
- margin-left:-7px;
- padding-left: 3px;
- border-left:4px solid;
- border-color: #00C0E0;
-}
-
-dl.test
-{
- margin-left:-7px;
- padding-left: 3px;
- border-left:4px solid;
- border-color: #3030E0;
-}
-
-dl.bug
-{
- margin-left:-7px;
- padding-left: 3px;
- border-left:4px solid;
- border-color: #C08050;
-}
-
-dl.section dd {
- margin-bottom: 6px;
-}
-
-
-#projectlogo
-{
- text-align: center;
- vertical-align: bottom;
- border-collapse: separate;
-}
-
-#projectlogo img
-{
- border: 0px none;
-}
-
-#projectalign
-{
- vertical-align: middle;
-}
-
-#projectname
-{
- font: 300% Tahoma, Arial,sans-serif;
- margin: 0px;
- padding: 2px 0px;
-}
-
-#projectbrief
-{
- font: 120% Tahoma, Arial,sans-serif;
- margin: 0px;
- padding: 0px;
-}
-
-#projectnumber
-{
- font: 50% Tahoma, Arial,sans-serif;
- margin: 0px;
- padding: 0px;
-}
-
-#titlearea
-{
- padding: 0px;
- margin: 0px;
- width: 100%;
- border-bottom: 1px solid #5373B4;
-}
-
-.image
-{
- text-align: center;
-}
-
-.dotgraph
-{
- text-align: center;
-}
-
-.mscgraph
-{
- text-align: center;
-}
-
-.diagraph
-{
- text-align: center;
-}
-
-.caption
-{
- font-weight: bold;
-}
-
-div.zoom
-{
- border: 1px solid #90A5CE;
-}
-
-dl.citelist {
- margin-bottom:50px;
-}
-
-dl.citelist dt {
- color:#334975;
- float:left;
- font-weight:bold;
- margin-right:10px;
- padding:5px;
-}
-
-dl.citelist dd {
- margin:2px 0;
- padding:5px 0;
-}
-
-div.toc {
- padding: 14px 25px;
- background-color: #F4F6FA;
- border: 1px solid #D8DFEE;
- border-radius: 7px 7px 7px 7px;
- float: right;
- height: auto;
- margin: 0 8px 10px 10px;
- width: 200px;
-}
-
-div.toc li {
- background: url("bdwn.png") no-repeat scroll 0 5px transparent;
- font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif;
- margin-top: 5px;
- padding-left: 10px;
- padding-top: 2px;
-}
-
-div.toc h3 {
- font: bold 12px/1.2 Arial,FreeSans,sans-serif;
- color: #4665A2;
- border-bottom: 0 none;
- margin: 0;
-}
-
-div.toc ul {
- list-style: none outside none;
- border: medium none;
- padding: 0px;
-}
-
-div.toc li.level1 {
- margin-left: 0px;
-}
-
-div.toc li.level2 {
- margin-left: 15px;
-}
-
-div.toc li.level3 {
- margin-left: 30px;
-}
-
-div.toc li.level4 {
- margin-left: 45px;
-}
-
-.inherit_header {
- font-weight: bold;
- color: gray;
- cursor: pointer;
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-.inherit_header td {
- padding: 6px 0px 2px 5px;
-}
-
-.inherit {
- display: none;
-}
-
-tr.heading h2 {
- margin-top: 12px;
- margin-bottom: 4px;
-}
-
-/* tooltip related style info */
-
-.ttc {
- position: absolute;
- display: none;
-}
-
-#powerTip {
- cursor: default;
- white-space: nowrap;
- background-color: white;
- border: 1px solid gray;
- border-radius: 4px 4px 4px 4px;
- box-shadow: 1px 1px 7px gray;
- display: none;
- font-size: smaller;
- max-width: 80%;
- opacity: 0.9;
- padding: 1ex 1em 1em;
- position: absolute;
- z-index: 2147483647;
-}
-
-#powerTip div.ttdoc {
- color: grey;
- font-style: italic;
-}
-
-#powerTip div.ttname a {
- font-weight: bold;
-}
-
-#powerTip div.ttname {
- font-weight: bold;
-}
-
-#powerTip div.ttdeci {
- color: #006318;
-}
-
-#powerTip div {
- margin: 0px;
- padding: 0px;
- font: 12px/16px Roboto,sans-serif;
-}
-
-#powerTip:before, #powerTip:after {
- content: "";
- position: absolute;
- margin: 0px;
-}
-
-#powerTip.n:after, #powerTip.n:before,
-#powerTip.s:after, #powerTip.s:before,
-#powerTip.w:after, #powerTip.w:before,
-#powerTip.e:after, #powerTip.e:before,
-#powerTip.ne:after, #powerTip.ne:before,
-#powerTip.se:after, #powerTip.se:before,
-#powerTip.nw:after, #powerTip.nw:before,
-#powerTip.sw:after, #powerTip.sw:before {
- border: solid transparent;
- content: " ";
- height: 0;
- width: 0;
- position: absolute;
-}
-
-#powerTip.n:after, #powerTip.s:after,
-#powerTip.w:after, #powerTip.e:after,
-#powerTip.nw:after, #powerTip.ne:after,
-#powerTip.sw:after, #powerTip.se:after {
- border-color: rgba(255, 255, 255, 0);
-}
-
-#powerTip.n:before, #powerTip.s:before,
-#powerTip.w:before, #powerTip.e:before,
-#powerTip.nw:before, #powerTip.ne:before,
-#powerTip.sw:before, #powerTip.se:before {
- border-color: rgba(128, 128, 128, 0);
-}
-
-#powerTip.n:after, #powerTip.n:before,
-#powerTip.ne:after, #powerTip.ne:before,
-#powerTip.nw:after, #powerTip.nw:before {
- top: 100%;
-}
-
-#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after {
- border-top-color: #ffffff;
- border-width: 10px;
- margin: 0px -10px;
-}
-#powerTip.n:before {
- border-top-color: #808080;
- border-width: 11px;
- margin: 0px -11px;
-}
-#powerTip.n:after, #powerTip.n:before {
- left: 50%;
-}
-
-#powerTip.nw:after, #powerTip.nw:before {
- right: 14px;
-}
-
-#powerTip.ne:after, #powerTip.ne:before {
- left: 14px;
-}
-
-#powerTip.s:after, #powerTip.s:before,
-#powerTip.se:after, #powerTip.se:before,
-#powerTip.sw:after, #powerTip.sw:before {
- bottom: 100%;
-}
-
-#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after {
- border-bottom-color: #ffffff;
- border-width: 10px;
- margin: 0px -10px;
-}
-
-#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before {
- border-bottom-color: #808080;
- border-width: 11px;
- margin: 0px -11px;
-}
-
-#powerTip.s:after, #powerTip.s:before {
- left: 50%;
-}
-
-#powerTip.sw:after, #powerTip.sw:before {
- right: 14px;
-}
-
-#powerTip.se:after, #powerTip.se:before {
- left: 14px;
-}
-
-#powerTip.e:after, #powerTip.e:before {
- left: 100%;
-}
-#powerTip.e:after {
- border-left-color: #ffffff;
- border-width: 10px;
- top: 50%;
- margin-top: -10px;
-}
-#powerTip.e:before {
- border-left-color: #808080;
- border-width: 11px;
- top: 50%;
- margin-top: -11px;
-}
-
-#powerTip.w:after, #powerTip.w:before {
- right: 100%;
-}
-#powerTip.w:after {
- border-right-color: #ffffff;
- border-width: 10px;
- top: 50%;
- margin-top: -10px;
-}
-#powerTip.w:before {
- border-right-color: #808080;
- border-width: 11px;
- top: 50%;
- margin-top: -11px;
-}
-
-@media print
-{
- #top { display: none; }
- #side-nav { display: none; }
- #nav-path { display: none; }
- body { overflow:visible; }
- h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
- .summary { display: none; }
- .memitem { page-break-inside: avoid; }
- #doc-content
- {
- margin-left:0 !important;
- height:auto !important;
- width:auto !important;
- overflow:inherit;
- display:inline;
- }
-}
-
diff --git a/doc/doxygen_pages.dox b/doc/doxygen_pages.dox
index a075d4b2..b2300e20 100644
--- a/doc/doxygen_pages.dox
+++ b/doc/doxygen_pages.dox
@@ -15,6 +15,13 @@
*/
+/**
+ * @page DEMO_ROS2 ROS2 API demo
+ *
+ * @include demo_api_v2_ros2.cpp
+ */
+
+
/**
* @page CHANGELOG Changelog
*
diff --git a/extra_visitors/ros2param/ariles2/visitors/ros2param.h b/extra_visitors/ros2param/ariles2/visitors/ros2param.h
index f8feaa90..836e52e7 100644
--- a/extra_visitors/ros2param/ariles2/visitors/ros2param.h
+++ b/extra_visitors/ros2param/ariles2/visitors/ros2param.h
@@ -9,10 +9,10 @@
*/
/**
-@defgroup ros2param ROS
+@defgroup ros2param ROS2 parameters
@ingroup config
-@brief ROS parameter server serialization.
+@brief ROS2 parameters.
*/
diff --git a/extra_visitors/ros2param/ariles2/visitors/ros2param/declarator.h b/extra_visitors/ros2param/ariles2/visitors/ros2param/declarator.h
index 7e6efee8..78ae8e41 100644
--- a/extra_visitors/ros2param/ariles2/visitors/ros2param/declarator.h
+++ b/extra_visitors/ros2param/ariles2/visitors/ros2param/declarator.h
@@ -29,7 +29,7 @@ namespace ariles2
: public serialization::PIMPLVisitor
{
public:
- explicit Declarator(::rclcpp::Node *nh);
+ explicit Declarator(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh);
void flush();
diff --git a/extra_visitors/ros2param/ariles2/visitors/ros2param/reader.h b/extra_visitors/ros2param/ariles2/visitors/ros2param/reader.h
index 93bbba01..b78d791c 100644
--- a/extra_visitors/ros2param/ariles2/visitors/ros2param/reader.h
+++ b/extra_visitors/ros2param/ariles2/visitors/ros2param/reader.h
@@ -36,7 +36,7 @@ namespace ariles2
*
* @param[in] nh NodeHandle
*/
- explicit Reader(const ::rclcpp::Node *nh);
+ explicit Reader(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh);
bool startRoot(const std::string &name);
diff --git a/extra_visitors/ros2param/ariles2/visitors/ros2param/writer.h b/extra_visitors/ros2param/ariles2/visitors/ros2param/writer.h
index 0708b5bd..3af9feed 100644
--- a/extra_visitors/ros2param/ariles2/visitors/ros2param/writer.h
+++ b/extra_visitors/ros2param/ariles2/visitors/ros2param/writer.h
@@ -28,7 +28,7 @@ namespace ariles2
class ARILES2_VISIBILITY_ATTRIBUTE Writer : public serialization::PIMPLVisitor
{
public:
- explicit Writer(::rclcpp::Node *nh);
+ explicit Writer(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh);
void flush();
diff --git a/extra_visitors/ros2param/src/declarator.cpp b/extra_visitors/ros2param/src/declarator.cpp
index a4629885..c2a3d1a8 100644
--- a/extra_visitors/ros2param/src/declarator.cpp
+++ b/extra_visitors/ros2param/src/declarator.cpp
@@ -32,12 +32,19 @@ namespace ariles2
{
for (const rclcpp::Parameter ¶meter : parameters_)
{
- const rclcpp::ParameterValue &declared_value =
- nh_->declare_parameter(parameter.get_name(), parameter.get_parameter_value());
-
- ARILES2_ASSERT(
- declared_value.get_type() == parameter.get_type(),
- std::string("Parameter type mismatch: ") + parameter.get_name());
+ if (not nh_->has_parameter(parameter.get_name()))
+ {
+ const rclcpp::ParameterValue &declared_value =
+ nh_->declare_parameter(parameter.get_name(), parameter.get_parameter_value());
+
+ ARILES2_ASSERT(
+ declared_value.get_type() == parameter.get_type(),
+ std::string("Parameter type mismatch: ") + parameter.get_name());
+ }
+
+ // https://github.com/ros2/rclcpp/blob/master/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp#L652
+ // "cannot undeclare a statically typed parameter"
+ // nh_->undeclare_parameter(parameter.get_name());
}
return (true);
}
@@ -51,7 +58,7 @@ namespace ariles2
{
namespace ns_ros2param
{
- Declarator::Declarator(::rclcpp::Node *nh)
+ Declarator::Declarator(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
{
makeImplPtr(nh);
}
diff --git a/extra_visitors/ros2param/src/modifier.h b/extra_visitors/ros2param/src/modifier.h
index 58201476..c6738fc3 100644
--- a/extra_visitors/ros2param/src/modifier.h
+++ b/extra_visitors/ros2param/src/modifier.h
@@ -19,14 +19,14 @@ namespace ariles2
{
public:
// https://docs.ros2.org/latest/api/rclcpp/classrclcpp_1_1Node.html
- rclcpp::Node *nh_;
+ rclcpp::node_interfaces::NodeParametersInterface::SharedPtr nh_;
std::vector parameters_;
const std::string separator_ = ".";
public:
- explicit ModifierImplBase(::rclcpp::Node *nh)
+ explicit ModifierImplBase(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
{
nh_ = nh;
}
diff --git a/extra_visitors/ros2param/src/reader.cpp b/extra_visitors/ros2param/src/reader.cpp
index af692465..1dac9655 100644
--- a/extra_visitors/ros2param/src/reader.cpp
+++ b/extra_visitors/ros2param/src/reader.cpp
@@ -145,7 +145,7 @@ namespace ariles2
{
public:
// https://docs.ros2.org/latest/api/rclcpp/classrclcpp_1_1Node.html
- const rclcpp::Node *nh_;
+ rclcpp::node_interfaces::NodeParametersInterface::SharedPtr nh_;
std::vector parameter_names_;
@@ -153,7 +153,7 @@ namespace ariles2
public:
- explicit Reader(const ::rclcpp::Node *nh)
+ explicit Reader(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
{
nh_ = nh;
}
@@ -272,7 +272,7 @@ namespace ariles2
{
namespace ns_ros2param
{
- Reader::Reader(const ::rclcpp::Node *nh)
+ Reader::Reader(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
{
makeImplPtr(nh);
}
diff --git a/extra_visitors/ros2param/src/writer.cpp b/extra_visitors/ros2param/src/writer.cpp
index 2745225c..200c4cdf 100644
--- a/extra_visitors/ros2param/src/writer.cpp
+++ b/extra_visitors/ros2param/src/writer.cpp
@@ -42,7 +42,7 @@ namespace ariles2
{
namespace ns_ros2param
{
- Writer::Writer(::rclcpp::Node *nh)
+ Writer::Writer(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
{
makeImplPtr(nh);
}
diff --git a/extra_visitors/rosparam/ariles2/visitors/rosparam.h b/extra_visitors/rosparam/ariles2/visitors/rosparam.h
index a98b0fef..a29ae17b 100644
--- a/extra_visitors/rosparam/ariles2/visitors/rosparam.h
+++ b/extra_visitors/rosparam/ariles2/visitors/rosparam.h
@@ -9,7 +9,7 @@
*/
/**
-@defgroup rosparam ROS
+@defgroup rosparam ROS parameter server
@ingroup config
@brief ROS parameter server serialization.
diff --git a/include/ariles2/visitors/write.h b/include/ariles2/visitors/write.h
index 257c291c..a31c4d04 100644
--- a/include/ariles2/visitors/write.h
+++ b/include/ariles2/visitors/write.h
@@ -87,7 +87,7 @@ namespace ariles2
/**
* @brief Starts a nested map in the configuration file
*
- * @param[in] instance_id instance id
+ * @param[in] param parameters
* @param[in] num_entries number of child entries
*/
virtual void startMap(const t_Parameters & /*param*/, const std::size_t /*num_entries*/)
diff --git a/tests/api_v2/CMakeLists.txt b/tests/api_v2/CMakeLists.txt
index 045a85d4..e81bb08b 100644
--- a/tests/api_v2/CMakeLists.txt
+++ b/tests/api_v2/CMakeLists.txt
@@ -29,6 +29,7 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/tests_bin_api_v2/
##############################################################################
ariles_define_test(${PROJECT_NAME} "demo_api_v2" "yaml_cpp;rosparam;octave" "")
+ariles_define_test(${PROJECT_NAME} "demo_api_v2_ros2" "yaml_cpp;ros2param" "")
# basic test for missing inlines
add_library(testlib_api_v2 SHARED testlib1.cpp testlib2.cpp)
diff --git a/tests/api_v2/demo_api_v2_ros2.cpp b/tests/api_v2/demo_api_v2_ros2.cpp
new file mode 100644
index 00000000..0e36c955
--- /dev/null
+++ b/tests/api_v2/demo_api_v2_ros2.cpp
@@ -0,0 +1,255 @@
+/**
+ @file
+ @author Alexander Sherikov
+
+ @copyright 2024 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
+ (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
+
+ @brief
+*/
+
+
+// ============================================================================
+// HEADER INCLUSION
+// ============================================================================
+
+// `visitor` is an Ariles component which provides integration with a particular
+// 3rd party library.
+#include
+#include
+
+// `adapter` is an Ariles component which adds support for serialization of
+// certain type(s), e.g. Eigen types or Boost pointers.
+#include
+#include
+#include
+#include
+#include
+
+
+
+// ===============================================================
+// DEFINING TYPES
+// ===============================================================
+namespace
+{
+ class ArilesBaseClass
+ // must inherit from ariles2::DefaultBase
+ : public ariles2::DefaultBase
+ {
+// Declare entries, in this case two numbers
+#define ARILES2_ENTRIES(v) \
+ ARILES2_TYPED_ENTRY(v, real_member, double) \
+ ARILES2_TYPED_ENTRY_(v, integer_member, int)
+// underscore ^ indicates that the name of the entry must be
+// 'integer_member_' instead of 'integer_member', this is useful if your
+// naming convention requires trailing underscores for member variables.
+
+// Initialize ariles
+#include ARILES2_INITIALIZE
+
+ public:
+ virtual ~ArilesBaseClass() = default; // added to suppress compiler warnings
+
+ // This method is called every time you deserialize a class. If
+ // omitted, the default automatically generated method is used.
+ void arilesVisit(const ariles2::Defaults & /*visitor*/, const ariles2::Defaults::Parameters & /*param*/)
+ {
+ real_member = 0.0;
+ integer_member_ = 12;
+ }
+ };
+
+
+ class NonArilesBaseClass
+ {
+ public:
+ // Eigen types are supported too, see below
+ Eigen::Vector3d eigen_vector_;
+ };
+
+
+ class MyClass : public ArilesBaseClass, // no need to inherit from ariles2::DefaultBase directly.
+ public NonArilesBaseClass
+ {
+// Declare entries, in this case we indicate inheritance from another
+// Ariles class (ArilesBaseClass) and a member from a non-Ariles class
+// (NonArilesBaseClass)
+#define ARILES2_ENTRIES(v) \
+ ARILES2_PARENT(v, ArilesBaseClass) \
+ ARILES2_ENTRY_(v, eigen_vector)
+ // Here ^ Ariles should not declare the inherited member, therefore we
+ // use 'ARILES2_ENTRY_' instead of 'ARILES2_TYPED_ENTRY_'.
+
+#include ARILES2_INITIALIZE
+
+
+ public:
+ ~MyClass() override = default; // added to suppress compiler warnings
+
+
+ void arilesVisit(const ariles2::Defaults &visitor, const ariles2::Defaults::Parameters ¶m)
+ {
+ // If you use your own method to initialize member variables,
+ // it is up to you to properly initialize all entries and
+ // parent classes.
+ // all parents at once
+ arilesVisitParents(visitor, param);
+ // or one by one (either option is sufficient)
+ ArilesBaseClass::arilesVisit(visitor, param);
+
+ // custom default values for some members
+ real_member = 100.0;
+ eigen_vector_.setZero();
+ }
+ };
+
+
+ class MyContainerClass : public ariles2::DefaultBase
+ {
+ // Some of the standard containers can be used with Ariles types.
+#define ARILES2_ENTRIES(v) \
+ ARILES2_TYPED_ENTRY_(v, my_class_vector, std::vector) \
+ ARILES2_TYPED_ENTRY_(v, ptr, std::shared_ptr)
+#include ARILES2_INITIALIZE
+
+ public:
+ ~MyContainerClass() = default;
+ };
+} // namespace
+
+
+// ===============================================================
+// SERIALIZATION & DESERIALIZATION
+// ===============================================================
+
+#include // std::cout
+
+
+// run with "demo_api_v2_ros2 --ros-args --params-file /demo_api_v2_ros2.yaml"
+int main(int argc, char *argv[])
+{
+ try
+ {
+ rclcpp::init(argc, argv);
+ rclcpp::Node::SharedPtr nh = rclcpp::Node::make_shared(
+ "demo_api_v2_ros2",
+ // although ariles provides Declarator visitor, declaring
+ // parameters in general case is not possible since generic
+ // arrays are stored as maps with indices used as keys: size of
+ // such array is not know in advance so it is not possible to
+ // declare all the necessary indices
+ rclcpp::NodeOptions().allow_undeclared_parameters(true).automatically_declare_parameters_from_overrides(
+ true));
+
+ // read parameters loaded from file (demo_api_v2_ros2.yaml)
+ {
+ MyContainerClass my_container_class;
+
+ // access members as usual
+ my_container_class.my_class_vector_.emplace_back();
+ ariles2::apply(my_container_class.my_class_vector_[0]);
+
+ /*
+ * output
+ my_class_vector:
+ - real_member: 100
+ integer_member: 12
+ eigen_vector: [0, 0, 0]
+ ptr:
+ is_null: true
+ */
+ ariles2::apply(std::cout, my_container_class);
+
+ // see demo_api_v2_ros2.yaml
+ ariles2::apply(nh->get_node_parameters_interface(), my_container_class);
+
+ /*
+ * output
+ my_class_vector:
+ - real_member: 100
+ integer_member: 12
+ eigen_vector: [0, 0, 0]
+ - real_member: 110
+ integer_member: 1
+ eigen_vector: [0, 1, 0]
+ - real_member: 111
+ integer_member: 21
+ eigen_vector: [1, 1, 0]
+ ptr:
+ is_null: true
+ */
+ ariles2::apply(std::cout, my_container_class);
+ }
+
+ // writing & reading
+ {
+ MyContainerClass my_container_class;
+ my_container_class.ptr_ = std::make_shared();
+ ariles2::apply(*my_container_class.ptr_);
+
+ my_container_class.my_class_vector_.emplace_back();
+ ariles2::apply(my_container_class.my_class_vector_[0]);
+ my_container_class.my_class_vector_[0].real_member = 200;
+
+ ariles2::apply(nh->get_node_parameters_interface(), my_container_class);
+ ariles2::apply(nh->get_node_parameters_interface(), my_container_class);
+
+ /*
+ * output:
+ * - note that parameters loaded from file are preserved
+ * - it would be nice to drop old parameters, but it is impossible to undeclare them
+ my_class_vector:
+ - real_member: 200 # overriden
+ integer_member: 12
+ eigen_vector: [0, 0, 0]
+ - real_member: 110
+ integer_member: 1
+ eigen_vector: [0, 1, 0]
+ - real_member: 111
+ integer_member: 21
+ eigen_vector: [1, 1, 0]
+ ptr:
+ is_null: false # overriden
+ value: # added
+ real_member: 100
+ integer_member: 12
+ eigen_vector: [0, 0, 0]
+ */
+ ariles2::apply(std::cout, my_container_class);
+ }
+
+ // declaring
+ // - hardly useful, is going to declare my_class_vector_ to have only one member
+ // - declarator does not read parameters into an Ariles class, a
+ // separate pass with Reader visitor is needed
+ {
+ MyContainerClass my_container_class;
+ my_container_class.my_class_vector_.emplace_back();
+ ariles2::apply(my_container_class.my_class_vector_[0]);
+ ariles2::apply(nh->get_node_parameters_interface(), my_container_class);
+ }
+
+ // missing parameters
+ // - an attempt to read missing parameters results in an exception
+ {
+ MyClass my_class;
+ try
+ {
+ ariles2::apply(nh->get_node_parameters_interface(), my_class);
+ }
+ catch (const std::exception &e)
+ {
+ // "... Configuration file does not contain entry 'real_member'."
+ std::cout << e.what() << std::endl;
+ }
+ }
+ }
+ catch (const std::exception &e)
+ {
+ std::cout << e.what() << std::endl;
+ return (EXIT_FAILURE);
+ }
+
+ return (EXIT_SUCCESS);
+}
diff --git a/tests/api_v2/demo_api_v2_ros2.yaml b/tests/api_v2/demo_api_v2_ros2.yaml
new file mode 100644
index 00000000..e862e755
--- /dev/null
+++ b/tests/api_v2/demo_api_v2_ros2.yaml
@@ -0,0 +1,17 @@
+/demo_api_v2_ros2:
+ ros__parameters:
+ my_class_vector:
+ 0:
+ real_member: 100.
+ integer_member: 12
+ eigen_vector: [0., 0., 0.]
+ 1:
+ real_member: 110.
+ integer_member: 1
+ eigen_vector: [0., 1.0, 0.]
+ 2:
+ real_member: 111.
+ integer_member: 21
+ eigen_vector: [1.0, 1.0, 0.]
+ ptr:
+ is_null: true
diff --git a/tests/api_v2/fixtures/010_ros2_with_declarator.h b/tests/api_v2/fixtures/022_ros2_with_declarator.h
similarity index 87%
rename from tests/api_v2/fixtures/010_ros2_with_declarator.h
rename to tests/api_v2/fixtures/022_ros2_with_declarator.h
index ceb49bf3..229c531b 100644
--- a/tests/api_v2/fixtures/010_ros2_with_declarator.h
+++ b/tests/api_v2/fixtures/022_ros2_with_declarator.h
@@ -30,6 +30,10 @@ namespace ariles_tests
BOOST_CHECK_NO_THROW(ariles2::apply(
getDeclaratorInitializer("configurable_match_simple.cfg"), configurable_decl));
+ // double declaration should be ok
+ BOOST_CHECK_NO_THROW(ariles2::apply(
+ getDeclaratorInitializer("configurable_match_simple.cfg"), configurable_decl));
+
// -------
t_Configurable configurable_out;
diff --git a/tests/api_v2/fixtures/initializer_ros2_with_declarator.h b/tests/api_v2/fixtures/initializer_ros2_with_declarator.h
index 537e576f..45fae073 100644
--- a/tests/api_v2/fixtures/initializer_ros2_with_declarator.h
+++ b/tests/api_v2/fixtures/initializer_ros2_with_declarator.h
@@ -49,19 +49,22 @@ namespace ariles_tests
rclcpp::shutdown();
}
- rclcpp::Node *getDeclaratorInitializer(const std::string & /*string_id*/)
+ rclcpp::node_interfaces::NodeParametersInterface::SharedPtr getDeclaratorInitializer(
+ const std::string & /*string_id*/)
{
- return (nh_.get());
+ return (nh_->get_node_parameters_interface());
}
- const rclcpp::Node *getReaderInitializer(const std::string & /*string_id*/)
+ rclcpp::node_interfaces::NodeParametersInterface::SharedPtr getReaderInitializer(
+ const std::string & /*string_id*/)
{
- return (nh_.get());
+ return (nh_->get_node_parameters_interface());
}
- rclcpp::Node *getWriterInitializer(const std::string & /*string_id*/)
+ rclcpp::node_interfaces::NodeParametersInterface::SharedPtr getWriterInitializer(
+ const std::string & /*string_id*/)
{
- return (nh_.get());
+ return (nh_->get_node_parameters_interface());
}
};
#endif
diff --git a/tests/api_v2/fixtures/initializers.h b/tests/api_v2/fixtures/initializers.h
index ec6b0fa2..c45fea7b 100644
--- a/tests/api_v2/fixtures/initializers.h
+++ b/tests/api_v2/fixtures/initializers.h
@@ -240,14 +240,16 @@ namespace ariles_tests
rclcpp::shutdown();
}
- const rclcpp::Node *getReaderInitializer(const std::string & /*string_id*/)
+ rclcpp::node_interfaces::NodeParametersInterface::SharedPtr getReaderInitializer(
+ const std::string & /*string_id*/)
{
- return (nh_.get());
+ return (nh_->get_node_parameters_interface());
}
- rclcpp::Node *getWriterInitializer(const std::string & /*string_id*/)
+ rclcpp::node_interfaces::NodeParametersInterface::SharedPtr getWriterInitializer(
+ const std::string & /*string_id*/)
{
- return (nh_.get());
+ return (nh_->get_node_parameters_interface());
}
};
#endif
diff --git a/tests/api_v2/regression_test_235.cpp b/tests/api_v2/regression_test_235.cpp
index 5dbd0ce7..8308f415 100644
--- a/tests/api_v2/regression_test_235.cpp
+++ b/tests/api_v2/regression_test_235.cpp
@@ -45,7 +45,7 @@
#include "fixtures/initializer_ros2_with_declarator.h"
-#include "fixtures/010_ros2_with_declarator.h"
+#include "fixtures/022_ros2_with_declarator.h"
// ===============================================================
|