Invalid type of message

Hi everyone
On ROS2 Navigation Advanced course, I get the next error when sending values to the /battery topic:

Thanks again

Hello @lfernandez,

that error when you run ros2 interface proto sensor_msgs/msg/BatteryState is strange.

When I run ros2 interface proto sensor_msgs/msg/BatteryState I get this output:

    sec: 0
    nanosec: 0
  frame_id: ''
voltage: 0.0
temperature: 0.0
current: 0.0
charge: 0.0
capacity: 0.0
design_capacity: 0.0
percentage: 0.0
power_supply_status: 0
power_supply_health: 0
power_supply_technology: 0
present: false
cell_voltage: []
cell_temperature: []
location: ''
serial_number: ''

What unit number and exercise number are you on?

What is the output if you run this command?:
ros2 interface list | grep Battery

Could you also please post the full error message, so I can be sure we are not missing any important information?



Hi @rzegers
Yes, it’s strange. I have a local installation and it works ok.

I’m on the 2nd unit, exercise 2.1

The error:

user:~/ros2_ws$ ros2 interface proto sensor_msgs/msg/BatteryState
Traceback (most recent call last):
  File "/opt/ros/galactic/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.13.3', 'console_scripts', 'ros2')()
  File "/opt/ros/galactic/lib/python3.8/site-packages/ros2cli/", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/galactic/lib/python3.8/site-packages/ros2interface/command/", line 35, in main
    return extension.main(args=args)
  File "/opt/ros/galactic/lib/python3.8/site-packages/ros2interface/verb/", line 33, in main
    yaml = interface_to_yaml(args.type)
  File "/opt/ros/galactic/lib/python3.8/site-packages/ros2interface/api/", line 54, in interface_to_yaml
    return message_to_yaml(instance)
  File "/opt/ros/galactic/lib/python3.8/site-packages/rosidl_runtime_py/", line 91, in message_to_yaml
  File "/opt/ros/galactic/lib/python3.8/site-packages/rosidl_runtime_py/", line 178, in message_to_ordereddict
    for field_name, field_type in zip(msg.__slots__, msg.SLOT_TYPES):
AttributeError: 'BatteryState' object has no attribute 'SLOT_TYPES'

The message output seems to be ok


Thanks again

Hi @lfernandez,

thanks for your feedback, at this point I am pretty confident that the error that you see is because of an issue on our side, not your side. I have executed the same command when in unit 1 and 3 of the course and it works ok. Only when in unit 2 there is this issue.
We are investigating what is wrong with unit 2.
I hope you are able to continue with the course and this does not affect your learning.

We will post here once we know what the issue is.

I apologize for the inconvenience and thank you for your patience,


1 Like

Definitely, that is an error in the installation of our system. We are correcting it now. It will be ready next week.

I apologize for the inconvenience

1 Like

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