So far I’m following without much trouble. But I cant so far see how you get from the information you can get from the shells to write " RCLCPP_INFO(this->get_logger(), “I heard: ‘%d’”, msg->pose.pose.position.x);
I mean, I understand how you get to:
“user:~$ ros2 interface show geometry_msgs/msg/PoseWithCovariance” which gives you:
# This represents a pose in free space with uncertainty.
Pose pose
# Row-major representation of the 6x6 covariance matrix
# The orientation parameters use a fixed-axis representation.
# In order, the parameters are:
# (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)
float64[36] covariance
But how do you go from that info to know that you have to type it “pose.pose.position.x”?
In the explanation you say one can see the whole Odometry message to understand how to access the info and give a link:
" So here, you can have a look at the whole structure of the Odometry message in order to better understand how to properly access the different levels of the message (which is shown in the code)."
But that link goes nowhere or it doesnt work for me at least.
I should also mention that I do have ros bridge running, all shells sourced, but if i issue "ros2 topic list i only get 2 topics. This is an issue others have mentioned in the forum. ( here) But apparently you guys have not yet found an official solution to the problem or made the necessary clarifications/changes.
I can see the topic if I issue: rostopic list tho. Is just the ros2 command doesnt get the whole list of topics?
If you issue : “ros2 topic echo /odom nav_msgs/msg/Odometry” as you suggest in the solution, from a ros2 sourced shell nothing happens or sometimes it throws the following message:
user:~$ ros2 topic echo /odom nav_msgs/msg/Odometry
Traceback (most recent call last):
File “/opt/ros/foxy/bin/ros2”, line 11, in
load_entry_point(‘ros2cli==0.9.7’, ‘console_scripts’, ‘ros2’)()
File “/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py”, line 67, in main
rc = extension.main(parser=parser, args=args)
File “/opt/ros/foxy/lib/python3.8/site-packages/ros2topic/command/topic.py”, line 41, in main
return extension.main(args=args)
File “/opt/ros/foxy/lib/python3.8/site-packages/ros2topic/verb/echo.py”, line 81, in main
return main(args)
File “/opt/ros/foxy/lib/python3.8/site-packages/ros2topic/verb/echo.py”, line 97, in main
message_type = get_message(args.message_type)
File “/opt/ros/foxy/lib/python3.8/site-packages/rosidl_runtime_py/utilities.py”, line 30, in get_message
raise ValueError(“Expected the full name of a message, got ‘{}’”.format(identifier))
ValueError: Expected the full name of a message, got ‘nav_msgs/msg/Odometry’
To summarize:
1.- Could you please explain/clarify how to get the proper information on how to access the different levels of the Odometry messages in order to write the code “msg->pose.pose.position.x”
2.- Could you explain/look into why even with sourced shells commands like “ros2 topic list” dont show all the topics? and why “ros2 topic echo /odom nav_msgs/msg/Odometry” doesnt work?
Granted being the absolute beginner i am i might have messed up something while trying to find a solution so please explain it considering im new to this. Thanks.
B