{"id":15047457,"url":"https://github.com/hamza-cpp/f1tenth_lab1_wc","last_synced_at":"2026-01-26T23:45:17.552Z","repository":{"id":236097052,"uuid":"791905750","full_name":"Hamza-cpp/f1tenth_lab1_wc","owner":"Hamza-cpp","description":"My workspace solution for F1TENTH course Lab 1: Docker and ROS 2","archived":false,"fork":false,"pushed_at":"2024-06-22T19:16:27.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T19:16:55.210Z","etag":null,"topics":["colcon","cpp14","f1tenth","python3","robotics","ros2"],"latest_commit_sha":null,"homepage":"https://f1tenth.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hamza-cpp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-25T15:44:48.000Z","updated_at":"2024-06-28T14:49:56.000Z","dependencies_parsed_at":"2024-04-30T23:39:53.103Z","dependency_job_id":null,"html_url":"https://github.com/Hamza-cpp/f1tenth_lab1_wc","commit_stats":null,"previous_names":["hamza-cpp/f1tenth_lab1_wc"],"tags_count":0,"template":false,"template_full_name":"f1tenth/f1tenth_lab1_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hamza-cpp%2Ff1tenth_lab1_wc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hamza-cpp%2Ff1tenth_lab1_wc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hamza-cpp%2Ff1tenth_lab1_wc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hamza-cpp%2Ff1tenth_lab1_wc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hamza-cpp","download_url":"https://codeload.github.com/Hamza-cpp/f1tenth_lab1_wc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239718425,"owners_count":19685725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["colcon","cpp14","f1tenth","python3","robotics","ros2"],"created_at":"2024-09-24T20:58:45.453Z","updated_at":"2025-12-29T01:30:17.297Z","avatar_url":"https://github.com/Hamza-cpp.png","language":"Python","readme":"# Lab 1: Intro to ROS 2\n\n## Learning Goals\n\n- Getting familiar with ROS 2 workflow\n- Understanding how to create nodes with publishers, subscribers\n- Understanding ROS 2 package structure, files, dependenciees\n- Creating launch files\n\n## Before you start\n\nIt's highly recommended to install Ubuntu natively on your machine for developement in simulation. However, if it's impossible for you to do so, you can still use the simulation inside Docker containers. In the following instructions, if you have Ubuntu installed natively, ignore directions for using Docker.\n\n## 1. Overview\n\nThe goal of this lab is to get you familiar with the ROS 2 workflow. You'll have the option to complete the coding segment of this assignment in either Python or C++. However, we highly recommend trying out both since this will be the easiest assignment to get started on a new language, and the workflow in these two languages are slightly different in ROS2 and it's beneficial to understand both.\n\nIn this lab, it'll be helpful to read these tutorials if you're stuck:\n\n[https://docs.ros.org/en/foxy/Tutorials.html](https://docs.ros.org/en/foxy/Tutorials.html)\n\n[https://roboticsbackend.com/category/ros2/](https://roboticsbackend.com/category/ros2/)\n\n## 2.1 Getting ready **(Native Ubuntu)**\n\nInstall ROS 2 following the instructions here: [https://docs.ros.org/en/foxy/Installation.html](https://docs.ros.org/en/foxy/Installation.html).\n\nNext, create a workspace:\n\n```bash\nmkdir -p ~/lab1_ws/src\ncd lab1_ws\ncolcon build\n```\n\nMove on to *Section 3* once you're done.\n\n## 2.2 Getting ready **(Docker)**\n\nIf you can't have Ubuntu installed natively, install Docker on your system following the instructions here: [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/). The documentation of Docker can be found [here](https://docs.docker.com/reference/).\n\nNext, start a container with a bind mount to your workspace directory on your host system inside this repo by:\n\n```bash\ndocker run -it -v \u003cabsolute_path_to_this_repo\u003e/lab1_ws/src/:/lab1_ws/src/ --name f1tenth_lab1 ros:foxy\n```\n\nThis will create a workspace directory on the host at `\u003cabsolute_path_to_this_repo\u003e/lab1_ws/src`. It'll create the container based on the official ROS 2 Foxy image, and give the container a name `f1tenth_lab1`. You'll then have access to a terminal inside the container.\n\n`tmux` is recommended when you're working inside a container. It could be installed in the container via: `apt update \u0026\u0026 apt install tmux`. `tmux` allows you to have multiple `bash` session in the same terminal window. This will be very convenient working inside containers. A quick reference on how to use tmux can be found [here](https://www.redhat.com/sysadmin/introduction-tmux-linux). You can start a session with `tmux`. Then you can call different `tmux` commands by pressing `ctrl+B` first and then the corresponding key. For example, to add a new window, press `ctrl+B` first and release and press `c` to create a new window. You can also move around with `ctrl+B` then `n` or `p`.\n\nA cheatsheet for the original tmux shortcut keys can be found [here](https://tmuxcheatsheet.com/). To know about how to change the configuration of tmux to make it more useable (for example, if you want to toggle the mouse mode on when you start a tmux bash session or change the shortcut keys), you can find a tutorial [here](https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/).\n\n## 3: ROS 2 Basics\n\nNow that we have the access to a ROS 2 environment, let's test out the basic ROS 2 commands. In the terminal, run:\n\n```bash\nsource /opt/ros/foxy/setup.bash\nros2 topic list\n```\n\nYou should see two topics listed:\n\n```bash\n/parameter_events\n/rosout\n```\n\nIf you need multiple terminals and you're inside a Docker container, use `tmux`.\n\n## 4: Creating a Package\n\n**Deliverable 1**: create a package named `lab1_pkg` in the workspace we created. The package needs to meet these criteria:\n\n- The package supports both `Python` and `C++`.\n- The package needs to have the `ackermann_msgs` dependency.\n- Both of these can be done by declaring the correct dependencies in `package.xml`.\n- If declared properly the depencies could be installed using `rosdep`.\n- Your package folder should be neat. You shouldn't have multiple 'src' folders or unnecessary 'install' or 'build' folders.\n\n## 5: Creating nodes with publishers and subscribers\n\n**Deliverable 2**: create two nodes in the package we just created. You can use either `Python` or `C++` for these nodes.\n\nThe first node will be named `talker.cpp` or `talker.py` and needs to meet these criteria:\n\n- `talker` listens to two ROS parameters `v` and `d`.\n- `talker` publishes an `AckermannDriveStamped` message with the `speed` field equal to the `v` parameter and `steering_angle` field equal to the `d` parameter, and to a topic named `drive`.\n- `talker` publishes as fast as possible.\n- To test node, set the two ROS parameters through command line, a launch file, or a yaml file.\n\nThe second node will be named `relay.cpp` or `relay.py` and needs to meet these criteria:\n\n- `relay` subscribes to the `drive` topic.\n- In the subscriber callback, take the speed and steering angle from the incoming message, multiply both by 3, and publish the new values via another `AckermannDriveStamped` message to a topic named `drive_relay`.\n\n## 6: Creating a launch file and a parameter file\n\n**Deliverable 3**: create a launch file `lab1_launch.py` that launches both of the nodes we've created. If you want, you could also set the parameter for the `talker` node in this launch file.\n\n## 7: ROS 2 commands\n\nAfter you've finished all the deliverables, launch the two nodes and test out these ROS 2 commands:\n\n```bash\nros2 topic list\nros2 topic info drive\nros2 topic echo drive\nros2 node list\nros2 node info talker\nros2 node info relay\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamza-cpp%2Ff1tenth_lab1_wc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhamza-cpp%2Ff1tenth_lab1_wc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamza-cpp%2Ff1tenth_lab1_wc/lists"}