ROS2 Basics in 5 Days Gradebot Not subscribed to /odom

Hi,
after passing the check in the past, and as far as I can remember not touching the subscription, the subscription check fails.

[13:48:46][assess] Not subscribed to /odom. Let's get this sorted first.
Please check:
- Did you create a subscriber correctly to the topic /odom in your source code?
- Did you use the right node name? It should be topics_quiz_node

Relevant Output of ros2 topic info -v /odom when running the node myself:

Type: nav_msgs/msg/Odometry

Publisher count: 1
...

Subscription count: 1

Node name: topics_quiz_node

I have gone over the relevant posts I found in the forum, I can’t find a location where the package is not called ‘package_quiz’ or where the node is not called ‘topics_quiz_node’. The output of the topic info seems to confirm this to me.

How are you running the node? When the gradebot runs:

ros2 launch topics_quiz topics_quiz.launch.py

and then

ros2 topic info -v /odom

The output is something like:

Subscription count: 1

Node name: _NODE_NAME_UNKNOWN_
Node namespace: _NODE_NAMESPACE_UNKNOWN_
Topic type: nav_msgs/msg/Odometry
Endpoint type: SUBSCRIPTION
GID: 01.0f.2d.ef.42.03.a1.ae.01.00.00.00.00.00.12.04.00.00.00.00.00.00.00.00
QoS profile:
  Reliability: RELIABLE
  History (Depth): UNKNOWN
  Durability: VOLATILE
  Lifespan: Infinite
  Deadline: Infinite
  Liveliness: AUTOMATIC
  Liveliness lease duration: Infinite'

Check the node name specified in the launch file and setup.py

Thank you for your response. This is from a freshly restarted terminal:

user:~$ cd ros2_ws/
user:~/ros2_ws$ source /opt/ros/humble/setup.bash
user:~/ros2_ws$ colcon build --packages-select topics_quiz
Starting >>> topics_quiz
Finished <<< topics_quiz [2.02s]

Summary: 1 package finished [2.69s]
user:~/ros2_ws$ source ~/ros2_ws/install/setup.bash
user:~/ros2_ws$ ros2 launch topics_quiz topics_quiz.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2024-02-21-13-59-57-038451-3_xterm-7428
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [topics_quiz_node-1]: process started with pid [7429]
[topics_quiz_node-1] [INFO] [1708523998.015842550] [topics_quiz_node]: Step 1 COMPLETE
[topics_quiz_node-1] [INFO] [1708523998.016742578] [topics_quiz_node]: Step 2: Rotating neg: 170.94650375553155

The launch file:

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(
            package='topics_quiz',
            executable='topics_quiz_node',
            output='screen'),
    ])

The relevant sections of the setup.py:

from setuptools import setup
import os
from glob import glob

package_name = 'topics_quiz'

setup(
    name=package_name,
    version='0.0.0',
    packages=[package_name],
    data_files=[
        ('share/ament_index/resource_index/packages',
            ['resource/' + package_name]),
        ('share/' + package_name, ['package.xml']),
        (os.path.join('share', package_name), glob('launch/*.launch.py')),
    ],
    install_requires=['setuptools'],
    zip_safe=True,
    maintainer='user',
    maintainer_email='user@todo.todo',
    description='TODO: Package description',
    license='TODO: License declaration',
    tests_require=['pytest'],
    entry_points={
        'console_scripts': [
            'topics_quiz_node = topics_quiz.topics_quiz:main'
        ],
    },
)

From another freshly restarted terminal, while the node is running:

user:~$ source /opt/ros/humble/setup.bashuser:~$ ros2 topic info -v /odom
Type: nav_msgs/msg/Odometry
Publisher count: 1

Node name: turtlebot3_diff_drive
Node namespace: /
Topic type: nav_msgs/msg/Odometry
Endpoint type: PUBLISHER
GID: 01.0f.72.a1.08.01.67.aa.01.00.00.00.00.00.67.03.00.00.00.00.00.00.00.00
QoS profile:
  Reliability: RELIABLE
  History (Depth): UNKNOWN
  Durability: VOLATILE
  Lifespan: Infinite
  Deadline: Infinite
  Liveliness: AUTOMATIC
  Liveliness lease duration: Infinite

Subscription count: 1

Node name: topics_quiz_node

Maybe after staring at this for too long I am overlooking something, but to me the naming appears to be consistent.

Looks ok to me. Just one thing.

Make sure you kill anything running in the terminals before submitting it for grading.

I have added one more trial for you.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.