Task description


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 a 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.

ros_intro_task2.png

Used ROS2 Distribution: ROS 2 Humble Documentation

Files


ros2_ws.tar

Usage


In ros2_ws directory:

❯ colcon build --symlink-install
	Starting >>> my_message_package
	Finished <<< my_message_package [0.76s]                     
	Starting >>> my_signal_package
	Finished <<< my_signal_package [1.19s]          
	
	Summary: 2 packages finished [2.75s]

Depending on how you installed ROS2 (from source or binaries), and which platform you’re on, your exact source command will vary:

❯ source install/setup.bash

Execute ROS2 Launch:

❯ ros2 launch my_signal_package my_signal_package_launch.py
	[INFO] [launch]: Default logging verbosity is set to INFO
	[INFO] [generator-1]: process started with pid [10127]
	[INFO] [scaler-2]: process started with pid [10129]
	[INFO] [rqt_plot-3]: process started with pid [10131]

generator_params.yaml: