linorobot / linorobot2

Autonomous mobile robots (2WD, 4WD, Mecanum Drive)
Apache License 2.0
469 stars 160 forks source link

YDlidar driver error: name and namespace #27

Closed Russ76 closed 2 years ago

Russ76 commented 2 years ago

ubuntu@ubuntu:~$ ros2 launch ydlidar_ros2_driver ydlidar_launch.py [INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2022-04-11-19-57-04-174823-ubuntu-3782 [INFO] [launch]: Default logging verbosity is set to INFO Task exception was never retrieved future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py:226> exception=InvalidLaunchFileError('py')> Traceback (most recent call last): File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_file_utilities.py", line 53, in get_launch_description_from_any_launch_file return loader(launch_file_path) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_file_utilities.py", line 68, in get_launch_description_from_python_launch_file return getattr(launch_file_module, 'generate_launch_description')() File "/home/ubuntu/lino3_ws/install/ydlidar_ros2_driver/share/ydlidar_ros2_driver/launch/ydlidar_launch.py", line 38, in generate_launch_description driver_node = LifecycleNode(package='ydlidar_ros2_driver', TypeError: init() missing 2 required keyword-only arguments: 'name' and 'namespace'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event await self.process_event(next_event) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_service.py", line 248, in process_event visit_all_entities_and_collect_futures(entity, self.context)) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures sub_entities = entity.visit(context) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/action.py", line 108, in visit return self.execute(context) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/actions/include_launch_description.py", line 127, in execute launch_description = self.launch_description_source.get_launch_description(context) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_description_source.py", line 84, in get_launch_description self._get_launch_description(self.expanded_location) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_description_source.py", line 53, in _get_launch_description return get_launch_description_from_any_launch_file(location) File "/opt/ros/galactic/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_file_utilities.py", line 56, in get_launch_description_from_any_launch_file raise InvalidLaunchFileError(extension, likely_errors=exceptions) launch.invalid_launch_file_error.InvalidLaunchFileError: Caught exception when trying to load file of format [py]: init__() missing 2 required keyword-only arguments: 'name' and 'namespace' ubuntu@ubuntu:~$

This attempt was with screen and keyboard connected. Raspberry Pi and Ubuntu 20.04 This editor removed underlines around last "init"

Russ76 commented 2 years ago

Correction: The above was running the YDlidar by itself. With the whole Linorobot2 package launched, it started spinning! and: ubuntu@ubuntu:~$ ros2 topic list -v Published topics:

Subscribed topics:

Russ76 commented 2 years ago

Ros2 info:

ubuntu@ubuntu:~$ ros2 launch linorobot2_bringup bringup.launch.py [INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2022-04-11-20-14-13-925946-ubuntu-5805 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [ydlidar_ros2_driver_node-5]: process started with pid [5816] [INFO] [micro_ros_agent-1]: process started with pid [5808] [INFO] [ekf_node-2]: process started with pid [5810] [INFO] [joint_state_publisher-3]: process started with pid [5812] [INFO] [robot_state_publisher-4]: process started with pid [5814] [robot_state_publisher-4] Link base_link had 7 children [robot_state_publisher-4] Link camera_link had 1 children [robot_state_publisher-4] Link camera_depth_link had 0 children [robot_state_publisher-4] Link front_left_wheel_link had 0 children [robot_state_publisher-4] Link front_right_wheel_link had 0 children [robot_state_publisher-4] Link imu_link had 0 children [robot_state_publisher-4] Link laser had 0 children [robot_state_publisher-4] Link rear_left_wheel_link had 0 children [robot_state_publisher-4] Link rear_right_wheel_link had 0 children [robot_state_publisher-4] [INFO] [1649726056.923770212] [robot_state_publisher]: got segment base_footprint [robot_state_publisher-4] [INFO] [1649726056.924129580] [robot_state_publisher]: got segment base_link [robot_state_publisher-4] [INFO] [1649726056.924237394] [robot_state_publisher]: got segment camera_depth_link [robot_state_publisher-4] [INFO] [1649726056.924283671] [robot_state_publisher]: got segment camera_link [robot_state_publisher-4] [INFO] [1649726056.924324523] [robot_state_publisher]: got segment front_left_wheel_link [robot_state_publisher-4] [INFO] [1649726056.924365578] [robot_state_publisher]: got segment front_right_wheel_link [robot_state_publisher-4] [INFO] [1649726056.924403374] [robot_state_publisher]: got segment imu_link [robot_state_publisher-4] [INFO] [1649726056.924440078] [robot_state_publisher]: got segment laser [robot_state_publisher-4] [INFO] [1649726056.924473985] [robot_state_publisher]: got segment rear_left_wheel_link [robot_state_publisher-4] [INFO] [1649726056.924509670] [robot_state_publisher]: got segment rear_right_wheel_link [ydlidar_ros2_driver_node-5] [INFO] [1649726056.986647744] [ydlidar_ros2_driver_node]: [YDLIDAR INFO] Current ROS Driver Version: 1.0.1 [ydlidar_ros2_driver_node-5] [ydlidar_ros2_driver_node-5] YDLidar SDK initializing [ydlidar_ros2_driver_node-5] YDLidar SDK has been initialized [ydlidar_ros2_driver_node-5] [YDLIDAR]:SDK Version: 1.0.3 [micro_ros_agent-1] [1649726057.133761] info | TermiosAgentLinux.cpp | init | running... | fd: 3 [micro_ros_agent-1] [1649726057.135498] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4 [ydlidar_ros2_driver_node-5] LiDAR successfully connected [micro_ros_agent-1] [1649726057.150450] info | Root.cpp | create_client | create | client_key: 0x46821582, session_id: 0x81 [micro_ros_agent-1] [1649726057.152850] info | SessionManager.hpp | establish_session | session established | client_key: 0x46821582, address: 0 [micro_ros_agent-1] [1649726057.347843] info | ProxyClient.cpp | create_participant | participant created | client_key: 0x46821582, participant_id: 0x000(1) [micro_ros_agent-1] [1649726057.353867] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x46821582, topic_id: 0x000(2), participant_id: 0x000(1) [micro_ros_agent-1] [1649726057.357252] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x46821582, publisher_id: 0x000(3), participant_id: 0x000(1) [micro_ros_agent-1] [1649726057.369729] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x46821582, datawriter_id: 0x000(5), publisher_id: 0x000(3) [micro_ros_agent-1] [1649726057.371268] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x46821582, topic_id: 0x001(2), participant_id: 0x000(1) [micro_ros_agent-1] [1649726057.372513] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x46821582, publisher_id: 0x001(3), participant_id: 0x000(1) [micro_ros_agent-1] [1649726057.388316] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x46821582, datawriter_id: 0x001(5), publisher_id: 0x001(3) [micro_ros_agent-1] [1649726057.390186] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x46821582, topic_id: 0x002(2), participant_id: 0x000(1) [micro_ros_agent-1] [1649726057.392623] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x46821582, subscriber_id: 0x000(4), participant_id: 0x000(1) [micro_ros_agent-1] [1649726057.411384] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x46821582, datareader_id: 0x000(6), subscriber_id: 0x000(4) [ydlidar_ros2_driver_node-5] [YDLIDAR]:Lidar running correctly ! The health status: good [ydlidar_ros2_driver_node-5] [YDLIDAR] Connection established in [/dev/ttyUSB0][128000]: [ydlidar_ros2_driver_node-5] Firmware version: 1.10 [ydlidar_ros2_driver_node-5] Hardware version: 1 [ydlidar_ros2_driver_node-5] Model: X4 [ydlidar_ros2_driver_node-5] Serial: 2020062200002216 [ydlidar_ros2_driver_node-5] LiDAR init success! [ydlidar_ros2_driver_node-5] [YDLIDAR3]:Fixed Size: 1020 [ydlidar_ros2_driver_node-5] [YDLIDAR3]:Sample Rate: 5K [ydlidar_ros2_driver_node-5] [YDLIDAR INFO] Current Sampling Rate : 5K [ydlidar_ros2_driver_node-5] [YDLIDAR INFO] Now YDLIDAR is scanning ...... [joint_state_publisher-3] [INFO] [1649726062.038961050] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic...

Russ76 commented 2 years ago

I had to edit the Ydlidar params file, because it wanted to use ttyACM0 as well as the Teensy, and this caused a conflict. After Teensy is connected, Ydlidar uses /dev/ydlidar So I just inserted that info into params file, and poof- she works.

grassjelly commented 2 years ago

thanks for reporting the issue. Fixed here: https://github.com/linorobot/linorobot2/commit/f60961c1eba72c6fde1049f7cb41274cf4e7d04d closing this

Lucyliuwen commented 6 months ago

I still encountered this problem, but I didn't find a solution, so how can you solve it?

Lucyliuwen commented 6 months ago

thanks for reporting the issue. Fixed here: f60961c closing this

hello, I recheck the file attached by you, but it did not solve it.