In this assignment, you will create a ROS node that both subscribes to a topic for input and publishes to a NEW topic as output. Here are the specifications for this new node:
Make sure you test this code thoroughly so you know that it works. You can test the odometry by running your node using ros2 run and test the entire assignment using ros2 launch and the launch file you provided.
Complete the Qualtrics survey containing:
ros2 launch <package> <launch_file>
6 points – Subscribes to turtlesim/sim pose topic
6 points – Publishes to specifications
18 points – Launch file and launcher script meet objectives
6 points – Tag applied in git
24 points – Answers given in survey (3 points per question)
Launch files have many powerful options, but some are a bit hidden. To make it easier for you, you can use some or all of this template for this assignment, filling in components as needed.
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription
from launch.actions import ExecuteProcess
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution, TextSubstitution
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
return LaunchDescription([
IncludeLaunchDescription(
PythonLaunchDescriptionSource([
PathJoinSubstitution([
FindPackageShare('<PACKAGE_NAME>'),
'<LAB1.2_LAUNCH_FILE_NAME>'
])
])
),
Node(
package='<PACKAGE_NAME>',
namespace='turtlesim1',
executable='<LAB1.3_NODE_NAME>',
name='<YOUR_CHOICE>'
),
ExecuteProcess(
cmd=[
'ros2',
'topic',
'echo',
'<TOPIC_NAME>',
'std_msgs/Float32'
],
shell=True,
output='screen'
)
])