Skip to content

Commit

Permalink
Merge pull request #110 from buptwjf/multi_robot_v1
Browse files Browse the repository at this point in the history
Multi-robot simulation demo v1
  • Loading branch information
kubeedge-bot authored Nov 1, 2022
2 parents 44337ee + f9cd3a5 commit fa193c9
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0"?>

<launch>

<arg name="room" default="cave" />
<arg name="launch_rviz" default="true" />
<arg name="launch_stage" default="true" />
<arg name="launch_map_server" default="true" />
<arg name="launch_multi_robot_route_planner" default="true" />
<arg name="launch_local_controller" default="true" />
<arg name="launch_local_controller_one_for_all" default="false" />
<arg name="nr_of_robots" default="3" />

<arg name="launch_graph_generator" default="true" />
<arg name="cfg" default="default" />
<arg name="launch_path_synchronizer" default="false" />
<arg name="load_segments" default="false" />
<arg name="map_name" default="" />
<arg name="update_rate_info" default="1.0" />

<!-- map server -->
<group if="$(arg launch_map_server)">
<include file="$(find tuw_multi_robot_demo)/launch/map_server.launch">
<arg name="room" value="$(arg room)" />
</include>
</group>

<!-- <group if="$(arg launch_stage)">
<include file="$(find tuw_multi_robot_demo)/launch/stage.launch">
<arg name="room" value="$(arg room)" />
</include>
</group> -->

<group if="$(arg launch_graph_generator)">
<group if="$(arg load_segments)">
<include file="$(find tuw_multi_robot_demo)/launch/graph_generator.launch">
<arg name="cfg" value="$(arg room)" />
<arg name="custom_graph_path" value="$(find tuw_multi_robot_demo)/cfg/graph/$(arg room)/cache/$(arg map_name)" />
</include>
</group>
<group unless="$(arg load_segments)">
<include file="$(find tuw_multi_robot_demo)/launch/graph_generator.launch">
<arg name="cfg" value="$(arg room)" />
</include>
</group>
</group>

<group if="$(arg launch_multi_robot_route_planner)">
<include file="$(find tuw_multi_robot_demo)/launch/multi_robot_route_planner.launch">
<arg name="cfg" value="$(arg cfg)" />
</include>
</group>

<!-- start rviz -->
<group if="$(arg launch_rviz)">
<include file="$(find tuw_multi_robot_demo)/launch/rviz.launch">
<arg name="cfg" value="$(arg room)"/>
</include>
</group>

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# enviroment core

ARG [email protected]
ARG ROOT_CONTAINER=$OWNER/${ROS_DISTRO}-enviroment-core

FROM ubuntu as intermediate

# install git
RUN apt-get update
RUN apt-get install -y git

# add credentials on build
ARG SSH_PRIVATE_KEY
RUN mkdir /root/.ssh/
RUN echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa

# Add git providers to known_hosts
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts

RUN git clone --branch master [email protected]:tuw-robotics/rosaria.git p3dx/src/rosaria
RUN git clone --branch master [email protected]:tuw-robotics/tuw_p3dx.git p3dx/src/tuw_p3dx

FROM $ROOT_CONTAINER
USER root

ENV PRJ_DIR=${MY_HOME}/projects/p3dx

RUN apt-get update && apt-get -y upgrade

# Install locale and set
RUN apt-get install -y iputils-ping bash-completion

COPY --chown=${MY_USER}:${MY_USER} --from=intermediate /p3dx ${PRJ_DIR}
COPY --chown=${MY_USER}:${MY_USER} --from=intermediate /root/.ssh ${MY_HOME}/.ssh

RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash; cd ${PRJ_DIR}/; rosdep update; rosdep install -i --from-path src --rosdistro noetic -y'
# ros-${ROS_DISTRO}-hokuyo-node
USER ${MY_USER}



RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash; cd ${PRJ_DIR}; catkin_make'
RUN echo 'source ${PRJ_DIR}/devel/setup.bash' >> ~/.bashrc
RUN echo 'roslaunch tuw_p3dx aria_twist.launch' >> ~/.bash_history
# clean apt
USER root
RUN rm -rf ${MY_HOME}/.ros
#RUN apt-get autoclean && apt-get autoremove && rm -rf /var/lib/apt/lists/*

USER ${MY_USER}
WORKDIR ${PRJ_DIR}
ENV HOME=${MY_HOME}
COPY --chown=${MY_USER}:${MY_USER} ./cloud.sh /
ENTRYPOINT ["/cloud.sh"]
CMD [/bin/bash]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
#script to run with a host network
#export ROS_MASTER_URI=http://$(hostname --ip-address):11311
#export ROS_HOSTNAME=$(hostname --ip-address)
# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
source "${PRJ_DIR}/devel/setup.bash"
roslaunch tuw_multi_robot_demo Cloud.launch room:=cave nr_of_robots:=3
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# enviroment core


ARG [email protected]
ARG ROOT_CONTAINER=$OWNER/${ROS_DISTRO}-enviroment-core

FROM ubuntu as intermediate

# install git
RUN apt-get update
RUN apt-get install -y git

# add credentials on build
ARG SSH_PRIVATE_KEY
RUN mkdir /root/.ssh/
RUN echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa

# Add git providers to known_hosts
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts

RUN git clone --branch master [email protected]:tuw-robotics/rosaria.git p3dx/src/rosaria
RUN git clone --branch master [email protected]:tuw-robotics/tuw_p3dx.git p3dx/src/tuw_p3dx

FROM $ROOT_CONTAINER
USER root

ENV PRJ_DIR=${MY_HOME}/projects/p3dx

