diff --git a/docker2021.md b/docker2021.md new file mode 100644 index 0000000000000000000000000000000000000000..a2c9e3eea4b5c369a90aecdd7eb1ef8ff2b1d806 --- /dev/null +++ b/docker2021.md @@ -0,0 +1,40 @@ + +## System requirements + +OS: Ubuntu +App: docker, tmux + +## Step 1 + +create a new tmux session and several windows + +``` +bash setup_tmux.sh +``` + +## Step 2 + +attach the tmux session to the terminal + +``` +tmux a +``` +## Step 3 + +Switch to 2nd window (src/t_all.sh t2) + +Ctrl-b w + +Enter + +Switch to next window and run command (t3,t4,t5,t5a/t5a) + +## Step + +detach tmux session and return the terminal + +Ctrl-b d + +``` +bash close_tmux.sh +``` diff --git a/route_guidance_ros/requirements.txt b/route_guidance_ros/requirements.txt index 4226c03d297f03200f3495f378962a09c20a6f63..8a07e9b7a2b94c576397367790bf7053b8cfee6c 100644 --- a/route_guidance_ros/requirements.txt +++ b/route_guidance_ros/requirements.txt @@ -1,4 +1,5 @@ -pyrois==0.0.3 +pyrois==0.0.6 +pyRoIS-common==0.0.6 numpy termcolor transitions diff --git a/route_guidance_ros/scripts/service_app_with_eng_client.py b/route_guidance_ros/scripts/service_app_with_eng_client.py index 841e879fc7bcf5e46e2be759746aff293937ed8b..a9d68589622bdc230fa30635200fa67fff3334aa 100644 --- a/route_guidance_ros/scripts/service_app_with_eng_client.py +++ b/route_guidance_ros/scripts/service_app_with_eng_client.py @@ -2,7 +2,7 @@ from pyrois import RoIS_Service, RoIS_HRI from pyrois.RoIS_Common import Component_Status from pyrois.RoIS_Service import Completed_Status -import HRI_Engine_client_sample +from pyrois_common import HRI_Engine_client_sample import logging import queue @@ -127,10 +127,11 @@ class Service(HRI_Engine_client_sample.IF): self.get_parameter('urn:x-rois:def:HRIComponent:Kyutech:main:SystemInformation') self.Start() - print(self.state) + # print(self.state) # self.PLSuccess() # print(self.state) - + while True: + time.sleep(5) if __name__ == '__main__': service = Service() diff --git a/route_guidance_ros/scripts/setup_comp_servers.py b/route_guidance_ros/scripts/setup_comp_servers.py index 4db0b39a68119e438519e15e0cced6066baa1d45..0efc1434130dbbe5ee21f46b9e15825cf7670b70 100644 --- a/route_guidance_ros/scripts/setup_comp_servers.py +++ b/route_guidance_ros/scripts/setup_comp_servers.py @@ -65,7 +65,7 @@ def launch_components_and_subengines(**robot_port_table): ] process.append(SubprocessWrapper(command)) print("Person Localization Component Constructed.") - time.sleep(10) + # time.sleep(10) # for engine_port in robot_port_table.values(): # process.append(SubEngineWrapper(engine_port)) diff --git a/route_guidance_ros/scripts/setup_engines.py b/route_guidance_ros/scripts/setup_engines.py new file mode 100644 index 0000000000000000000000000000000000000000..eca75e5cb964db8e57c6063fa7c2cb59f4c55fc9 --- /dev/null +++ b/route_guidance_ros/scripts/setup_engines.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +from pyrois_common import HRI_Engine_sample + +HRI_Engine_sample.test_engine(8000,'engine_profile/engine_profile_gazebo', 'client_info_gazebo', None, None) diff --git a/run_docker_i.sh b/run_docker_i.sh index 90602d7e857453d69bb549d11df59272b0c44a15..e4bd62b39f05cbafb9d643b2abe9a54416694a96 100644 --- a/run_docker_i.sh +++ b/run_docker_i.sh @@ -2,4 +2,4 @@ xhost + docker run -it --rm --name sim --gpus all \ -e DISPLAY=$DISPLAY -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" \ --device /dev/snd -v "${PWD}:/root/src" \ - mysim:melodic bash /root/src/start_i.sh + mysim:melodic-1.0 bash /root/src/start_i.sh diff --git a/setup_tmux.sh b/setup_tmux.sh index a5c2181d60658bf8045295e8ae83c83abc482ce5..04ff4ac4ecf52c6d18851dad47c4f852921917ae 100644 --- a/setup_tmux.sh +++ b/setup_tmux.sh @@ -2,30 +2,32 @@ echo "launch gazebo" tmux new-session -d \; \ - send-keys "bash run_docker_i.sh" C-m\; + send-keys "bash run_docker_i.sh" C-m \; -sleep 5 +# sleep 5 echo "spawn a human" tmux new-window \; \ - send-keys "docker exec -it sim bash src/t2.sh" C-m \; + send-keys "docker exec -it sim bash src/t_all.sh t2" \; -sleep 5 +# sleep 5 echo "setup components" tmux new-window \; \ - send-keys "docker exec -it sim bash src/t3.sh" C-m \; + send-keys "docker exec -it sim bash src/t_all.sh t3" \; -sleep 15 -echo "run service app" +# sleep 15 +echo "run HRI engines" tmux new-window \; \ - send-keys "docker exec -it sim bash src/t4.sh" C-m \; + send-keys "docker exec -it sim bash src/t_all.sh t4" \; -sleep 15 -echo "operate the human" +# sleep 15 +echo "run SA" tmux new-window \; \ - send-keys "docker exec -it sim bash src/t5a.sh" C-m \; + send-keys "docker exec -it sim bash src/t_all.sh t5" \; -sleep 30 -echo "ask the robot to navigate" +# sleep 30 +echo "operate human to walk" tmux new-window \; \ - send-keys "docker exec -it sim bash src/t5o.sh" C-m \; -echo "finish script" \ No newline at end of file + send-keys "docker exec -it sim bash src/t_all.sh t5a" \; +echo "finish script" + +tmux a diff --git a/t3.sh b/t3.sh index f355409ed48189b4362c5c46b69e39c0fe25398c..bfcd1c2e658b1aabeb52ac1b2fbbd1e191809b4c 100644 --- a/t3.sh +++ b/t3.sh @@ -1,3 +1,4 @@ . devel/setup.bash roscd route_guidance_ros/scripts/ -python3 -c "import utilities;utilities.setup_single_robot();input('hit Enter key')" +# python3 -c "import utilities;utilities.setup_single_robot();input('hit Enter key')" +python3 -c "import setup_comp_servers;setup_comp_servers.setup_single_robot();input('hit Enter key')" diff --git a/t4.sh b/t4.sh index 3f7a522ee7ab472a6c6a5302195b38e85713004e..78a7296b86b74781ed9c310970d3fc2bafdd772e 100644 --- a/t4.sh +++ b/t4.sh @@ -1,3 +1,4 @@ . devel/setup.bash roscd route_guidance_ros/scripts/ -python3 service_app_lv2.py +# python3 service_app_lv2.py +python3 setup_engines.py \ No newline at end of file diff --git a/t5.sh b/t5.sh index 68a169a34aec3f6761d9da71faee5ba59a0f39c4..d7b31d92d4a07f51511e5a9ba5be2645aa641447 100644 --- a/t5.sh +++ b/t5.sh @@ -1,3 +1,5 @@ . devel/setup.bash -cd src -rosbag play -q gan_cmd01.bag \ No newline at end of file +# cd src +# rosbag play -q gan_cmd01.bag +roscd route_guidance_ros/scripts/ +python3 service_app_with_eng_client.py \ No newline at end of file diff --git a/t_all.sh b/t_all.sh new file mode 100644 index 0000000000000000000000000000000000000000..a04adaf61cf6abf8dbff6c54f380722c615c3f2c --- /dev/null +++ b/t_all.sh @@ -0,0 +1,27 @@ +source devel/setup.bash + +case $1 in + "t2" ) + roslaunch rois_gazebo spawn_human.launch + ;; + "t3" ) + roscd route_guidance_ros/scripts/ + python3 -c "import setup_comp_servers;setup_comp_servers.setup_single_robot();input('hit Enter key')" + ;; + "t4" ) + roscd route_guidance_ros/scripts/ + python3 setup_engines.py + ;; + "t5" ) + roscd route_guidance_ros/scripts/ + python3 service_app_with_eng_client.py + ;; + "t5a" ) + rostopic pub -1 human1/diff_drive_controller/cmd_vel geometry_msgs/Twist -- "[0,0,0]" "[0,0,-1]" + rostopic pub -1 human1/diff_drive_controller/cmd_vel geometry_msgs/Twist -- "[1,0,0]" "[0,0,0]" + rostopic pub -1 human1/diff_drive_controller/cmd_vel geometry_msgs/Twist -- "[1,0,0]" "[0,0,0]" + ;; + "t5o" ) + rostopic pub -1 robot1/detected_text std_msgs/String "data: 'point_a'" + ;; +esac \ No newline at end of file