Commit graph

53 commits

Author SHA1 Message Date
Dan Rose
3edf332573 Use rosdep (#32)
* Add Cyclone DDS build dependencies for rosdep

* Update README.md

Change apt install commands to rosdep install.

* build_depend -> buildtool_depend for maven and java

* Add vendor package to build cyclonedds from source

Remove maven and java dependency (thanks, @eboasson)

* remove --symlink-build flag

this obscures the intention of the code and sophisticated users can choose whether to use it or not.

* add rosdep to readme
2019-09-13 11:54:06 +02:00
dennis-adlink
883ef01105 Implemented byte-swapping in deserializer (#31)
* Implemented byte-swapping in deserializer

Set the correct endianness flag when serializing ROS messages to CDR
and added support for byte-swapping in CDR deserializer when in a
mixed-endian network.

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

* Fix float deser byte-swap and add byte-swap in cycprint

Fixed the byte-swapping in float/double deserialization and added byte-
swapping in cycprint by creating a cycdeserbase that is shared with
cycdeser.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2019-09-12 15:31:03 +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
fb8c08bd7f Add support for printing messages to DDSI trace
NOTE: not tested against versions of Cyclone that don't have the feature

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-09-11 10:00:46 +02:00
Scott K Logan
888235e96e Revert "Replace cyclonedds by CycloneDDS for colcon"
This reverts commit 9ba2508bca.

The CycloneDDS package name should conform to the ROS package name
recommendations, and contain no upper-case letters.

Signed-off-by: Scott K Logan <logans@cottsay.net>
2019-08-30 11:26:42 +02:00
Erik Boasson
9ba2508bca Replace cyclonedds by CycloneDDS for colcon
Commit 1200bfd109e4e21ff572ce0c6205cb6c2e247edc in Cyclone DDS changed
the setting of the project name to use a string literal.  That change
affects the capitalization of the name under which colcon looks for
Cyclone, and this commit changes the dependency specification to match.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-26 11:47:59 +02:00
Erik Boasson
43f70ed2eb Use NO_KEY GUID variant if Cyclone DDS supports it
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-22 10:14:49 +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
eb2d17c066 Set encoding to CDR rather than parameterised-CDR
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
10f18f0525 Add wstring support
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-19 11:13:13 +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
b49dd0eb62 Fix serialization of bool sequence/array
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
572d272ebf Initialize common ddsi_sertopic with memset
struct ddsi_sertopic will shortly change a little bit by the removal of
two members that should never have been in it in the first place and
that had to be initialized to 0.  Relying on memset makes the source
code independent of this difference.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-20 18:37:59 +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
2090d067c1 Specialize deserializer for strings (#3)
As std::string is not a basic type, "new" must sometimes be called to
initialze the memory before passing it as a reference.
2019-06-07 11:21:22 +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
Erik Boasson
c34f6c35af Make various introspection features work
This leaves as the big gaping holes:

* Cyclone DDS does not allow creating a waitset or a guard condition
  outside a participant, and this forces the creation of an additional
  participant.  It can be fixed in the RMW layer, or it can be dealt
  with in Cyclone DDS, but the trouble with the latter is that there are
  solid reasons for not allowing it, even if it is easy to support it
  today.  (E.g., a remote procedure call interface ...)

* Cyclone DDS does not currently support multiple domains
  simultaneously, and so this RMW implementation ignores the domain_id
  parameter in create_node, instead creating all nodes/participants
  (including the special participant mentioned above) in the default
  domain, which can be controlled via CYCLONEDDS_URI.

* Deserialization only handles native format (it doesn't do any byte
  swapping).  This is pure laziness, adding it is trivial.

* Deserialization assumes the input is valid and will do terrible things
  if it isn't.  Again, pure laziness, it's just adding some bounds
  checks and other validation code.

* There are some "oddities" with the way service requests and replies
  are serialized and what it uses as a "GUID".  (It actually uses an
  almost-certainly-unique 64-bit number, the Cyclone DDS instance id,
  instead of a real GUID.)  I'm pretty sure the format is wildly
  different from that in other RMW implementations, and so services
  presumably will not function cross-implementation.

* The name mangling seems to be compatibl-ish with the FastRTPS
  implementation and in some cases using the ros2 CLI for querying the
  system works cross-implementation, but not always.  The one in this
  implementation is reverse-engineered, so trouble may be lurking
  somewhere.  As a related point: the "no_demangle" option is currently
  ignored ... it causes a compiler warning.
2019-06-03 17:15:46 +02:00
Erik Boasson
3501d8f69e add get service_names_and_types
untested ...
2019-06-03 11:28:50 +02:00
Erik Boasson
f1602da3be add type names, some more introspection functions
Almost there! Known issues:
* mangling/demangling is still wrong
* it necessarily has to run in the Cyclone default domain id: (1)
  Cyclone is today still limited to a single domain at a time; and (2)
  there is the "extra" participant that pops up here and there for
  creating guard conditions and waitsets without a node existing
* almost all query operations create a reader for a builtin topic and
  throw it away afterward, that might be a little excessive (on the other
  hand, those readers are pretty cheap, so using them as a throwaway
  reader is not so bad).

Still missing:
* get_service_names_and_types
* get_service_names_and_types_by_node

I haven't been able to actually try everything yet, so bugs are probably
lurking here-and-there.
2019-05-21 16:05:52 +02:00
Erik Boasson
24726b4685 update to match ROS2 Dashing interface
passes a decent subset of the tests ...

fixes:
* sequences of simple types: remove accidental alignment
* trigger graph guard on any built-in topic
* create a participant for each node, with node name/namespace in user data

It is still only a proof-of-concept, but it might now actually be usable ...
2019-05-12 13:52:26 +02:00
Erik Boasson
e520cb4d63 remove use of C99-style designated initializers 2019-05-05 13:29:17 +08:00
Erik Boasson
3e0429785d add rmw_get_topic_names_and_types (untested) 2019-05-05 12:44:51 +08:00
Erik Boasson
d23affb5a4 add server_is_available, count_matched functions 2019-05-05 12:38:32 +08:00
Erik Boasson
925b6e09b3 add write/take of serialized messages 2019-05-05 12:36:58 +08:00
Erik Boasson
b925d5591c update for fixes in Cyclone sertopic interface 2019-05-05 12:34:02 +08:00
Erik Boasson
d298359822 fix string serialization, vector deserialization 2019-05-05 12:31:49 +08:00
YuSheng T
f7de5522d7 remove compile error when gcc 7 2019-05-03 18:28:10 +08:00
Erik Boasson
315d39a2ec update to allow talker/listener demos to run
This commit adds stubs for the missing functions and fixes a few bugs in
the serialisation code and topic creation.  With these changes, the
talker and listener demos of ROS2 Crystal Clemmys work.
2019-05-03 17:12:51 +08:00
Erik Boasson
c9a23a9b8a update for Cyclone DDS changes and ROS2 changes
The changes in this commit make it compile with ROS2 Crystal Clemmys and
current Cyclone DDS.  The RMW interface of ROS2 was modified in some
ways and extended in some other ways since Bouncy Bolson; and similarly,
Cyclone now has a somewhat reasonable interface for custom sample
representations and serialization, but the code in this commit probably
contains mistakes in using it.

Therefore, the expectation should be that this doesn't actually work
just yet, though it probably is quite close.  As the old state wouldn't
build at all with any version of Cyclone DDS except the early commits,
this is significant progress already.
2019-04-29 10:08:59 +02:00
Erik Boasson
40a042c6dc replace FastCDR and serialise straight into a serdata to avoid an extra copy 2018-07-19 16:37:12 +02:00
Erik Boasson
e6b6ede709 use dds conditions and waitsets 2018-07-19 16:35:46 +02:00