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

AwooOOoo's profile - activity

2023-02-21 04:53:30 -0500 received badge  Great Question (source)
2022-09-20 23:41:22 -0500 received badge  Great Question (source)
2021-12-20 13:55:49 -0500 received badge  Good Question (source)
2021-04-01 14:14:33 -0500 received badge  Nice Question (source)
2020-07-17 10:30:24 -0500 marked best answer Why doesn't ros2 pkg list show the packages that I built?

Hi, I am making a new ros2 node, but it is not showing up in the package list (similar to Why doesn't ros2 pkg list show the packages that I built?, but I believe I've sourced things correctly). I first build the minimal_publisher and minimal_subscriber and this worked fine. I then copied the pendulum_msgs demo to build a custom message (obstacle_msgs) and this works fine. Lastly I wanted to create a new node (obstacle_publisher) which based off minimal_publisher and have it use the newly defined message, but its not getting installed for ros2 to find (the first 3 example are).

CMakeList.txt:

cmake_minimum_required(VERSION 3.5)
project(obstacle_publisher)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(obstacle_msgs REQUIRED)

include_directories("../dependencies/")

add_executable(obstacle_publisher obstaclePublisher.cpp obstacles.cpp)
ament_target_dependencies(obstacle_publisher rclcpp std_msgs obstacle_msgs)

