Skip to content
Snippets Groups Projects
Commit 4a2cb408 authored by Patrick Simmel's avatar Patrick Simmel
Browse files

Add needed files

parent 82136c96
No related branches found
No related tags found
No related merge requests found
Showing
with 185 additions and 65 deletions
Makefile 0 → 100644
all: \
src/my_pkg \
set_my_ros_domain_id.sh
# generates a random ROS_DOMAIN_ID for simultaneous users on a machine
set_my_ros_domain_id.sh:
echo export ROS_DOMAIN_ID=$(shell seq 0 255 | shuf | head -1) > $@
src/my_pkg: | tb3.py
ros2 pkg create my_pkg \
--build-type ament_python \
--node-name tb3 \
--destination-directory src
ln -srf tb3.py src/my_pkg/my_pkg/tb3.py
colcon build --symlink-install
%/:
mkdir -p $@
clean:
$(RM) -r build install log src
$(RM) set_my_ros_domain_id.sh
# ros2_project
# Turtlebot3 ROS2 template
## Preparing ROS workspaces and environment variables
`rosenv` alias (example in `ros.sh`) which activates preinstalled `ros-base`, `gazebo-ros-pkgs`, and `turtlebot3` workspaces. If `ros.sh` is installed in `/etc/profile.d` then `ros.sh` will be automatically loaded everytime you open a terminal. Then you can type `rosenv` to activate the ROS environment in a new terminal.
## Getting started
Setting up your `ROS_DOMAIN_ID`, e.g., if multiple users are working on the same server. You can use `set_my_ros_domain_id.sh` for this. Generate a random id with `make set_my_ros_domain_id.sh`
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
# Setup
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
Open three terminal windows for:
## Add your files
1. running your ROS node
2. writing code
3. launching & monitoring Gazebo
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
### 1st window - running your ROS node
```
cd existing_repo
git remote add origin https://mygit.th-deg.de/ps16214/ros2_project.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://mygit.th-deg.de/ps16214/ros2_project/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
```sh
git clone https://mygit.th-deg.de/gaydos/tb3-ros2-template && cd tb3-ros2-template
make # creates a ROS package, builds it and links `tb3.py` to the file in `src/.../tb3.py` (creates a shortcut)
. ./set_my_ros_domain_id.sh # sets a random `ROS_DOMAIN_ID`. Useful when multiple users are working on the same server
. ./install/local_setup.sh # activate current workspace (you can also use `. ./load_workspace.sh`)
```
***
Then you can run your ROS node:
```sh
ros2 run my_pkg tb3 # (you can also use `./run.sh`)
```
# Editing this README
This should at least output:
```
waiting for messages...
```
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
If the robot is already brought up, then you should also get `LaserScan` messages:
```
F: 0.5624107122421265
R: 0.3894226849079132
...
```
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
### 2nd window - writing code
## Name
Choose a self-explaining name for your project.
Open `tb3.py` with your your favorite text editor, e.g., `vim`, `Visual Studio Code (Code OSS)`
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
### 3rd window - launching & monitoring Gazebo
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
```sh
rosenv
gazebo --verbose WORLD_FILE # the world file can be e.g., world.sdf
```
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
Should output:
```
Gazebo multi-robot simulator, ...
...
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
...
[Msg] Loading world file [/home/...]
...
```
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
And if you open a world with TB3 or add it manually:
```
[INFO] [1608802634.071946263] [gazebo_ros_node]: ROS was initialized without arguments.
...
```
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
After TB3 is instantiated, you should see `LaserScan` values in the first window
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Notes
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
- In Gazebo, use CTRL+r on Gazebo to restart the simulation. This way you do not have to close and open Gazebo
- use CTRL+C to kill a command line process, e.g., your ROS program or non-responsive Gazebo
- if you get the following error:
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
```
[Err] ... EXCEPTION: Unable to start server[bind: Address already in use]. There is probably another Gazebo process running.
```
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
then choose another port for Gazebo, e.g.:
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
```
$ GAZEBO_MASTER_URI=:12346 gazebo --verbose challenge_2.sdf
```
## License
For open source projects, say how it is licensed.
- if you do not use the simulation, then close Gazebo to leave the processor resources for others. If the system is slow, `htop` may show you the reason. `htop` shows who the active processes belong to and processor usage.
- you can kill a process with process id 12345 using `kill 12345`. The process id is shown in the `PID` column in `htop`.
- `make clean` removes all generated files which may help in case of an error
- `tools/` folder contain convenience scripts, e.g.,
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
- `stop-tb3.sh`: to stop the robot manually
- `tb3-teleop.sh`: teleoperation using keyboard
colcon
0
# generated from colcon_core/shell/template/command_prefix.sh.em
AMENT_PREFIX_PATH=/home/ps16214/py_pubsub/install/py_pubsub:/opt/ros/galactic-turtlebot3-quickstart:/opt/ros/galactic
CMAKE_PREFIX_PATH=/opt/ros/galactic-turtlebot3-quickstart:/opt/ros/galactic
COLCON=1
COLCON_PREFIX_PATH=/home/ps16214/py_pubsub/install:/opt/ros/galactic-turtlebot3-quickstart:/opt/ros/galactic
CONDA_EXE=/usr/bin/conda
CONDA_SHLVL=0
CUDA_PATH=/opt/cuda
CYCLONEDDS_URI=/share/cyclonedds-profile.xml
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/36945/bus
DISPLAY=localhost:25.0
GAZEBO_MASTER_URI=http://localhost:11345
GAZEBO_MODEL_DATABASE_URI=http://models.gazebosim.org
GAZEBO_MODEL_PATH=/usr/share/gazebo-11/models:/opt/ros/galactic/../galactic-turtlebot3-quickstart/share/turtlebot3_gazebo/models:
GAZEBO_PLUGIN_PATH=/usr/lib/gazebo-11/plugins:/opt/ros/galactic/../galactic-turtlebot3-quickstart/lib:
GAZEBO_RESOURCE_PATH=/usr/share/gazebo-11:/opt/ros/galactic/../galactic-turtlebot3-quickstart/share/turtlebot3_gazebo/worlds:
HG=/usr/bin/hg
HOME=/home/ps16214
LANG=en_US.UTF-8
LD_LIBRARY_PATH=/usr/lib/gazebo-11/plugins:/opt/ros/galactic-turtlebot3-quickstart/lib:/opt/ros/galactic/opt/yaml_cpp_vendor/lib:/opt/ros/galactic/opt/rviz_ogre_vendor/lib:/opt/ros/galactic/lib:/usr/lib/gazebo-11/plugins:
LOGNAME=ps16214
MAIL=/var/spool/mail/ps16214
MAKEFLAGS=
MAKELEVEL=1
MAKE_TERMERR=/dev/pts/21
MAKE_TERMOUT=/dev/pts/21
MFLAGS=
MKLROOT=/opt/intel/mkl
MOTD_SHOWN=pam
OGRE_RESOURCE_PATH=/usr/lib/OGRE
OLDPWD=/home/ps16214
PATH=/opt/ros/galactic-turtlebot3-quickstart/bin:/opt/ros/galactic/bin:/usr/condabin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/share/
PKG_CONFIG_PATH=/opt/ros/galactic-turtlebot3-quickstart/lib/pkgconfig:/opt/ros/galactic/lib/pkgconfig
PWD=/home/ps16214/tb3-ros2-template/build/my_pkg
PYTHONPATH=/home/ps16214/py_pubsub/install/py_pubsub/lib/python3.10/site-packages:/opt/ros/galactic-turtlebot3-quickstart/lib/python3.10/site-packages:/opt/ros/galactic/lib/python3.10/site-packages
ROS_DISTRO=galactic
ROS_DOMAIN_ID=55
ROS_LOCALHOST_ONLY=0
ROS_PYTHON_VERSION=3
ROS_VERSION=2
SHELL=/bin/bash
SHLVL=1
SSH_CLIENT=10.1.65.86 34906 22
SSH_CONNECTION=10.1.65.86 34906 195.37.232.77 22
SSH_TTY=/dev/pts/21
TERM=xterm-256color
TURTLEBOT3_MODEL=waffle_pi
USER=ps16214
XDG_RUNTIME_DIR=/run/user/36945
XDG_SESSION_CLASS=user
XDG_SESSION_ID=182
XDG_SESSION_TYPE=tty
_=/usr/bin/env
/home/ps16214/tb3-ros2-template/src/my_pkg/my_pkg
\ No newline at end of file
Metadata-Version: 2.1
Name: my-pkg
Version: 0.0.0
Summary: TODO: Package description
Home-page: UNKNOWN
Maintainer: ps16214
Maintainer-email: ps16214@todo.todo
License: TODO: License declaration
Platform: UNKNOWN
UNKNOWN
package.xml
setup.cfg
setup.py
my_pkg/__init__.py
my_pkg/tb3.py
my_pkg.egg-info/PKG-INFO
my_pkg.egg-info/SOURCES.txt
my_pkg.egg-info/dependency_links.txt
my_pkg.egg-info/entry_points.txt
my_pkg.egg-info/requires.txt
my_pkg.egg-info/top_level.txt
my_pkg.egg-info/zip-safe
resource/my_pkg
\ No newline at end of file
[console_scripts]
tb3 = my_pkg.tb3:main
setuptools
my_pkg
/home/ps16214/tb3-ros2-template/src/my_pkg/package.xml
\ No newline at end of file
/home/ps16214/tb3-ros2-template/src/my_pkg/resource/my_pkg
\ No newline at end of file
/home/ps16214/tb3-ros2-template/src/my_pkg/setup.cfg
\ No newline at end of file
/home/ps16214/tb3-ros2-template/src/my_pkg/setup.py
\ No newline at end of file
prepend-non-duplicate;PYTHONPATH;/home/ps16214/tb3-ros2-template/build/my_pkg
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment