Commit graph

180 commits

Author SHA1 Message Date
Erik Boasson
874ac51aff Add build instructions to README
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-13 18:16:09 +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
Erik Boasson
c55cbfda95 remove Fast-CDR references in CMake config 2019-05-05 12:31:17 +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
Erik Boasson
bae6854ff4 use waitsets, readconditions, guardconditions for waiting 2018-07-13 08:52:21 +02:00
Erik Boasson
9c71a0bed2 fix extern "C" use upsetting gcc (and accepted by clang) 2018-07-10 08:14:20 +02:00
Erik Boasson
01ef31359a initial commit 2018-07-09 13:22:25 +02:00