RUN apt-get update && apt-get -y upgrade

# Install locale and set
RUN apt-get install -y iputils-ping bash-completion

COPY --chown=${MY_USER}:${MY_USER} --from=intermediate /p3dx ${PRJ_DIR}
COPY --chown=${MY_USER}:${MY_USER} --from=intermediate /root/.ssh ${MY_HOME}/.ssh

RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash; cd ${PRJ_DIR}/; rosdep update; rosdep install -i --from-path src --rosdistro noetic -y'
# ros-${ROS_DISTRO}-hokuyo-node
USER ${MY_USER}



RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash; cd ${PRJ_DIR}; catkin_make'
RUN echo 'source ${PRJ_DIR}/devel/setup.bash' >> ~/.bashrc
RUN echo 'roslaunch tuw_p3dx aria_twist.launch' >> ~/.bash_history
# clean apt
USER root
RUN rm -rf ${MY_HOME}/.ros
#RUN apt-get autoclean && apt-get autoremove && rm -rf /var/lib/apt/lists/*

USER ${MY_USER}
WORKDIR ${PRJ_DIR}
ENV HOME=${MY_HOME}
COPY --chown=${MY_USER}:${MY_USER} ./edge.sh /
ENTRYPOINT ["/edge.sh"]
CMD [/bin/bash]
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0"?>

<launch>

<arg name="room" default="cave" />
<arg name="launch_rviz" default="true" />
<arg name="launch_stage" default="true" />
<arg name="launch_map_server" default="true" />
<arg name="launch_multi_robot_route_planner" default="true" />
<arg name="launch_local_controller" default="true" />
<arg name="launch_local_controller_one_for_all" default="false" />
<arg name="nr_of_robots" default="3" />

<arg name="launch_graph_generator" default="true" />
<arg name="cfg" default="default" />
<arg name="launch_path_synchronizer" default="false" />
<arg name="load_segments" default="false" />
<arg name="map_name" default="" />
<arg name="update_rate_info" default="1.0" />


<group if="$(arg launch_stage)">
<include file="$(find tuw_multi_robot_demo)/launch/stage.launch">
<arg name="room" value="$(arg room)" />
</include>
</group>

<group if="$(arg launch_path_synchronizer)">
<include file="$(find tuw_multi_robot_demo)/launch/path_synchronizer.launch">
<arg name="cfg" value="$(arg cfg)" />
</include>
</group>

<group if="$(arg launch_local_controller)">
<group if="$(arg launch_local_controller_one_for_all)">
<include file="$(find tuw_multi_robot_demo)/launch/local_multi_robot_controller.launch">
<arg name="nr_of_robots" value="$(arg nr_of_robots)" />
<arg name="update_rate_info" value="$(arg update_rate_info)" />
<arg name="node_name" value="local_controller_one_for_all" />
</include>
</group>
<group unless="$(arg launch_local_controller_one_for_all)">
<include file="$(find tuw_multi_robot_demo)/launch/local_controller_recursive.launch">
<arg name="nr_of_robots" default="$(arg nr_of_robots)"/>
<arg name="robot_name_prefix" default="robot_"/>
</include>
</group>
</group>


</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
#script to run with a host network
#export ROS_MASTER_URI=http://$(hostname --ip-address):11311
#export ROS_HOSTNAME=$(hostname --ip-address)
# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
source "${PRJ_DIR}/devel/setup.bash"
roslaunch tuw_multi_robot_demo edge.launch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
## README

### Environment

**Cloud**:

- ubuntu 20.04
- ROS - neotic
- OpencCV 4.5

**Edge**

- ubuntu 20.04
- ROS - neotic

### Setup

**Step 1**: You should set the ROS host on the cloud and the edge, and install the relevant dependencies

**Cloud**

```
sudo apt install libdxflib-dev
sudo apt install ros-neotic-map-server
# ~/.bash add
export ROS_MASTER_URI=http://CLOUD_IP:11311
export ROS_HOSTNAME=CLOUD_HOSTNAME
export ROS_IP=CLOUD_IP
source ~/.bashrc
```

**Edge**

```
sudo apt install ros-neotic-stage-ros
# ~/.bash add
export ROS_MASTER_URI=http://EDGE_IP:11311
export ROS_HOSTNAME=EDGE_HOSTNAME
export ROS_IP=CLOUD_IPCD ..
source ~/.bashrc
```



### **Edge Install and Run**

```
cd edge_ws/
git clone --branch $ROS_VERSION [email protected]:tuw-robotics/tuw_geometry.git
git clone [email protected]:tuw-robotics/tuw_msgs.git
catkin_make
source devel/setup.bash
roslaunch tuw_multi_robot_demo edge.launch
```

**Step 2**: First run the edge node, and you will see three robots in the environment in the window, and the terminal displays that three robots have been successfully online.

**Edge_show**

![edge_show](images/edge_show.png)

**Edge ROS node**

![cloud_node](images/cloud_node-16669964198223.png)

### **Cloud Install and Run**

```
cd cloud_ws/
git clone --branch $ROS_VERSION [email protected]:tuw-robotics/tuw_geometry.git
git clone [email protected]:tuw-robotics/tuw_msgs.git
catkin_make
source devel/setup.bash
roslaunch tuw_multi_robot_demo Cloud.launch room:=cave nr_of_robots:=3
```

**Step 3**: Run the cloud node. At this time, you will see the rviz interface and generate the split path node. You can set the target point positions for the three robots in order.

**Cloud show**

![cloud_show](images/cloud_show.png)

**Cloud ROS node**

![cloud_node](images/cloud_node.png)

0 comments on commit fa193c9

Please sign in to comment.