Commit graph

66 commits

Author SHA1 Message Date
Dan Rose
2876b80a7d dds_time_t instead of dds_duration_t for absolute time
Signed-off-by: Dan Rose <dan@digilabs.io>
2020-01-23 10:53:38 +01:00
Dan Rose
c0af9d898b
Cache serialization info when CDRWriter is constructed (#80)
1. Make CDRWriter remember its top level struct value type
2. Populate the trivially serializable cache when CDRWriter is created instead of waiting until the first time a message is sent.
3. Speed up arrays/sequences of trivially serializable structs

Signed-off-by: Dan Rose <dan@digilabs.io>
2019-12-13 11:05:58 -05:00
Dan Rose
c25f22e565
Mark code that should be unreachable (#77)
Introduce a new [[noreturn]] unreachable() function that marks code as unreachable and throws a logic error if it is executed.
Fix build error due to Windows min/max macros.
Fix linker errors from referring to a non-constexpr extern from a constexpr.
Fix warnings about narrowing conversions.

Signed-off-by: Dan Rose <dan@digilabs.io>
2019-12-08 16:03:30 -06:00
Dan Rose
9b264c6480
Clean up topic namespace prefixes (#76)
Signed-off-by: Dan Rose <dan@digilabs.io>
2019-12-06 11:23:47 -06:00
Dan Rose
b322f478de
Serialize into initialized memory, not vector (#75)
Make serdata a private header
Serialize into uninitialize data, not a vector.
2019-12-06 10:21:18 -06:00
Dan Rose
88e74c322f
Rework serialization (#42)
* Rework serialization and typesupport

Signed-off-by: Dan Rose <dan@digilabs.io>
2019-12-05 14:42:11 -06:00
eboasson
3e7d33ba2b
Use rcutils_get_env() instead of getenv() (#71) (#73)
* Use rcutils_get_env() instead of getenv() (#71)

Signed-off-by: Erik Boasson <eb@ilities.com>

* Keep includes in alphabetical order

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-11-25 20:19:14 +01:00
eboasson
0ca71446a9 Address "Precondition not met" on rmw_create_node (#65) (#66)
Cyclone's original code for dds_create_domain() appears to create a
domain entity that is automatically deleted when the last attached
participant disappears.  In reality, it leaks a reference while
returning DDS_RETCODE_OK, making it appear as-if it is a regular entity
that remains into existence until explicitly deleted.

The RMW code assumed that it would be automatically deleted when the
last node was destroyed and that a subsequent call to rmw_create_node
could create the domain anew.  This then fails with "precondition not
met".

In an upcoming fixed version of dds_create_domain() the domain entities
will behave normally (return a handle, require an explicit delete).

This commit provides a workaround for the bug in the original
implementation: by recovering the handle from the first participant the
preceding commits that were intended to future-proof the code will
ensure that the entity now gets deleted explicitly.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-11-11 15:28:53 -05:00
eboasson
096d4643c8
Fix dashing breakage (#64)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-11-07 09:33:17 +01:00
eboasson
c168334087
Support localhost-only communications (#60)
* Support localhost-only communications

Signed-off-by: Erik Boasson <eb@ilities.com>

* Future-proof localhost-only for upcoming Cyclone fix

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-11-07 08:14:59 +01:00
Scott K Logan
bb8570f165
Suppress a syntax error identified by cppcheck 1.89 (#59)
Signed-off-by: Scott K Logan <logans@cottsay.net>
2019-10-25 09:15:25 -07:00
eboasson
3817149010 Make RMW version acceptable to MSVC (#58)
GCC and Clang support the ternary operator in macros, MSVC does not.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-25 09:14:45 -07:00
Karsten Knese
e959e66f08 rename return functions
Signed-off-by: Karsten Knese <karsten@openrobotics.org>
2019-10-22 16:50:24 +02:00
evshary
6d907ef583 Solve the lint issue.
Signed-off-by: evshary <evshary@gmail.com>
2019-10-21 12:42:12 +02:00
Erik Boasson
7bfd709fe0 Add already obsoleted loaned message interfaces
The rmw_return_loaned_message and rmw_release_loaned_message functions
are still expected by rcl, even if they are scheduled to be replaced.
We need a working build, so add them for now.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-21 12:37:55 +02:00
Karsten Knese
d8cb336f8f zero copy api for cyclonedds
Signed-off-by: Karsten Knese <karsten@openrobotics.org>
2019-10-21 12:37:55 +02:00
Dan Rose
d47de860aa Use right event info for RMW_EVENT_LIVELINESS_LOST
Signed-off-by: Dan Rose <dan@digilabs.io>
2019-10-20 03:17:46 -07:00
Dan Rose
79e7046784 unbreak Dashing build after #50
Signed-off-by: Dan Rose <dan@digilabs.io>
2019-10-20 03:08:00 -07:00
Dan Rose
c51c884413 Add compilation guards for RMW compatibility
Use CMake rmw_VERSION for conditional compilation

Signed-off-by: Dan Rose <dan@digilabs.io>
2019-10-20 02:41:30 -07:00
Erik Boasson
94e53ce83f update signature for added pub/sub options
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-10-20 02:41:30 -07:00
Brian Marchi
33fed3a65c Add localhost boolean parameter to create node function (#50)
* Add localhost boolean parameter to create node function

Signed-off-by: Brian Ezequiel Marchi <brian.marchi65@gmail.com>

* Cast to void to avoid compilation warning

Signed-off-by: Brian Ezequiel Marchi <brian.marchi65@gmail.com>
2019-10-18 19:30:06 -03:00
Erik Boasson
a55c9cb605 Use RMW_RET_NODE_NAME_NON_EXISTENT only if defined
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-25 07:51:17 +02:00
evshary
a61a014a11 Return NODE_NAME_NON_EXISTENT instead of ERROR.
Signed-off-by: evshary <evshary@gmail.com>
2019-09-24 15:11:51 +02:00
Erik Boasson
828ae14558 Address uncrustify linter violation
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-19 13:18:54 +02:00
dennis-adlink
0e6fd30a8c Validation in deserializer (#36)
* Validation in Deserializer

Added validation in CDR deserialization: max buffer length is checked
when deserializing fields and strings are checked for null-terminator
(except for wstrings, which are serialized without null-terminator).

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

* Catch exceptions in serdata functions

In serdata functions rmw_print, rmw_to_sample and rmw_from_sample
catch exceptions so that correct return code is given when functions
are called from ddsi.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

* Improve deserialisation validation

Refactored the deserialisation validation functions so that sequence
length is checked more properly and protection against overflows.
Renamed source files for exceptions so that it conforms to ros2 /
google c++ style guide.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2019-09-19 11:56:26 +02:00
Scott K Logan
e849c71122 Address CMake and uncrustify linter violations 2019-09-18 10:26:39 +02:00
Erik Boasson
60a87ab4ab Optional reporting of late messages
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:00:46 +02:00
Erik Boasson
a63cc8b84d Multi-domain support
Depends on some improvements to Cyclone, source compatible with versions
that lack those improvements.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:00:46 +02:00
Erik Boasson
8844880edd Implement no_demangle in various get_... functions
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-22 10:14:49 +02:00
Erik Boasson
81c597027f Code formatting fix
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-22 10:14:49 +02:00
Erik Boasson
d5af8dcb9a Implement rmw_take_event
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-19 20:46:51 +02:00
Erik Boasson
e4fa799090 Use dummy guardcond to block on empty waitset
Cyclone DDS always returns immediately from ``dds_waitset_wait`` when
there are no entities in the waitset, but the rcl timer test implies
that the expectation is that blocks.  By adding a guard condition that
is never triggered this expectation is met.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-19 20:46:51 +02:00
Erik Boasson
d06953bd91 Handle RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-19 20:46:51 +02:00
Erik Boasson
021910e565 Support creating a waitset without creating a node
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-18 21:03:51 +02:00
Erik Boasson
5e137205f2 Uncrustify and fix issues reported by cpplint
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-17 15:23:21 +02:00
Erik Boasson
130d6ea10e Fix retrieving client/server topic names
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-16 15:30:50 +02:00
Erik Boasson
0765e5696d Return error when querying a non-existent node
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-16 15:30:50 +02:00
Erik Boasson
edab551520 Add get_client_names_and_types_by_node
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-16 15:30:50 +02:00
Erik Boasson
cb0ed6a1df Start request sequence numbers at 1
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-16 15:30:50 +02:00
Erik Boasson
a47cd2c412 Create topics in the right node's participant
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-16 15:30:50 +02:00
Erik Boasson
f1f1b7bdaf Update get_actual_qos based on test results
* Return history depth even when KEEP_ALL is selected

* Return deadline, lifespan, liveliness

This doesn't fix it completely: the latter three are not actually
supported and are still ignored when creating an publisher or subscriber
node; and moreover it is not clear how to map infinity.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-16 15:30:50 +02:00
Erik Boasson
0f25192bcb Return error for invalid name nodes
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-16 15:30:50 +02:00
Erik Boasson
5299a83916 Create one DDS publisher, subscriber per node
Otherwise each writer/reader gets its own, and at approximately 1kB
each, with hundreds of endpoints that starts adding up to a meaningful
amount of memory.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-24 11:28:41 +02:00
Erik Boasson
3e9a56a36b Share built-in readers across nodes
If each node has its own set of built-in topic readers there is quite a
bit of memory use for no benefit.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-24 11:28:41 +02:00
Erik Boasson
3a4b10421d Don't retain all data in builtin-topics readers
The built-in topics readers in the RMW node are currently not used for
anything other than triggering the guard condition.  All the query
functions just get their own data set from Cyclone.  Taking all samples
instead of just the not-alive ones reduces memory usage.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-21 16:26:01 +02:00
Erik Boasson
870854b7ba Fix return of rmw_wait
Misuse of std::vector resize as if it would leave any reserved entries
unchanged caused a misinterpretation of entries whenever the number of
triggering entities was larger than the number of triggering entities in
the preceding call to rmw_wait: these would all be mapped to the first
entity in the set.

If the waitset is reused from call to call and spurious events are
handled gracefully, this is recoverable; otherwise, no such luck.

Moreover, not accounting for a sentinel entry added to the list of
triggered entities means it would never return RMW_RET_TIMEOUT.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-20 19:53:13 +08:00
Hunter L. Allen
eb4aec84ca Replace __attribute__((unused)) with static_cast<void>
Signed-off-by: Hunter L. Allen <hunterlallen@protonmail.com>
2019-06-18 22:04:34 +08:00
Juan Oxoby
7acc5f3222 Check for nullptr.
Sometimes dds_qget_userdata() returns true with a nullptr. It might be a good idea
to revise its implementation.
2019-06-15 04:44:24 +02:00
Juan Oxoby
bc9beb77f9 Add rmw_subscription_get_actual_qos implementation 2019-06-15 03:59:14 +02:00
Erik Boasson
16acb73821 Avoid triggering graph guard cond after destroying it (#3)
The graph guard condition is triggered whenever the underlying DDS
topology changes using a listener set on readers for the DDS built-in
topics.  The graph guard condition was destroyed before ensuring the listeners
would no longer be invoked, and this would lead to trying to trigger the
graph guard condition after it had been destroyed.

With this commit, the built-in readers are deleted explicitly before
destroying the graph guard condition.
2019-06-07 09:10:02 +02:00