tomasvr / turtlebot3_drlnav

A ROS2-based framework for TurtleBot3 DRL autonomous navigation
128 stars 18 forks source link

Issue with Setup #1

Closed pralgomathic closed 5 months ago

pralgomathic commented 1 year ago

I am getting this 'symbol lookup error', how to fix this, any idea?

[INFO] [launch]: All log files can be found below /home/mpscreutwo/.ros/log/2023-04-07-14-39-18-304048-mpsc-reu-two-162336 [INFO] [launch]: Default logging verbosity is set to INFO urdf_file_name : turtlebot3_burger.urdf [INFO] [gzserver-1]: process started with pid [162338] [INFO] [gzclient -2]: process started with pid [162340] [INFO] [robot_state_publisher-3]: process started with pid [162343] [robot_state_publisher-3] /opt/ros/foxy/lib/robot_state_publisher/robot_state_publisher: symbol lookup error: /opt/ros/foxy/lib/robot_state_publisher/robot_state_publisher: undefined symbol: _ZNK12class_loader11ClassLoader14getLibraryPathB5cxx11Ev [ERROR] [robot_state_publisher-3]: process has died [pid 162343, exit code 127, cmd '/opt/ros/foxy/lib/robot_state_publisher/robot_state_publisher /opt/ros/foxy/share/turtlebot3_description/urdf/turtlebot3_burger.urdf --ros-args -r __node:=robot_state_publisher --params-file /tmp/launch_params_ok9ke6m5']. [gzserver-1] X Error of failed request: BadValue (integer parameter out of range for operation) [gzserver-1] Major opcode of failed request: 151 (GLX) [gzserver-1] Minor opcode of failed request: 3 (X_GLXCreateContext) [gzserver-1] Value in failed request: 0x0 [gzserver-1] Serial number of failed request: 31 [gzserver-1] Current serial number in output stream: 32 [gzclient -2] X Error of failed request: BadValue (integer parameter out of range for operation) [gzclient -2] Major opcode of failed request: 151 (GLX) [gzclient -2] Minor opcode of failed request: 3 (X_GLXCreateContext) [gzclient -2] Value in failed request: 0x0 [gzclient -2] Serial number of failed request: 31 [gzclient -2] Current serial number in output stream: 32

tomasvr commented 1 year ago

Are you mixing ROS1 and ROS2 on your machine?

I believe this link might solve your problem:

https://github.com/ros/robot_state_publisher/issues/153

pralgomathic commented 1 year ago

Yes, I have both ROS noetic and Foxy installed. However, I sourced and changed the bash.rc to ROS2 foxy all the time I have been working on this project. I am not quite sure if it's the main issue.

Ok, I will try the solution you have suggested.

Also, do you have a working docker image for this setup that you can share? Thanks

loikun commented 1 year ago

I have no direct solution for this issue. However, having both noetic and foxy is possible. I have tested this project on an intel PC and in a parallels on mac where both version are installed. I had to skip sudo apt install python3-rosdep2. This command would remove most of noetic packages. Besides the rosdep utility coming from foxy and noetic (following installation instruction from ROBOTIS github) was working fine.

No issue except for:

tomasvr commented 1 year ago

Yes, I have both ROS noetic and Foxy installed. However, I sourced and changed the bash.rc to ROS2 foxy all the time I have been working on this project. I am not quite sure if it's the main issue.

Ok, I will try the solution you have suggested.

Also, do you have a working docker image for this setup that you can share? Thanks

I have never encountered this specific issue myself, I would suggest trying to run on a machine that has only ROS Foxy installed to see if that solves the issue.

I currently do not have a docker image but I will upload one once I have some time available.

tomasvr commented 1 year ago

Also, do you have a working docker image for this setup that you can share? Thanks

Docker image is now available as of 5004c00!

pralgomathic commented 1 year ago

thank you so much! I will have a look, My earlier issue was not resolved lately. However, I will try again.

Also, do you have a working docker image for this setup that you can share? Thanks

Docker image is now available as of 5004c00!

pralgomathic commented 1 year ago

@tomasvr could you please check why this error while building with docker?


oot@lychee-HP-ENVY-Desktop:/home/turtlebot3_drlnav# source install/setup.bash
root@lychee-HP-ENVY-Desktop:/home/turtlebot3_drlnav# ros2 launch turtlebot3_gazebo turtlebot3_drl_stage4.launch.py
[INFO] [launch]: All log files can be found below /root/.ros/log/2023-06-20-21-27-48-938938-lychee-HP-ENVY-Desktop-8225
[INFO] [launch]: Default logging verbosity is set to INFO
urdf_file_name : turtlebot3_burger.urdf
[INFO] [gzserver-1]: process started with pid [8227]
[INFO] [gzclient   -2]: process started with pid [8229]
[INFO] [robot_state_publisher-3]: process started with pid [8232]
[robot_state_publisher-3] [WARN] [1687296469.245881790] [robot_state_publisher]: No robot_description parameter, but command-line argument available.  Assuming argument is name of URDF file.  This backwards compatibility fallback will be removed in the future.
[robot_state_publisher-3] Parsing robot urdf xml string.
[robot_state_publisher-3] Link base_link had 5 children
[robot_state_publisher-3] Link caster_back_link had 0 children
[robot_state_publisher-3] Link imu_link had 0 children
[robot_state_publisher-3] Link base_scan had 0 children
[robot_state_publisher-3] Link wheel_left_link had 0 children
[robot_state_publisher-3] Link wheel_right_link had 0 children
[robot_state_publisher-3] [INFO] [1687296469.248088946] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-3] [INFO] [1687296469.248111439] [robot_state_publisher]: got segment base_link
[robot_state_publisher-3] [INFO] [1687296469.248124519] [robot_state_publisher]: got segment base_scan
[robot_state_publisher-3] [INFO] [1687296469.248134957] [robot_state_publisher]: got segment caster_back_link
[robot_state_publisher-3] [INFO] [1687296469.248144818] [robot_state_publisher]: got segment imu_link
[robot_state_publisher-3] [INFO] [1687296469.248154505] [robot_state_publisher]: got segment wheel_left_link
[robot_state_publisher-3] [INFO] [1687296469.248164216] [robot_state_publisher]: got segment wheel_right_link
[ERROR] [gzserver-1]: process has died [pid 8227, exit code 255, cmd 'gzserver /home/turtlebot3_drlnav/install/turtlebot3_gazebo/share/turtlebot3_gazebo/worlds/turtlebot3_drl_stage4/burger.model               --pause                                                       -s libgazebo_ros_init.so   -s libgazebo_ros_factory.so   -s libgazebo_ros_force_system.so       '].
[gzclient   -2] Conflicting gazebo versions
tomasvr commented 1 year ago

Do you have multiple versions of Gazebo installed? Could you post the output from: gazebo --version?

pralgomathic commented 1 year ago

My machine shows Gazebo version 11.13.0 (installed using sudo apt-get install gazebo11) Your docker container (turtlebot3_drlnav) shows Gazebo version 11.11.0

Do you have multiple versions of Gazebo installed? Could you post the output from: gazebo --version?

tomasvr commented 1 year ago

The Gazebo installation on your host machine should be irrelevant since Gazebo is running entirely from within the docker container and only the GUI is forwarded to the host. Unfortunately, I am unable to reproduce your error. I would suggest trying the docker container on a different machine and otherwise resort to the manual installation.

pralgomathic commented 1 year ago

What could be the reason the training is not running properly?

1.

lychee@lychee-HP-ENVY-Desktop:~$ ros2 launch turtlebot3_gazebo turtlebot3_drl_stage4.launch.py
[INFO] [launch]: All log files can be found below /home/lychee/.ros/log/2023-07-02-11-17-40-982133-lychee-HP-ENVY-Desktop-109587
[INFO] [launch]: Default logging verbosity is set to INFO
urdf_file_name : turtlebot3_burger.urdf
[INFO] [gzserver-1]: process started with pid [109589]
[INFO] [gzclient   -2]: process started with pid [109591]
[INFO] [robot_state_publisher-3]: process started with pid [109594]
[robot_state_publisher-3] [WARN] [1688311061.349736553] [robot_state_publisher]: No robot_description parameter, but command-line argument available.  Assuming argument is name of URDF file.  This backwards compatibility fallback will be removed in the future.
[robot_state_publisher-3] Parsing robot urdf xml string.
[robot_state_publisher-3] Link base_link had 5 children
[robot_state_publisher-3] Link caster_back_link had 0 children
[robot_state_publisher-3] Link imu_link had 0 children
[robot_state_publisher-3] Link base_scan had 0 children
[robot_state_publisher-3] Link wheel_left_link had 0 children
[robot_state_publisher-3] Link wheel_right_link had 0 children
[robot_state_publisher-3] [INFO] [1688311061.350993966] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-3] [INFO] [1688311061.351011063] [robot_state_publisher]: got segment base_link
[robot_state_publisher-3] [INFO] [1688311061.351016328] [robot_state_publisher]: got segment base_scan
[robot_state_publisher-3] [INFO] [1688311061.351020652] [robot_state_publisher]: got segment caster_back_link
[robot_state_publisher-3] [INFO] [1688311061.351025002] [robot_state_publisher]: got segment imu_link
[robot_state_publisher-3] [INFO] [1688311061.351029188] [robot_state_publisher]: got segment wheel_left_link
[robot_state_publisher-3] [INFO] [1688311061.351033568] [robot_state_publisher]: got segment wheel_right_link
[gzserver-1] Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring.
[gzserver-1] Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring.
[gzserver-1] [INFO] [1688311062.530128660] [turtlebot3_imu]: <initial_orientation_as_reference> is unset, using default value of false to comply with REP 145 (world as orientation reference)
[gzserver-1] [INFO] [1688311062.617154169] [turtlebot3_diff_drive]: Wheel pair 1 separation set to [0.160000m]
[gzserver-1] [INFO] [1688311062.617196622] [turtlebot3_diff_drive]: Wheel pair 1 diameter set to [0.066000m]
[gzserver-1] [INFO] [1688311062.618305841] [turtlebot3_diff_drive]: Subscribed to [/cmd_vel]
[gzserver-1] [INFO] [1688311062.618637642] [turtlebot3_diff_drive]: Advertise odometry on [/odom]
[gzserver-1] [INFO] [1688311062.619607164] [turtlebot3_diff_drive]: Publishing odom transforms between [odom] and [base_footprint]
[gzserver-1] [INFO] [1688311062.629731788] [turtlebot3_joint_state]: Going to publish joint [wheel_left_joint]
[gzserver-1] [INFO] [1688311062.629771851] [turtlebot3_joint_state]: Going to publish joint [wheel_right_joint]

