Skip to content

norman-nhan/Human-Following-Robot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Human-Following-Robot

Project for Practicum in ROS class

Acknowledgment (June 6, 2025)

This project was developed as part of the Practicum in ROS course. We would like to express our gratitude to the course instructors and the creators of the original course materials provided at Kyutech ROS Lecture 2025. Their resources formed the foundation of our work.

Special thanks to the following team members for their contributions:

  • Krisna Pinasthika (Student ID: 24899030)
  • Kanyarak Klaichit (Student ID: 24966067)
  • Mohsin Ali (Student ID: 24966066)
  • Killian Bertrand (Student ID: 25966055)
  • Tang Phu Thien Nhan (Student ID: 25966041)

We built upon and modified the provided class materials to complete this project, learning valuable skills in ROS development and collaborative robotics programming.


Lecture 4: State Machine, roslaunch2

1. Preparation

1.1 Downloading Exercise Materials and Package

Please access the links below to download the materials and exercise package.

1.2 Creating the Package

  • Terminal 1
    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Create package

      cd src/7_lectures/lecture04
      ros2 pkg create lecture04_pkg --build-type ament_python

1.2 Moving README.md and Python Scripts

Follow the instructions below to move the downloaded exercise package.

  • Extract the downloaded exercise package (lecture04_pkg.tar.gz).
  • Move the extracted exercise package (lecture04_pkg) to ~/ros2_lecture_ws/src/7_lectures.

1.3 Building the Package

Execute the following commands.

  • Terminal 1
    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Build the package

      colcon build --symlink-install

After the build is complete, exit the virtual environment (Ctrl+D).

2. State Machine (YASMIN: Yet Another State MachINe)

2.1 YASMIN

2.2 Running State Machine Sample 1

2.2.1 Execution Method

  • Terminal 1

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Launch Yasmin Viewer node

      ros2 run yasmin_viewer yasmin_viewer_node
  • Terminal 2

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Run sm_sample1 node

      source install/setup.bash
      ros2 run lecture04_pkg sm_sample1

2.3 Exercise Task (sm_exercise)

Let's add a HOGE state to the sm_sample1 state machine. Edit sm_exercise.py.

  • Return value "outcome3" → Transition to state "FOO"
  • Return value "outcome4" → Transition to state "BAR"

2.3.1 Execution Method

  • Terminal 1 (Skip if already done)

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Launch Yasmin Viewer node

      ros2 run yasmin_viewer yasmin_viewer_node
  • Terminal 2

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Run sm_exercise node

      source install/setup.bash
      ros2 run lecture04_pkg sm_exercise

2.4 Running State Machine Sample 2

2.4.1 Execution Method

  • Terminal 1 (Skip if already done)

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Launch Yasmin Viewer node

      ros2 run yasmin_viewer yasmin_viewer_node
  • Terminal 2

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Run sm_sample2 node

      source install/setup.bash
      ros2 run lecture04_pkg sm_sample2

3. Launch

This section requires lecture01_pkg and the TurtleBot3 hardware.

3.1 Running Launch File Sample

Let's run the talker and listener nodes from the first lecture using a launch file.

3.1.1 Execution Method

  • Terminal 1
    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Launch launch_sample1.launch.py

      source install/setup.bash
      ros2 launch lecture04_pkg launch_sample1.launch.py

3.2 Running Launch File Sample with TurtleBot3

From here, we will use TurtleBot3. Please prepare it.
Show something red to the camera mounted on the TURTLEBOT3 and try to control the robot.

3.2.1 Execution Method

  • Terminal 1

    • Time synchronization

      turtlebot3_mode
  • Terminal 2

    • Remote access to TurtleBot3

      ssh -YC turtle@192.168.11.2

      Password: turtlebot Note: The password will not be displayed when typing.

    • Launch the system

      ros2 launch ros2_lecture bringup.launch.py
  • Terminal 3

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Set ROS_DOMAIN_ID and TurtleBot3 environment variables

      . 4a_turtlebot3_settings.sh
    • Launch competition.launch.py

      source install/setup.bash
      . 4a_turtlebot3_settings.sh​
      ros2 launch lecture04_pkg launch_sample2.launch.py

      Access http://localhost:5000/

  • Terminal 4

    • Launch virtual environment, etc. (Skip if already done)

      cd ~/ros2_lecture_ws
      . 0_env.sh
      . /entrypoint.sh
    • Set ROS_DOMAIN_ID and TurtleBot3 environment variables

      . 4a_turtlebot3_settings.sh
    • Launch sm_main node

      source install/setup.bash
      . 4a_turtlebot3_settings.sh​
      ros2 run lecture04_pkg sm_main

      Click Enter to start the state machine.

About

Project for Practicum in ROS class

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages