Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_and_remove_ros_arguments parse arguments two times #1412

Closed
iuhilnehc-ynos opened this issue Oct 20, 2020 · 3 comments · Fixed by #1415
Closed

init_and_remove_ros_arguments parse arguments two times #1412

iuhilnehc-ynos opened this issue Oct 20, 2020 · 3 comments · Fixed by #1415
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@iuhilnehc-ynos
Copy link
Collaborator

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

$ ros2 run demo_nodes_cpp listener --ros-args --log-level debug

Expected behavior

<...>
[DEBUG] [1603184568.251432332] [rcl]: Couldn't parse arg 0 (/home/sharedata/Linux/ROS2/docker_ros2_master/local_install/lib/demo_nodes_cpp/listener) as a remap rule in its deprecated form. Error: Expected lexeme type (19) not found, search ended at index 87, at /home/sharedata/Linux/ROS2/docker_ros2_master/src/ros2/rcl/rcl/src/rcl/lexer_lookahead.c:233
<...>

Actual behavior

<...>
[DEBUG] [1603184568.251432332] [rcl]: Couldn't parse arg 0 (/home/sharedata/Linux/ROS2/docker_ros2_master/local_install/lib/demo_nodes_cpp/listener) as a remap rule in its deprecated form. Error: Expected lexeme type (19) not found, search ended at index 87, at /home/sharedata/Linux/ROS2/docker_ros2_master/src/ros2/rcl/rcl/src/rcl/lexer_lookahead.c:233
<...>
[DEBUG] [1603184568.253581614] [rcl]: Couldn't parse arg 0 (/home/sharedata/Linux/ROS2/docker_ros2_master/local_install/lib/demo_nodes_cpp/listener) as a remap rule in its deprecated form. Error: Expected lexeme type (19) not found, search ended at index 87, at /home/sharedata/Linux/ROS2/docker_ros2_master/src/ros2/rcl/rcl/src/rcl/lexer_lookahead.c:233

Additional information

std::vector<std::string>
init_and_remove_ros_arguments(
int argc,
char const * const argv[],
const InitOptions & init_options)
{
init(argc, argv, init_options);
return remove_ros_arguments(argc, argv);
}

Fix: At

std::vector<std::string>
remove_ros_arguments(int argc, char const * const argv[])
, we need to check if get_global_default_context()->get_rcl_context() exist, and then decide to call rcl_parse_arguments or not.

@iuhilnehc-ynos
Copy link
Collaborator Author

@ivanpauno

Could you confirm whether this issue should be fixed or not?

@ivanpauno ivanpauno added enhancement New feature or request help wanted Extra attention is needed labels Oct 20, 2020
@ivanpauno
Copy link
Member

, we need to check if get_global_default_context()->get_rcl_context() exist, and then decide to call rcl_parse_arguments or not.

I'm not sure if that helps, as context init doesn't seem to have failed.

If you have a way of avoiding to parse the arguments twice without adding much complexity, I think that would be ok.

@iuhilnehc-ynos
Copy link
Collaborator Author

iuhilnehc-ynos commented Oct 21, 2020

I'm not sure if that helps, as context init doesn't seem to have failed.

Thank you for your response. That helped much.
I'll use another way to fix this issue, and I hope that it's not much complexity for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants