ailabspace / drl-based-mapless-crowd-navigation-with-perceived-risk

Deep Reinforcement Learning Based Crowd Navigation with Perceived Risk of the Moving Crowd for Mobile Robots
52 stars 7 forks source link

how to use with turtlebot3 #4

Open GXJll opened 6 months ago

GXJll commented 6 months ago

When using turtlebot3 for real car experiments, how to realize the communication between the car and the computer? Run the test code on the PC side, and run the site code on the car side? Will the two communicate with each other? Can anyone help me? I now have a turtlebot3 car and the training results have been trained, but I don't know how to implement the real car test

zerosansan commented 6 months ago

Hi. Yes, the two will communicate but you will have to set up the ROS_MASTER_URI and ROS_HOSTNAME for both the robot and the computer in your ~/.bashrc files and have them share the same ROS_MASTER_URI.

Example setup with Computer as the Master: (Replace IP address)

# Computer ~/.bashrc
export ROS_MASTER_URI=http://10.0.0.7:11311
export ROS_HOSTNAME=10.0.0.7

# Robot ~/.bashrc
export ROS_MASTER_URI=http://10.0.0.7:11311
export ROS_HOSTNAME=10.0.0.3

You can run the test code on either the PC side or the Car side. I'd recommend running it on the PC since it is usually more powerful than the turtlebot3's computer and then run turtlebot3_bringup.

Real-world testing (deployment)

# On the Turtlebot3:
Run roslaunch turtlebot3_bringup turtlebot3_robot.launch

# On the remote PC:
Run roscore
Run roslaunch turtlebot3_bringup turtlebot3_remote.launch
Run roslaunch turtlebot3_rl_sim start_td3_real_world_test.launch
GXJll commented 6 months ago

Thank you very much for your reply, but I have two more questions. In your code package, I couldn't find the turnlebot3'remote.launch file. Is it the launch file in the turnlebot3 open source code? In addition, I tried launching the turbobot3_remote.launch file in the open-source code of turbobot3, and then running the start_td3_real_world_test.launch file. However, the car did not move because the IP between the robot and the computer was not set, and communication was not established?

GXJll commented 6 months ago

Thank you very much for your reply, but I have two more questions. In your code package, I couldn't find the turnlebot3'remote.launch file. Is it the launch file in the turnlebot3 open source code? In addition, I tried launching the turbobot3_remote.launch file in the open-source code of turbobot3, and then running the start_td3_real_world_test.launch file. However, the car did not move because the IP between the robot and the computer was not set, and communication was not established?

电Y @.***

 

