ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

lobby's profile - activity

2023-04-26 17:41:47 -0500 received badge  Student (source)
2023-04-26 10:08:42 -0500 marked best answer Error when execute 'ros2 topic echo /hello_ros2 ros1_msgs/MyMsg'

The ros1_msgs/MyMsg is my custom message type, The package directory path is ~/ros1_install/src/ros1_msgs. So I open a terminal, then source the relevant package path to environment by this order:

ubuntu@cscsh:~$ ros2 topic echo /hello_ros2 ros1_msgs/MyMsg

ros2: command not found

ubuntu@cscsh:~$ source /opt/ros/melodic/setup.bash 

ubuntu@cscsh:~$ source ~/ros1_install/devel/local_setup.bash(the install path of my custom message type package)

ubuntu@cscsh:~$ source /opt/ros/dashing/setup.bash 

ubuntu@cscsh:~$ source ~/ros2_ws/install/local_setup.bash(the source code path of my ros2) 

ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different     distributions.

Then i execute the command:

dbt@cscsh-dubingtao:~$ ros2 topic echo /hello_ros2 ros1_msgs/MyMsg

Traceback (most recent call last):
  File "/home/dbt/ros2_ws/install/ros2cli/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.7.0', 'console_scripts', 'ros2')()
  File "/home/dbt/ros2_ws/install/ros2cli/lib/python3.6/site-packages/ros2cli/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
  File "/home/dbt/ros2_ws/install/ros2topic/lib/python3.6/site-packages/ros2topic/command/topic.py", line 43, in main
    return extension.main(args=args)
  File "/home/dbt/ros2_ws/install/ros2topic/lib/python3.6/site-packages/ros2topic/verb/echo.py", line 69, in main
    return main(args)
  File "/home/dbt/ros2_ws/install/ros2topic/lib/python3.6/site-packages/ros2topic/verb/echo.py", line 79, in main
    node.node, args.topic_name, args.message_type, callback)
  File "/home/dbt/ros2_ws/install/ros2topic/lib/python3.6/site-packages/ros2topic/verb/echo.py", line 109, in subscriber
    msg_module, topic_name, callback, qos_profile_sensor_data)
  File "/home/dbt/ros2_ws/install/rclpy/lib/python3.6/site-packages/rclpy/node.py", line 1126, in create_subscription
    check_for_type_support(msg_type)
  File "/home/dbt/ros2_ws/install/rclpy/lib/python3.6/site-packages/rclpy/type_support.py", line 20, in check_for_type_support
    ts = msg_type.__class__._TYPE_SUPPORT
AttributeError: type object 'type' has no attribute '_TYPE_SUPPORT' This might be a ROS 1 message type but it should be a ROS 2 message type. Make sure to source your ROS 2 workspace after your ROS 1 workspace.

If i use the builtin message type, as i execute this command:

ros2 topic echo /hello_ros2 std_msgs/String

It work normally. so i check the PATH environment:

ubuntu@cscsh:~$ env | grep PYTHONPATH

/home/dbt/ros2_ws/install/ament_cppcheck/lib/python3.6/site-packages:/home/dbt/ros2_ws/install/ament_clang_tidy/lib/python3.6/site-packages:/home/dbt/ros2_ws/install/ament_clang_format/lib/python3.6/site-packages:/opt/ros/dashing/lib/python3.6/site-packages:/home/dbt/ros1_install/devel/lib/python2.7/dist-packages:/opt/ros/melodic/lib/python2.7/dist-packages

The output is not just like the above, I only showed a part, you can see that ros2 uses python3.6, ros1 uses 2.7+, I think the problem maybe related to the Python version inconsistency?

Does anyone know the reason of the error message? Appreciate.

2019-12-18 06:41:51 -0500 received badge  Famous Question (source)
2019-11-29 02:33:27 -0500 answered a question Could NOT find FastRTPS (missing: FastRTPS_INCLUDE_DIR FastRTPS_LIBRARIES)

Hi there, i encounted the same problem today, I saw your solution and solved my problem. Thanks. it's something miss

2019-11-28 09:52:16 -0500 received badge  Notable Question (source)
2019-11-28 09:52:16 -0500 received badge  Popular Question (source)
2019-10-28 09:36:08 -0500 asked a question Error when execute 'ros2 topic echo /hello_ros2 ros1_msgs/MyMsg'

Error when execute 'ros2 topic echo /hello_ros2 ros1_msgs/MyMsg' The ros1_msgs/MyMsg is my custom message type, The pack

2019-09-08 21:41:02 -0500 commented answer sudo apt install catkin not working.

good, it works. :)

2019-09-08 21:39:30 -0500 received badge  Supporter (source)