Commit graph

483 commits

Author SHA1 Message Date
dhood
e39201d6a5
Print warning if non-FQN namespace remapping passed (#248)
* More descriptive error messages

* Special error message when lexeme not found

* Output warning if ns remapping invalid

* Output warning is ns remapping is invalid but starts with /

* Add index to 'not found' error message

* Distinguish between NONE and EOF

* Firmer wording to avoid overlap in meaning
2018-06-04 14:40:32 -07:00
Shane Loretz
95b4147009
Initialize seq_data_type (#245) 2018-05-30 09:41:24 -07:00
anup-pem
5edf27b032 YAML parameter parser (#235)
* Implement a basic YAML based parameter parser for ros2 nodes

* Add README file

* Fix the issues after moving from rcutils_yaml_param_parser to rcl_yaml_param_parser

  - rename folders from rcutils_yaml_param_parser to rcl_yaml_param_parser
  - rename project, header guards and include statements from rcutils_yaml_param_parser to rcl_yaml_param_parser
  - move type declaration in separat file and namespace new structures
  - Fix the code review comments from Mikael

* Few minor changes

   - Changed "params" string to "ros__parameters"
   - Add -Wall, -Wextra and -Wpedantic falgs
   - Fix the compile warning with the new flags

* Fix the changes made in the design of C structure

  - Remove the node_namespaces entry in rcl_params_t
  - Change the type of num_nodes and num_params to size_t

* depend on libyaml_vendor (#236)

* Fix cmake setting standard(C and C++) and add byte_array in C struct

*   Remove C11 so that it defaults to C99

* [rcl_yaml_param_parser] fix export symbols (#237)

* add visibility macros

* remove unused macro

* Support for multi level node and parameter name spaces

* Additional fixes and cleanups

  - Support for string namespace seperator
  - Provide parameter structure init function API
  - name cleanups

* off by 1

* Call yaml_parser_delete()

* fclose(yaml_file)

* free() allocated paths

* Call yaml_event_delete()

* completely deallcoate string array

* Few cleanup changes

  - Add install command into CMakelists.txt
  - Replace one of the zero_allocate with reallocate
  - Pass allocator state
  - Fix int32_t -> rcl_ret_t return value

* Don't include unistd.h

* Use size_t for array indices

* Just pass the allocator in the init function
2018-05-29 18:07:02 +02:00
Michael Carroll
e8491ab8ab
Change #if to #ifdef. (#229)
Needed because you can't use preprocessor on undefined variables in
MISRA.
2018-05-01 17:25:24 -05:00
Shane Loretz
5142a8a4b4
rcl_node_init() copies node options passed into it (#231)
* Add rcl_remap_copy()
* Add rcl_arguments_coy()
* Add rcl_node_options_copy()
* Node copies options passed to it
2018-05-01 12:58:55 -07:00
Karsten Knese
fdd534e19e
Fix memory leak in test_arguments (#230)
valgrind was complaining about some lost memory here. 
The proposed change should fix it.
2018-04-30 09:41:41 -07:00
Shane Loretz
ff024ee9fd
Static remapping with url scheme (#227)
* DIRTY lexer with bugs rosservice: and rostopic:

* Fix bug with partial url schemes

* Style fixes

* Moved lexer.h to satisfy cpplint

* moved terminals to their own array to reduce code size

* Shrink lexer by using char, add error checking

* Comment/whitespace

* comment

* terminal -> lexeme where appropriate

* Static const global

* Documentation and argument order

* Add rcl_lexer_lookahead2_t

* Allow ignoring lexeme text

* Beginnings of recursive descent parser

* Add method to get current position in text

* new remap parsing passes unit tests

* Test rosservice:// and rostopic://

* fix movement formula comment

* doxygent comment

* move code to make pr diff easier to read

* Comments

* Comment

* Comment about impossibilities

* Set error message

* unsigned literals

* Add a couple more url scheme tests

* remove out of date comment

* end_pos -> length

* another token text

* Whitespace

* call accept -> accept

* use array instead of number suffix

* Missing return; wrong comment

* test methods at end of input

* Test not zero-initialized init

* Test lexing remapping rules

* Windows warning

* Remove const to avoid discarding during cast
2018-04-23 10:57:59 -07:00
Michael Carroll
c51f8925f4
Force rcl_arguments_t to be zero initialized. (#225)
* Force rcl_arguments_t to be zero initialized.
* Adds a check for rcl_arguments_t->impl to be NULL before use.
* Updates tests to account for zero initialization.
2018-04-11 12:42:20 -05:00
Dirk Thomas
d41c923927
update doc for rmw_get_node_names to mention potential null values (#214) 2018-03-30 10:56:42 -07:00
Michael Carroll
952c24f8a6
Remove ros arguments (#223)
* Make argument vector const array of const.

* Add remove_ros_arguments method.

* Mark rcl_arguments const where appropriate.
2018-03-27 14:54:05 -07:00
Michael Carroll
f2591483e5
Fix an issue with signed time difference. (#224)
* Fix an issue with signed time difference.
2018-03-26 12:10:37 -07:00
Dirk Thomas
bad0f55416
change export order for static linking (#216) 2018-03-22 16:26:33 -07:00
Shane Loretz
5fa1b0e0d9
CLI remapping followup (#221)
* Document graph functions don't remap

* Prettier if statements using rmw_validate_*

* all arguments on one line

* Whe -> The

* Check args for NULL

* Fix topic remap being interpretted as namespace remap
2018-03-21 15:05:30 -07:00
William Woodall
e48a445f46
Fix docs (#222)
* add missing documentation

* remove unnecessary visibility and warning macros
2018-03-20 10:16:04 -07:00
Shane Loretz
3628967496
Command line static remapping (#217)
Command line static remapping (ROS1 compatible syntax + nodename prefix)
2018-03-16 09:12:34 -07:00
Shane Loretz
7008a7d6e7
Add rcl_validate_topic_name_with_size (#220) 2018-03-15 16:38:57 -07:00
Shane Loretz
beee7c22ee Fix leak of ns_with_separators 2018-03-06 08:17:49 -08:00
Dirk Thomas
31079577b8
update style (#215) 2018-03-01 08:59:08 -08:00
Mikael Arguedas
0099999da3 advise to ask questions on ROS answers 2018-02-26 21:56:13 -08:00
dhood
e47f644faa
Store logger name associated with node (#212)
* Give node logger name

* Expose getter

* Workaround to fix non-const warning

* Add test for node logger name

* Move to function

* More test coverage

* comment fixup

* Restructure logger name logic

* Document input assumptions

* Don't hard-code logger name separator

* Remove const workaround
2018-02-26 14:36:25 -08:00
serge-nikulin
44801b398e change rcutils_time_point_value_t type from uint64_t to int64_t (#208) 2018-02-01 13:50:26 -08:00
jwang11
90f478eb1a Reset RMWCount when DEALLOC rmw storage of wait set (fix build issue) (#211)
It is safe to reset RMWCount when free RMWStorage

Signed-off-by: jwang <jing.j.wang@intel.com>
2018-01-23 09:36:45 -08:00
William Woodall
77321c62eb
Revert "Reset RMWCount when DEALLOC rmw storage of wait set (#209)" (#210)
This reverts commit 1d35c60c7b.
2018-01-23 01:04:38 -08:00
jwang11
1d35c60c7b Reset RMWCount when DEALLOC rmw storage of wait set (#209)
* Reset RMWCount when DEALLOC rmw storage of wait set

It is safe to reset RMWCount when free rmw storage of wait set

Signed-off-by: jwang <jing.j.wang@intel.com>

* setting RMWCount to 0 only when RMWStorage is set to NULL

Signed-off-by: jwang <jing.j.wang@intel.com>
2018-01-22 21:57:09 -08:00
jwang11
4ed6c56edd reset wait_set type index in SET_RESIZE (#207)
It is dangerous to keep type index float when do SET_RESIZE. It is
possible that index greater than new size. Thus, set index to 0.

Signed-off-by: jwang <jing.j.wang@intel.com>
2018-01-18 18:49:46 -08:00
jwang11
c09f6428d5 Remove the slash behind SET_CLEAR MACRO (#206)
In some case, extra slash may casue choas. Fix it anyway

Signed-off-by: jwang <jing.j.wang@intel.com>
2018-01-09 07:44:40 -08:00
Ethan Gao
34a4a728ab adapt to NULL removal from rmw result validation string (#193)
* adapt to NULL removal from rmw result valiation string

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* adapt to rmw validation change and update rcl topic validation

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* tweak the default error string returned

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* tweak error output format

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* fix build error

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>
2018-01-09 06:02:03 +11:00
Shane Loretz
0d6ec7728c
Clarify that rcl_take_response() populates request_header (#205)
* Document rcl_take_response() populates the header
2018-01-05 14:32:51 -08:00
Mikael Arguedas
1612845d36
remove now obsolete connext workaround (#203) 2017-12-15 12:16:22 +01:00
Ethan Gao
261a46772f segmentation fault for NULL dereference (#202)
* Invalid memory access for NULL dereference

rcl_lifecycle_get_state may return NULL

transition->goal is checked for NULL but no return
while it's true and this may result the follow-up
NULL dereference

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* Avoid crash while NULL returned from rcl_service_get_options()

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* tweak error string and null check for current_state

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>
2017-12-13 08:31:18 -08:00
Mikael Arguedas
b41d4e333e 0.4.0 2017-12-08 18:06:51 -08:00
Karsten Knese
f21880bb2c
do not deallocate state/transition pointer within the fini functions (#200) 2017-12-06 17:26:35 -08:00
dhood
5faf966459
Explain error getting RMW impl id was because not installed (#201)
* Explain error getting RMW impl id was because not installed

* just spaces around the / to make it easier to "parse"
2017-12-06 13:17:30 -08:00
dhood
f0975396d9
Fail if RMW_IMPLEMENTATION is set but doesn't match (#198)
* If RMW_IMPLEMENTATION is set, it must match
rmw_get_implementation_identifier

* Refactor so easier to read

* Add tests

* Use strdup from rcutils

* Don't assume retrieved rmw id is not null

* Add comment clarifying why a check is needed

* Fix long line in test

* Remove test that wouldn't work with multiple rmw impls

* warning -> error

* Check if test exists before setting properties

* Copyright year

* only build executable once

* hopefully fix tests for windows

* Check return code of rcl_init

* Remove another test that wasn't supposed to pass w/ multiple rmw impls

We aren't explicitly setting RMW_IMPLEMENTATION in the cmake for this test (unlike the others)

* Skip tests on windows because of https://github.com/ros2/launch/issues/66
2017-12-05 22:07:35 -08:00
Karsten Knese
c25d227ce9
remove const qualifier for transition states (#197)
* remove const qualifier for transition states

* remove unnecessary const_casts

* init and fini function for state and transition
2017-12-05 20:22:19 -08:00
Hunter Allen
77e6979d9f Add allocator parameter to rcl_X_is_valid functions (#180)
* Add allocator parameter to rcl_client_is_valid.

* Add allocator parameter to rcl_publisher_is_valid.

* Add allocator parameter to rcl_subscription_is_valid.

* Add allocator parameter to rcl_service_is_valid.

* Satisfy linter, and make error messages more consistent.

* Add calls to allocator check.

* Fixed macro calls.

* Change parameter name for clarity.

* Updated header parameter names.

* Resolve merge conflict after rebase.

* Address comments by @mikaelarguedas

* Linting

* add missing checks and homogenize error message

* non const allocator

* 'error msg allocator is invalid' -> 'allocator is invalid'

* missed one const

* cast to remove const without warnings
2017-12-04 14:35:29 -08:00
Dirk Thomas
8ce42c6768
Merge pull request #196 from ros2/check_if_test_exists_before_adding_properties
check if test exists before adding properties
2017-12-03 13:05:23 -08:00
Dirk Thomas
91fb0279b8 check if test exists before adding properties 2017-12-02 20:11:19 -08:00
Mikael Arguedas
d91af42f93
cmake 3.10 compatibility: pass absolute path to file(GENERATE) function (#195)
* cmake 3.10 compatibility: pass absolute path to file(GENERATE) function

* passing the right path to add_test is useful too
2017-12-02 18:56:09 -08:00
Mikael Arguedas
80e500b771
Waitset member allocation use rmw types (#190)
* allocate memory for rmw types and not rcl types in waitset RMW storage

* zero initialize memory on resize and clear

* add missing void * cast to make windows happy

* set mem after checking successful alloc and use right type for rmw storage

* another instance of cast to (rmw_ ## Type ## _t *) instead of (void *)
2017-11-28 15:01:22 -08:00
Mikael Arguedas
293aee7843
waitset -> wait_set (#191)
* waitset -> wait_set

* use wait set in doc
2017-11-27 13:30:11 -08:00
Mikael Arguedas
da4e5767c2
update service type support header name (#189) 2017-11-21 19:04:17 -08:00
dhood
7d0045adb8
Add debug logging (#187)
* use ROS_PACKAGE_NAME in debug msgs

* rcl_lifecycle too

* Swap unnamed macros to named

* Remove semicolon

* Add debug logging

* Timer debug logging

* Wait debug

* A bit less wait debug...

* Clearer time output

* Remove the wait sublogger

* Use conditional logging instead of the else{}

* Add 'X finalized' msg

* Add send_response logging

* Remove extra semicolons

* Add publish/take messages

* [style nitpick] formatted variables on the next line
2017-11-21 17:23:50 -08:00
dhood
9f92f8fa37
Switch rcl_lifecyle to ament_cmake_ros (#186) 2017-11-20 14:41:25 -08:00
Mikael Arguedas
d811463b99
Timer tests2 (#165)
* add timer test

* more tests

* another one just for fun

* uncrustify
2017-11-17 18:21:12 -08:00
Ethan Gao
54d06f5654 Str mem leak rebased (#185)
* * memory leak issues

address those memory leak issues with the API
rcutils_set_formatted_error which is defined
in rcutils

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* * Address those memory leak issues with new MACRO
add macro RCL_SET_ERROR_MSG_WITH_FORMAT_STRING which
is equals RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING and
fix the memory leak issues with it

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>

* address uncrustify grumble

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>
2017-11-16 23:25:02 -08:00
Mikael Arguedas
b40eff9b9e
use RCUTILS_SAFE_FWRITE_TO_STDERR (#184)
* use RCUTILS_SAFE_FWRITE_TO_STDERR

* include-what-you-use and not rely on rcl/error_handling to provide this macro
2017-11-16 18:17:45 -08:00
Tully Foote
c4bc5aceb9 Remove duration clock type and duration init and fini as they're now just a struct with a single element.
Fix missed time_source -> clock rename

Resolve const violation warning.
2017-11-16 17:28:00 -08:00
Tully Foote
9f3bdbf99e Implement custom allocators for clock.
Store the allocator for the rcl_clock inside the datastructure to not require passing it into the fini.
2017-11-16 17:28:00 -08:00
Tully Foote
7b26e19900 remove usage of time point init and fini that are unnecessary now
switch rcl_time_point_get_now to be rcl_clock_get_now
2017-11-16 17:28:00 -08:00