------------------ 原始邮件 ------------------ 发件人: "ailabspace/drl-based-mapless-crowd-navigation-with-perceived-risk" @.>; 发送时间: 2024年3月18日(星期一) 下午3:50 @.>; @.**@.>; 主题: Re: [ailabspace/drl-based-mapless-crowd-navigation-with-perceived-risk] how to use with turtlebot3 (Issue #4)

Hi. Yes, the two will communicate but you will have to set up the ROS_MASTER_URI and ROS_HOSTNAME for both the robot and the computer in your ~/.bashrc files and have them share the same ROS_MASTER_URI.

Example setup with Computer as the Master: (Replace IP address)

Computer ~/.bashrc export ROS_MASTER_URI=http://10.0.0.7:11311 export ROS_HOSTNAME=10.0.0.7 # Robot ~/.bashrc export ROS_MASTER_URI=http://10.0.0.7:11311 export ROS_HOSTNAME=10.0.0.3

You can run the test code on either the PC side or the Car side. I'd recommend running it on the PC since it is usually more powerful than the turtlebot3's computer and then run turtlebot3_bringup.

Real-world testing (deployment)

On the Turtlebot3: Run roslaunch turtlebot3_bringup turtlebot3_robot.launch # On the remote PC: Run roscore Run roslaunch turtlebot3_bringup turtlebot3_remote.launch Run roslaunch turtlebot3_rl_sim start_td3_real_world_test.launch

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zerosansan commented 6 months ago

You will have to install the following packages (turtlebot3, turtlebot3_gazebo). Then you should be able to find and run turtlebot3_remote.launch.

If the communication is not established, the computer cannot send drive commands to move the real robot. So, that should be established by setting up the same MASTER_ROS_URI for both the computer and the robot. I used this guide to set up and verify communication between different machines.

GXJll commented 6 months ago

Hello, one more question. In the example you gave me, # Computer ~/.bashrc. export ROS_MASTER_URI=http://10.0.0.7:11311 export ROS_HOSTNAME=10.0.0.7

Robot ~/.bashrc

export ROS_MASTER_URI=http://10.0.0.7:11311 export ROS_HOSTNAME=10.0.0.3, Is 10.0.0.7 the IP of the computer or the IP of the robot? I just tried it according to the IP of the computer, but I just felt that communication still hasn't been established. Its error report is like this in the picture, and then the robot doesn't move. In addition, there was another mistake before this. self.position.x was wrong. I changed it to self.position.position.x I don't know if this is the reason.

电Y @.***

 

------------------ 原始邮件 ------------------ 发件人: "ailabspace/drl-based-mapless-crowd-navigation-with-perceived-risk" @.>; 发送时间: 2024年3月18日(星期一) 下午3:50 @.>; @.**@.>; 主题: Re: [ailabspace/drl-based-mapless-crowd-navigation-with-perceived-risk] how to use with turtlebot3 (Issue #4)

Hi. Yes, the two will communicate but you will have to set up the ROS_MASTER_URI and ROS_HOSTNAME for both the robot and the computer in your ~/.bashrc files and have them share the same ROS_MASTER_URI.

Example setup with Computer as the Master: (Replace IP address)

Computer ~/.bashrc export ROS_MASTER_URI=http://10.0.0.7:11311 export ROS_HOSTNAME=10.0.0.7 # Robot ~/.bashrc export ROS_MASTER_URI=http://10.0.0.7:11311 export ROS_HOSTNAME=10.0.0.3

You can run the test code on either the PC side or the Car side. I'd recommend running it on the PC since it is usually more powerful than the turtlebot3's computer and then run turtlebot3_bringup.

Real-world testing (deployment)

On the Turtlebot3: Run roslaunch turtlebot3_bringup turtlebot3_robot.launch # On the remote PC: Run roscore Run roslaunch turtlebot3_bringup turtlebot3_remote.launch Run roslaunch turtlebot3_rl_sim start_td3_real_world_test.launch

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zerosansan commented 6 months ago

Yes, that will be the IP of the computer.

Some things to check, you can try to see if the two machines (Computer and Robot) can see each other by pinging from the computer to the robot, and then from the robot to the computer. Also, make sure the robot and the computer are connected to the same network.

Regarding that error, that could be stopping the robot from moving due to the typo.

GXJll commented 6 months ago

Thank you very much for your guidance. Now the car can finally move, but there are the following problems: I wonder if there is anything else that needs to be modified at the car end. Traceback (most recent call last): File "/home/gxj/drl-based-mapless-crowd-navigation-with-perceived-risk-main/src/turtlebot3_rl_sim/src/start_td3_real_world_test.py", line 131, in <module> observation, reward, done = env.step(_action, step + 1, mode="continuous") File "/home/gxj/drl-based-mapless-crowd-navigation-with-perceived-risk-main/src/turtlebot3_rl_sim/src/environment_stage_1_nobonus_realworld.py", line 903, in step state, done = self.get_state(data, step_counter, action) File "/home/gxj/drl-based-mapless-crowd-navigation-with-perceived-risk-main/src/turtlebot3_rl_sim/src/environment_stage_1_nobonus_realworld.py", line 218, in get_state scan_range = utils.get_scan_ranges(scan, self.scan_ranges, self.max_scan_range) File "/home/gxj/drl-based-mapless-crowd-navigation-with-perceived-risk-main/src/turtlebot3_rl_sim/src/utils.py", line 391, in get_scan_ranges if scan.ranges[i] == float('Inf') or scan.ranges[i] == float('inf'): IndexError: tuple index out of range

电Y @.***

 

------------------ 原始邮件 ------------------ 发件人: "ailabspace/drl-based-mapless-crowd-navigation-with-perceived-risk" @.>; 发送时间: 2024年3月18日(星期一) 晚上9:11 @.>; @.**@.>; 主题: Re: [ailabspace/drl-based-mapless-crowd-navigation-with-perceived-risk] how to use with turtlebot3 (Issue #4)

Yes, that will be the IP of the computer.

Some things to check, you can try to see if the two machines (Computer and Robot) can see each other by pinging from the computer to the robot, and then from the robot to the computer. Also, make sure the robot and the computer are connected to the same network.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>