install(TARGETS
  obstacle_publisher
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()

package.xml:

<?xml version="1.0"?>
<package format="2">
  <name>obstacle_publisher</name>
  <version>0.0.0</version>
  <description>The obstacle_publisher package</description>

  <maintainer email="paul">Paul</maintainer>
  <license>TODO</license>
  <!-- <author email="paul">Paul</author> -->

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>message_generation</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>obstacle_msgs</build_depend>

  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>

  <exec_depend>message_runtime</exec_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <exec_depend>obstacle_msgs</exec_depend>

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

If I remove all the build data

rm -r build/ install/ log/

and then remake the project

colcon build --symlink-install

I get the following;

Starting >>> obstacle_msgs
[0.221s] WARNING:colcon.colcon_ros.prefix_path.ament:The path 
'/home/paul/code/eclipse_ws/ROS2/install/obstacle_msgs' in the environment variable AMENT_PREFIX_PATH doesn't 
exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.ament:The path 
'/home/paul/code/eclipse_ws/ROS2/install/minimal_subscriber' in the environment variable AMENT_PREFIX_PATH 
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.ament:The path 
'/home/paul/code/eclipse_ws/ROS2/install/minimal_publisher' in the environment variable AMENT_PREFIX_PATH 
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path 
'/home/paul/code/eclipse_ws/ROS2/install/obstacle_publisher' in the environment variable CMAKE_PREFIX_PATH 
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path 
'/home/paul/code/eclipse_ws/ROS2/install/obstacle_msgs' in the environment variable CMAKE_PREFIX_PATH doesn't 
exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path 
'/home/paul/code/eclipse_ws/ROS2/install/minimal_subscriber' in the environment variable CMAKE_PREFIX_PATH 
doesn't exist
[0.221s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path 
'/home/paul/code/eclipse_ws/ROS2/install/minimal_publisher' in the environment variable CMAKE_PREFIX_PATH 
doesn't exist
Starting >>> minimal_publisher
Starting >>> minimal_subscriber
Finished <<< minimal_publisher [4.67s]                                                             
Finished <<< minimal_subscriber [4.77s]                               
Finished <<< obstacle_msgs [7.55s]                       
Starting >>> obstacle_publisher
--- stderr: obstacle_publisher                               
CMake Warning:
  Manually-specified variables were not used by the project:

    CATKIN_INSTALL_INTO_PREFIX_ROOT


---
Finished <<< obstacle_publisher [4.60s]

Summary: 4 packages finished [12.3s]
  1 package had stderr output: obstacle_publisher

If I rebuild again ... (more)

2020-06-12 06:20:17 -0500 received badge  Good Question (source)
2020-04-20 19:46:55 -0500 received badge  Nice Question (source)
2020-03-19 02:40:38 -0500 received badge  Student (source)
2020-03-02 13:01:54 -0500 marked best answer ros2 run - symbol not found on custom msg

Hi, I've defined a custom message as described below.

Obstacle.msg:

geometry_msgs/Point32 polygon
float32 size_uncertainty
uint8 obstacle_class

..and the msg and associated publisher that uses it compiles just fine.

When I go to execute the node, the wheels fall off:

$ ros2 run obstacle_publisher obstacle_publisher
    /home/paul/code/eclipse_ws/ROS2/install/obstacle_publisher/lib/obstacle_publisher/obstacle_publisher: symbol lookup error: 
    /home/paul/code/eclipse_ws/ROS2/install/obstacle_msgs/lib/libobstacle_msgs__rosidl_typesupport_fastrtps_cpp.so: 
    undefined symbol: _ZN13geometry_msgs3msg24typesupport_fastrtps_cpp27max_serialized_size_Point32ERbm

I have std_msgs and geometry_msgs set with depend in the package.xml of both the package that creates the message (obstacle_msgs) and the package that uses the message (obstacle_publisher).

Any pointers would be appreciated.

Sincerely, Paul.

2020-01-02 02:52:08 -0500 received badge  Famous Question (source)
2019-09-20 17:59:40 -0500 received badge  Famous Question (source)
2019-08-28 03:25:51 -0500 received badge  Famous Question (source)
2019-08-19 05:46:32 -0500 received badge  Famous Question (source)
2019-08-14 06:37:18 -0500 received badge  Notable Question (source)
2019-08-14 06:37:18 -0500 received badge  Popular Question (source)
2019-07-12 06:58:20 -0500 received badge  Notable Question (source)
2019-07-02 04:38:39 -0500 received badge  Enthusiast
2019-06-27 11:01:17 -0500 received badge  Notable Question (source)
2019-06-25 03:56:33 -0500 commented question Could not determine the type for the passed topic

I'm publishing to topic /position/gnss which is simply a NavSatFix message...

2019-06-25 03:55:59 -0500 answered a question Could not determine the type for the passed topic

I'm publishing to topic /position/gnss which is simply a NavSatFix message...

2019-06-24 16:38:24 -0500 received badge  Popular Question (source)
2019-06-19 09:46:18 -0500 asked a question Could not determine the type for the passed topic

Could not determine the type for the passed topic Hi, I have a node that subscribes to one topic and publishes to an

2019-06-18 08:39:56 -0500 received badge  Notable Question (source)
2019-06-18 08:28:08 -0500 marked best answer std_msgs/sensors_msgs does not name a type

Hi, I have a project with 2 files a main .cpp and a .hpp. The .cpp includes

#include "sensor_msgs/msg/nav_sat_fix.h"

and declares a variable

sensor_msgs::msg::NavSatFix n;

and this works just fine.

When I try to do the same thing by including sensor message in the .hpp file I get a colcon message stating that sensor_msgs does not name a type, even though I declared it identically to the .cpp reference.

My package.xml depends on sensor_msgs and my CMakeLists.txt finds sensor_msgs is listed as one of the ament_target_dependencies. The same thing happens if I include a std_msg in the .hpp section so I assume its some path missing somewhere, but I'm not sure why it works for the .cpp and not the .hpp.

UPDATE: Here is a simplified mini-project to show the issue I'm having

CMakeList.txt:

cmake_minimum_required(VERSION 3.5)
project(testing)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)


include_directories("../dependencies/")

add_executable(${PROJECT_NAME} a.cpp)
ament_target_dependencies(${PROJECT_NAME} rclcpp std_msgs sensor_msgs obstacle_msgs)


install(TARGETS
  ${PROJECT_NAME}
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()

package.xml:

<?xml version="1.0"?>
<package format="2">
  <name>testing</name>
  <version>0.0.0</version>
  <description>blah blah blah</description>

  <maintainer email="paul@somewhere.com">Paul</maintainer>
  <license>TODO</license>
  <!-- <author email="paul">Paul</author> -->

  <buildtool_depend>ament_cmake</buildtool_depend>
  <depend>rclcpp</depend>
  <depend>std_msgs</depend>
  <depend>sensor_msgs</depend>

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->
    <build_type>ament_cmake</build_type>
  </export>
</package>

a.cpp:

#include "b.hpp"

int main()
{
    B *b = new B();

    return 0;
}

b.hpp:

#ifndef SRC_TEST_B_HPP_
#define SRC_TEST_B_HPP_

#include "sensor_msgs/msg/nav_sat_fix.h"

class B {
public:
    sensor_msgs::msg::NavSatFix getPoly() { return m_polygon; }
private:
    sensor_msgs::msg::NavSatFix m_polygon;
};

#endif /* SRC_TEST_B_HPP_ */

Compiling output:

In file included from /home/paul/code/eclipse_ws/ROS2/src/testing/a.cpp:1:0:
/home/paul/code/eclipse_ws/ROS2/src/testing/b.hpp:8:2: error: ‘sensor_msgs’ does not name a type
  sensor_msgs::msg::NavSatFix getPoly() { return m_polygon; }
  ^~~~~~~~~~~
/home/paul/code/eclipse_ws/ROS2/src/testing/b.hpp:10:2: error: ‘sensor_msgs’ does not name a type
  sensor_msgs::msg::NavSatFix m_polygon;

What simple thing am I missing?

Sincerely, Paul.