2.
lychee@lychee-HP-ENVY-Desktop:~$ ros2 run turtlebot3_drl gazebo_goals
running on stage: 4, dynamic goals enabled: False
Init, goal pose: 0.5 0.0
3.
lychee@lychee-HP-ENVY-Desktop:~$ source /opt/ros/foxy/setup.bash
lychee@lychee-HP-ENVY-Desktop:~$ ros2 run turtlebot3_drl environment
running on stage: 4
4.
lychee@lychee-HP-ENVY-Desktop:~$ source /opt/ros/foxy/setup.bash
lychee@lychee-HP-ENVY-Desktop:~$ ros2 run turtlebot3_drl train_agent ddpg
gpu torch available:  True
device name:  NVIDIA GeForce GTX 1060 3GB
training on stage: 4
making new model dir: /home/lychee/turtlebot3_drlnav/src/turtlebot3_drl/model/lychee-HP-ENVY-Desktop/ddpg_6_stage_4
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
Waiting for new goal... (if persists: reset gazebo_goals node)
tomasvr commented 1 year ago

Did you try to reset the gazebo_goals node? It is best to run the gazbeo_goals node last so that a new goal is sent after the agent node is already running.

pralgomathic commented 12 months ago

Yes, it seems working but not always (goal nodes executing last). thanks

BTW, Do you have any plan to extend this project in terms of research?

pralgomathic commented 11 months ago

@tomasvr, could you give me an idea how you are detecting and avoiding the obstacle here? What specific method/function?

tomasvr commented 11 months ago

I currently do not have any plans to extend this research, although there are several potential future extensions such as fusing LiDAR with Camera data or more sophisticated obstacle detection.

Currently, the agent simply measures the distance to each obstacle and does not distinguish between static obstacles and moving obstacles. However, this should be possible in theory when stacking multiple scan frames, which is a feature that is also implemented currently. The avoidance is then simply handled by the neural network: distance reading too small -> avoid.

pralgomathic commented 11 months ago

I currently do not have any plans to extend this research, although there are several potential future extensions such as fusing LiDAR with Camera data or more sophisticated obstacle detection.

Currently, the agent simply measures the distance to each obstacle and does not distinguish between static obstacles and moving obstacles. However, this should be possible in theory when stacking multiple scan frames, which is a feature that is also implemented currently. The avoidance is then simply handled by the neural network: distance reading too small -> avoid.

Ok, thank you for the explanation. If we plan to implement a DWA based obstacle avoidance, where should we start from? Any suggestions on that?

tomasvr commented 11 months ago

In that case, you could probably leave most of the simulation and environment (except for the step_comm_callback function) nodes unchanged, and most work would be in the drl_agent node as presented in the image below. image

I am not very familiar with DWA, but if you want to use only DWA and no neural network you can simply replace the drl_agent code with your DWA implementation.

Alternatively, if you seek to develop a more sophisticated approach you could fuse DWA and machine learning. For example, you could have DWA generate several trajectories and use DRL in order to determine which specific trajectory to pick. To achieve this you could insert a DWA node in between the environment node and drl_agent node and use the generated trajectories as input for the neural network. DQN would probably be most suited for this where every output corresponds to one of the input trajectories.

This is just one idea and I would suggest exploring multiple options first by studying the literature.

pralgomathic commented 11 months ago

In that case, you could probably leave most of the simulation and environment (except for the step_comm_callback function) nodes unchanged, and most work would be in the drl_agent node as presented in the image below. image

I am not very familiar with DWA, but if you want to use only DWA and no neural network you can simply replace the drl_agent code with your DWA implementation.

Alternatively, if you seek to develop a more sophisticated approach you could fuse DWA and machine learning. For example, you could have DWA generate several trajectories and use DRL in order to determine which specific trajectory to pick. To achieve this you could insert a DWA node in between the environment node and drl_agent node and use the generated trajectories as input for the neural network. DQN would probably be most suited for this where every output corresponds to one of the input trajectories.

This is just one idea and I would suggest exploring multiple options first by studying the literature.

Well, that sounds good to me. Thank you for the pointer. I am basically looking into DWA + RL-based approach. A possible reference: https://arxiv.org/pdf/2010.14838.pdf