-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from YuZhong-Chen/husky_sim
Workspace with Husky for Simulation and Real Robot Control
- Loading branch information
Showing
234 changed files
with
42,412 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* For reference, see https://aka.ms/devcontainer.json */ | ||
{ | ||
"name": "Husky Simulation", | ||
"dockerComposeFile": "../docker/compose.yaml", | ||
"service": "husky-ws", | ||
// Workspace settings | ||
"workspaceFolder": "/home/ros2-agv-essentials/husky_ws", | ||
// Vscode extensions | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-vscode.cpptools", | ||
"ms-vscode.cpptools-themes", | ||
"twxs.cmake", | ||
"donjayamanne.python-extension-pack", | ||
"eamodio.gitlens", | ||
"mhutchie.git-graph", | ||
"streetsidesoftware.code-spell-checker", | ||
"ms-iot.vscode-ros" | ||
] | ||
} | ||
}, | ||
// Lifecycle scripts | ||
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/postCreateCommand.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sudo apt-get update --fix-missing | ||
sudo rosdep update | ||
# Note: The following commands are commented out to prevent unintended install/builds. | ||
# sudo rosdep install --from-paths src --ignore-src --rosdistro humble -y | ||
# sudo chown -R user /home/ros2-agv-essentials/ | ||
# colcon build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.vscode | ||
|
||
# ROS2 basic directories | ||
/build | ||
/install | ||
/log | ||
|
||
# Gazebo cache | ||
docker/cache/* | ||
!docker/cache/.gazebo | ||
docker/cache/.gazebo/* | ||
!docker/cache/.gazebo/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# husky_ws | ||
|
||
This repository will help you configure the environment for Husky quickly. | ||
|
||
## 🌱 Structure 🌱 | ||
|
||
Here is the structure of this workspace: | ||
|
||
``` | ||
husky_ws | ||
├── .devcontainer | ||
├── docker | ||
├── figure | ||
├── install | ||
├── build | ||
├── log | ||
├── script | ||
| ├── husky-bringup.sh | ||
| ├── husky-generate.sh | ||
| └── husky-teleop.sh | ||
├── src | ||
| ├── husky | ||
| | ├── husky_base | ||
| | ├── husky_bringup | ||
| | ├── husky_control | ||
| | └── ... | ||
├── udev_rules | ||
| ├── 41-clearpath.rules | ||
| └── install_udev_rules.sh | ||
├── .gitignore | ||
└── README.md | ||
``` | ||
|
||
> ```build``` / ```install``` / ```log``` folders will appear once you've built the packages. | ||
## ✨ Introduction ✨ | ||
|
||
This repository has been derived from the Clearpath Husky's repository. [Here](https://github.com/husky/husky/tree/humble-devel) is the original repository. | ||
However, the original repository was designed for ROS1, and it is in the process of being upgraded to ROS2. | ||
|
||
Below are the main packages for Husky: | ||
|
||
- husky_base : Base configuration | ||
- husky_control : Control configuration | ||
- husky_description : Robot description (URDF) | ||
- husky_navigation : Navigation configuration | ||
- husky_gazebo : Simulate environment | ||
- husky_viz : Visualize data | ||
|
||
## 🚩 Testing 🚩 | ||
|
||
### Building packages | ||
|
||
Before attempting any examples, please remember to build the packages first. | ||
If you encounter any dependency errors, please use rosdep to resolve them. | ||
|
||
```bash | ||
cd /home/ros2-agv-essentials/husky_ws | ||
rosdep update | ||
rosdep install --from-paths src --ignore-src --rosdistro humble -y | ||
colcon build | ||
``` | ||
|
||
> After the build process, make sure to source the `install/setup.bash` file. | ||
> Otherwise, ROS2 will not locate the executable files. You can open a new terminal to accomplish this. | ||
### View the model | ||
|
||
```bash | ||
ros2 launch husky_viz view_model_launch.py | ||
``` | ||
|
||
<div align="center"> | ||
<a href="./"> | ||
<img src="./figure/view_model.png" width="80%"/> | ||
</a> | ||
</div> | ||
|
||
### Demonstration of SLAM. | ||
|
||
```bash | ||
ros2 launch husky_navigation slam_launch.py | ||
``` | ||
|
||
> Rendering the model may take some time, so please be patient ! | ||
<div align="center"> | ||
<a href="./"> | ||
<img src="./figure/SLAM_1.png" width="80%"/> | ||
<img src="./figure/SLAM_2.png" width="80%"/> | ||
</a> | ||
</div> | ||
|
||
### Control real robot | ||
|
||
> Before you proceed, please ensure that you've plugged the USB adapter of the Husky into the computer and mounted it into the container. (plugging in the USB adapter before creating the container is preferred but not required) | ||
```bash= | ||
# Move to the workspace, source .bashrc, and bringup husky. | ||
cd /home/ros2-agv-essentials/husky_ws | ||
source ~/.bashrc | ||
./script/husky-bringup.sh | ||
# (Optional) Open a new terminal & control the robot via keyboard teleoperation. | ||
./script/husky-teleop.sh | ||
``` | ||
|
||
## License | ||
|
||
To maintain reproducibility, we have frozen the following packages at specific commits. The licenses of these packages are listed below: | ||
|
||
* [husky/husky](https://github.com/husky/husky) (at commit 1e0b1d1, `humble-devel` branch) is released under the [BSD-3-Clause License](https://github.com/husky/husky/blob/noetic-devel/LICENSE). | ||
* [clearpathrobotics/LMS1xx](https://github.com/clearpathrobotics/LMS1xx) (at commit 90001ac, `humble-devel` branch) is released under the [LGPL License](https://github.com/clearpathrobotics/LMS1xx/blob/humble-devel/package.xml). | ||
* [osrf/citysim](https://github.com/osrf/citysim) (at commit 3928b08) is released under the [Apache-2.0 License](https://github.com/osrf/citysim/blob/master/LICENSE). | ||
* [clearpathrobotics/clearpath_computer_installer](https://github.com/clearpathrobotics/clearpath_computer_installer) (at commit 7e7f415) is released under the [BSD-3-Clause License](https://github.com/clearpathrobotics/clearpath_computer_installer/blob/main/LICENSE). | ||
* [clearpathrobotics/clearpath_robot/clearpath_robot/debian/udev](https://github.com/clearpathrobotics/clearpath_robot/blob/17d55f1b27d3fe19fb82e7df64dca96dbd345837/clearpath_robot/debian/udev) (at commit 17d55f1) is released under the [BSD 3-Clause License](https://github.com/clearpathrobotics/clearpath_robot/blob/17d55f1b27d3fe19fb82e7df64dca96dbd345837/LICENSE). | ||
|
||
Further changes based on the packages above are release under the [Apache-2.0 License](https://github.com/j3soon/ros2-essentials/blob/master/LICENSE), as stated in the repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Source global ROS2 environment | ||
source /opt/ros/$ROS_DISTRO/setup.bash | ||
# Source custom global environment | ||
source ~/ros2_ws/install/local_setup.bash | ||
# Source Clearpath environment | ||
# Note: The setup.bash file is created by the script "/usr/sbin/clearpath-robot-generate", | ||
# do not modify this file manually, as it will be overwritten. Try to modify the | ||
# "/etc/clearpath/robot.yaml" file instead, and then run the script again. | ||
source /etc/clearpath/setup.bash | ||
# Source workspace environment | ||
# Note: If you have not built your workspace yet, the following command will fail | ||
source $ROS2_WS/install/setup.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Base Image : https://hub.docker.com/r/arm64v8/ros/tags?page=1&name=humble | ||
FROM arm64v8/ros:humble AS arm64 | ||
# Base Image : https://hub.docker.com/r/osrf/ros/tags?page=1&name=humble | ||
FROM osrf/ros:humble-desktop-full AS amd64 | ||
|
||
# Use docker automatic platform args to select the base image. | ||
# It may be `arm64` or `amd64` depending on the platform. | ||
# Reference: | ||
# - https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope | ||
FROM $TARGETARCH | ||
|
||
LABEL org.opencontainers.image.authors="yuzhong1214@gmail.com" | ||
|
||
ARG TARGETARCH | ||
ARG USERNAME=user | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Create the user | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
# | ||
# [Optional] Add sudo support. Omit if you don't need to install software after connecting. | ||
&& apt-get update \ | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN apt-get update && apt-get upgrade -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN apt-get update && apt-get install -y python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ENV SHELL /bin/bash | ||
|
||
# ******************************************************** | ||
# * Anything else you want to do like clean up goes here * | ||
# ******************************************************** | ||
|
||
# Install common tools | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
git \ | ||
git-extras \ | ||
htop \ | ||
net-tools \ | ||
tmux \ | ||
vim \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN if [ "$TARGETARCH" = "amd64" ]; then \ | ||
apt-get update && apt-get install -y \ | ||
ros-$ROS_DISTRO-gazebo-ros-pkgs \ | ||
ros-$ROS_DISTRO-gazebo-ros2-control \ | ||
&& rm -rf /var/lib/apt/lists/*; \ | ||
fi | ||
|
||
# Install ROS2 packages | ||
RUN apt-get update && apt-get install -y \ | ||
ros-$ROS_DISTRO-rviz2 \ | ||
# | ||
# The packages below are used by the Husky repository. | ||
ros-$ROS_DISTRO-controller-manager \ | ||
ros-$ROS_DISTRO-diff-drive-controller \ | ||
ros-$ROS_DISTRO-joint-state-publisher \ | ||
ros-$ROS_DISTRO-joint-state-publisher-gui \ | ||
ros-$ROS_DISTRO-joint-state-broadcaster \ | ||
ros-$ROS_DISTRO-joint-trajectory-controller \ | ||
ros-$ROS_DISTRO-twist-mux \ | ||
ros-$ROS_DISTRO-urg-node \ | ||
ros-$ROS_DISTRO-interactive-marker-twist-server \ | ||
ros-$ROS_DISTRO-microstrain-inertial-driver \ | ||
ros-$ROS_DISTRO-velodyne-driver \ | ||
ros-$ROS_DISTRO-velodyne-pointcloud \ | ||
ros-$ROS_DISTRO-robot-upstart \ | ||
ros-$ROS_DISTRO-ros2-control \ | ||
ros-$ROS_DISTRO-robot-localization \ | ||
ros-$ROS_DISTRO-realsense2-description \ | ||
ros-$ROS_DISTRO-realsense2-camera \ | ||
ros-$ROS_DISTRO-navigation2 \ | ||
ros-$ROS_DISTRO-nav2-common \ | ||
ros-$ROS_DISTRO-nav2-bringup \ | ||
ros-$ROS_DISTRO-slam-toolbox \ | ||
ros-$ROS_DISTRO-imu-tools \ | ||
ros-$ROS_DISTRO-teleop-twist-keyboard \ | ||
&& sudo rm -rf /var/lib/apt/lists/* | ||
|
||
COPY .bashrc /home/$USERNAME/.bashrc | ||
|
||
# [Optional] Set the default user. Omit if you want to keep the default as root. | ||
USER $USERNAME | ||
CMD ["/bin/bash"] | ||
|
||
# Setup husky controller by the script. | ||
# Build certain packages from source for arm64. | ||
COPY script /home/$USERNAME/script | ||
RUN sudo apt-get update \ | ||
&& bash -ie /home/$USERNAME/script/install-clearpath-robot.sh \ | ||
&& sudo rm -rf /var/lib/apt/lists/* | ||
# Note: The script need to be run as user, not root. | ||
# Reference: https://github.com/clearpathrobotics/clearpath_computer_installer/tree/main | ||
COPY clearpath_computer_installer /home/$USERNAME/clearpath_computer_installer | ||
RUN sudo apt-get update \ | ||
&& bash -ie /home/$USERNAME/clearpath_computer_installer/clearpath_computer_installer.sh \ | ||
&& sudo rm -rf /var/lib/apt/lists/* | ||
# Setup udev rules. | ||
COPY udev_rules /home/$USERNAME/udev_rules | ||
RUN /home/$USERNAME/udev_rules/install_udev_rules.sh | ||
# Generate robot configuration files. | ||
RUN bash -ie /home/$USERNAME/script/husky-generate.sh |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2023, clearpathrobotics | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# clearpath_computer_installer | ||
|
||
Contains a script to set up a Clearpath robot computer for ROS 2 Humble. For full instructions visit https://docs.clearpathrobotics.com/docs/ros/installation/robot. | ||
|
||
This script includes setting of ROS 2 and Clearpath package servers, installing ROS 2 and Clearpath Robot packages and installing the Clearpath Robot Service. | ||
|
||
## Usage | ||
``` | ||
wget -c https://raw.githubusercontent.com/clearpathrobotics/clearpath_computer_installer/main/clearpath_computer_installer.sh && bash -e clearpath_computer_installer.sh | ||
``` |
Oops, something went wrong.