The two distinct operations of acquiring and subsequent checking of a
timer have to be protected by one lock_guard against races with other
threads. The releasing of a timer has to be protected by the same lock.
Given this requirement there is no use for a second mutex.
Signed-off-by: Marko Durkovic <marko@ternaris.com>
* when call wait for service in an while loop, the event will be make forever and never release
* fix it by: creating it when we need
Signed-off-by: reed-lau <geoliuwei@gmail.com>
* Fix flakey test
Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
* Fix lint and uncrustify issues
Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
* Sub Node alternative
* Sub Node alternative
* Test // characters in namespaces
* Sub Node alternative
* Test // characters in namespaces
* Fixing style and warning in the order of initalizing members
* Fixing cases with / in different positions, and adding new tests
* Removing commented methods
* Changing extended_namespace to sub_namespace
* Fixed a bug when merging
* Fixed a bug when merging
* Sub Node alternative
* Sub Node alternative
* Test // characters in namespaces
* Fixing style and warning in the order of initalizing members
* Fixing cases with / in different positions, and adding new tests
* Removing commented methods
* Changing extended_namespace to sub_namespace
* Fixed a bug when merging
* Merge with origin to update branch
* improvements to API and documentation
Signed-off-by: William Woodall <william@osrfoundation.org>
* style and fixing tests
Signed-off-by: William Woodall <william@osrfoundation.org>
* fixup subnode specific tests
Signed-off-by: William Woodall <william@osrfoundation.org>
* remove vestigial function
Signed-off-by: William Woodall <william@osrfoundation.org>
* improve documentation
Signed-off-by: William Woodall <william@osrfoundation.org>
* add test to check interaction between ~ and sub-nodes
Signed-off-by: William Woodall <william@osrfoundation.org>
* typo
Signed-off-by: William Woodall <william@osrfoundation.org>
* Start work on creaating NodeOptions structure.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* Continue work on NodeOptions.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* Update tests for NodeOptions impl.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* Update documentation and copy/assignment.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* Update rclcpp_lifecycle to conform to new API.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* Use builder pattern with NodeOptions.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* Documentation updates.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* Update rclcpp_lifecycle to use NodeOptions.
Signed-off-by: Michael Carroll <michael@openrobotics.org>
* change to parameter idiom only, from builder pattern
Signed-off-by: William Woodall <william@osrfoundation.org>
* Update rclcpp/include/rclcpp/node_options.hpp
Co-Authored-By: wjwwood <william+github@osrfoundation.org>
Signed-off-by: William Woodall <william@osrfoundation.org>
* follow up with more resets of the rcl_node_options_t
Signed-off-by: William Woodall <william@osrfoundation.org>
* todo about get env
Signed-off-by: William Woodall <william@osrfoundation.org>
* Add in the ability to get parameters in a map.
Any parameters that have a "." in them will be considered to
be part of a "map" (though they can also be get and set
individually). This PR adds two new template specializations
to the public node API so that it can take a map, and store
the list of values (so setting the parameter with a name of
"foo" and a key of "x" will end up with a parameter of "foo.x").
It also adds an API to get all of the keys corresponding to
a prefix, and returing that as a map (so a get of "foo" will
get all parameters that begin with "foo."). Note that all
parameters within the map must have the same type, otherwise
an rclcpp::ParameterTypeException will be thrown.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Fix style problems pointed out by uncrustify/cpplint.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Move tests for set_parameter_if_not_set/get_parameter map to rclcpp.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Rename get_parameter -> get_parameters.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Add in documentation from review.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* added new constructors for sync parameter client
* sync param client now has raw ptr member instead of shared ptr
* fixed pointer style
* allow objects which do not inherit from node to create a sync parameters client
* use signal safe synchronization with platform specific semaphores
Signed-off-by: William Woodall <william@osrfoundation.org>
* addressed feedback and refactored into separate files
Signed-off-by: William Woodall <william@osrfoundation.org>
* Apply suggestions from code review
Co-Authored-By: wjwwood <william+github@osrfoundation.org>
* include what you use (cpplint)
Signed-off-by: William Woodall <william@osrfoundation.org>
* avoid redundant use of SignalHandler::
Signed-off-by: William Woodall <william@osrfoundation.org>
* Update rclcpp/src/rclcpp/signal_handler.hpp
Co-Authored-By: wjwwood <william+github@osrfoundation.org>
* fix Windows build
Signed-off-by: William Woodall <william@osrfoundation.org>
* actually fix Windows
Signed-off-by: William Woodall <william@osrfoundation.org>
Resolves#595
* Separate the Node Time Source from the Node Clock
* Implement initial value checking of use_sim_time parameter parameter
* Be sure to update all newly attached clocks
* Homogenizing the behavior to use the last received value otherwise zero time when enabling sim time.
* Add virtual destructors to interface classes
* [WIP] Refactor signal handling.
* fix deadlock
Signed-off-by: William Woodall <william@osrfoundation.org>
* finished fixing signal handling and removing more global state
Signed-off-by: William Woodall <william@osrfoundation.org>
* add missing include of <condition_variable>
* use unordered map in signal handling class
Signed-off-by: William Woodall <william@osrfoundation.org>
* use consistent terminology
Signed-off-by: William Woodall <william@osrfoundation.org>
* use emplace in map
Signed-off-by: William Woodall <william@osrfoundation.org>
* avoid throwing in destructor
Signed-off-by: William Woodall <william@osrfoundation.org>
* words
Signed-off-by: William Woodall <william@osrfoundation.org>
* avoid throwing from destructors in a few places
Signed-off-by: William Woodall <william@osrfoundation.org>
* make install/uninstall thread-safe
Signed-off-by: William Woodall <william@osrfoundation.org>
* add wait_for_action_server() for action clients
Signed-off-by: William Woodall <william@osrfoundation.org>
* Handle negative timeouts in wait_for_service() and wait_for_action_server() methods.
* Fix uncrustify errors.
* Ignore take failure on services for connext
* refactor init to allow for non-global init
Signed-off-by: William Woodall <william@osrfoundation.org>
* Update rclcpp/include/rclcpp/utilities.hpp
Co-Authored-By: wjwwood <william+github@osrfoundation.org>
* Update rclcpp/include/rclcpp/utilities.hpp
Co-Authored-By: wjwwood <william+github@osrfoundation.org>
* Update rclcpp/include/rclcpp/utilities.hpp
Co-Authored-By: wjwwood <william+github@osrfoundation.org>
* Update rclcpp/src/rclcpp/utilities.cpp
Co-Authored-By: wjwwood <william+github@osrfoundation.org>
* refactor state into context objects and fix signal handling
Signed-off-by: William Woodall <william@osrfoundation.org>
* avoid nullptr access in error messages
Signed-off-by: William Woodall <william@osrfoundation.org>
* avoid exception in publish after shutdown was called
Signed-off-by: William Woodall <william@osrfoundation.org>
* fix missing and unused headers
Signed-off-by: William Woodall <william@osrfoundation.org>
* cpplint
Signed-off-by: William Woodall <william@osrfoundation.org>
* fixes found during testing
Signed-off-by: William Woodall <william@osrfoundation.org>
* address bug found in review comment
Signed-off-by: William Woodall <william@osrfoundation.org>
* fixes and warnings fixed during testing
Signed-off-by: William Woodall <william@osrfoundation.org>
* addressing review comments
Signed-off-by: William Woodall <william@osrfoundation.org>
* ensure new ExecutorArgs are used everywhere
* [rclcpp] Add class Waitable
Provides a virtual API for interacting with wait sets.
* [rclcpp] Add node interface for Waitables
* [rclcpp] Implement node interface for Waitables
* [rclcpp] Integrate Waitable entities with executor
* Implement remaining logic for integrating Waitables
* Add visibility macros and other refactoring to Waitable class
* Return zero size for entities in a Waitable by default
* Bugfix: Clear list of waitable handles
* Bugfix: update Waitable handle list based on readiness
* Bugfix: update for loop condition
* Give node a node_waitables_
* Give lifecycle node a node_waitables
Now the functions take an optional output index argument.
Refactored the graph listener usage of rcl_wait_set_add_guard_condition() to take advantage of the new API.
* issue a warning if publishing on a not active publisher
* Adding a logger private member in LifecyclePublisher for avoiding creating a new one echa call
* Providing logging macro signature that accepts std::string
* - RCLCPP_ prefix to macros Add
- New tests added
* - Added doc to the functions and macros
- Functions declared as RCLCPP_PUBLIC
* - Small typo in doc corrected
* Fixed error when compiling with clang
* touch up docs
This fixes the build on MacOS High Sierra and later, and
is the more correct thing to do anyway.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Don't auto-activate ROS time if clock topic is being published
* Destroy subscription when not needed, avoid re-creating it
* Additional tests
* Always reset pointer
* Initialise sub in initialiser list
* Implement get_parameter_or_set_default.
This is syntactic sugar to allow the user to get a parameter.
If the parameter is already set on the node, it gets the value
of the parameter. If it is not set, then it gets the alternative
value and sets it on the node, ensuring that it exists.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Review fixes (one sentence per line).
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Rename get_parameter_or_set_default -> get_parameter_or_set
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>