본문 바로가기

LAB/ROS

ROS(4) Turtlebot machine learning(DQN)

728x90
반응형

 

 

https://emanual.robotis.com/docs/en/platform/turtlebot3/machine_learning/#set-state 

 

 

0. 초기 세팅

 

robotic emanual의 melodic, machine learning tutorial을 따라서 필요한 세팅을 완료한다. 

 

 

1. first terminal

 

if we have error ---------> cuda 12.1 install --------> pip3 install torch torchvision torchaudio ----------> sudo apt install python3-pip --------> sb ----------> catkin_make -----------> roslaunch turtlebot3_gazebo turtlebot3_stage_2.launch 

 

 

2. second terminal

 

 

roslaunch dqn_ttb turtlebot3_dqn_stage_1.launch 를 수행하면 실행됨을 알 수 있다. 

 

 

3. how to deal with errors

 

(1)

 

-> in my case, source /opt/ros/noetic/setup.bash and source /home/chae/catkin_ws/devel/setup.bash 

 

(2)

 

 

change 19, 16-18번 줄을 추가했으므로, 19번 줄을 주석처리하였다. 하고 나서 (1) 처럼 source 처리한다. 

 

(3) 

 

 

change the existed file, and change the directory root. CMakeList.txt 파일을 잘 수정하자. 

 

(4)

 

it's my mistake.. [1] just roslaunch turtle_dqn turtlebot3_dqn_stage_1.launch

[2] usr/bin/env : 'python' : No such file or directory --> sudo apy install python-is-python3

[3] ModuleNotFoundError --> just modify my code.. haha

[4] ModuleNotFoundError --> 'respawnGoal' -> '.respawnGoal'. If in a same directory, we need a '.'

[5] module 'numpy' has no attribute 'typeDict' --> pip install numpy==1.22

[6] IsADirectoryError --> just my mistake, modify respawnGoal.py(model path part)

[7] I tensorflow/tsl/cuda/cudart_stub.cc: 28] Could not find cuda drivers on your machine, GPU will not be used. --> i think this is because of my bashrc.. (I commented the cuda part kk) --> 알고보니 오류는 아니었고, 계속 기다리니 실행되었다. 

 

 

4. studying..

 

(1) the difference between stage1 and stage2

 

 

one is just grid environment, two, there are 4 white things.

 

(2) structure 

터미널 창에서 launch 파일을 실행한다. launch 파일 안에 main으로 실행되는 파이썬 파일을 불러오는 구문이 있으며, 이 py 파일은 nodes 폴더 안에 저장되어 있다. 또한 main.py에서 불러오는 다른 파이썬 파일들은 src/turtlebot3_dqn/ 안에 존재한다. 

catkin_ws/src/chaen_RL/src/turtle_dqn 안에 launch, nodes, src 폴더와 CMakeLists.txt, package.xml이 있다. 

 

 

 

 

 

 

728x90
반응형

'LAB > ROS' 카테고리의 다른 글

ROS(3) simple driving code  (0) 2024.02.01
ROS(2) Wall following algorithm python  (0) 2023.02.06
ROS(2-1) wall_following_robot 실행하기  (0) 2023.01.02
ROS(1) ROS 명령어 정리  (0) 2023.01.02