Przejdź do treści

Robotic Programming Environments: L5-L6

Introduction to ROS2

Task (0-20 points, 2 weeks)


Create a system in which the sinusoidal signal is generated in one component, and then it is scaled in another component. Visualize both signals.


Implement two ROS2 nodes that communicate with each other by topics. The first node is the generator that generates a sinusoidal signal and publishes it to the specified topic (for example /signal).

The second node should subscribe to the specified topic and receive the message with the signal value. The node should also modify the signal, for example scale it by specific value and publish it to another topic, for example /modified_signal.

During the evaluation, run simultaneously the ROS2 tools (for example rqt_plot) to visualize the signal from the specified topic.

Example structure of the system


  • The generator node should be parametrized with parameters placed in yaml file (generator_params.yaml). Parametrize the amplitude and frequency of the signal.
  • Parametrize also the second node. Put the parameters in separate yaml file.
  • Consider using the timer from rclpy (or rclcpp if you’re writing in C++) for publishing the messages with proper frequency.
  • Use proper message format that can be easily used with rqt_plot.
  • Create a ROS2 package and place all files inside the package.
  • Create a launcher (Python based launcher) that will start a node and load parameters from a file. The system should be started based on the following command
    ros2 launch package_name launcher_name