diff --git a/README.md b/README.md index 28ee675..f96590f 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Take a look at my_publisher.cpp #include // for reading rosbag -#include +#include #include #include #include @@ -59,7 +59,7 @@ int main(int argc, char ** argv) point_cloud_transport::Publisher pub = pct.advertise("pct/point_cloud", 100); const std::string bagged_cloud_topic = "/point_cloud"; - const std::string shared_directory = ament_index_cpp::get_package_share_directory( + const std::string shared_directory = ament_index_cpp::get_package_share_path( "point_cloud_transport_tutorial"); const std::string bag_file = shared_directory + "/resources/rosbag2_2023_08_05-16_08_51"; diff --git a/src/my_encoder.cpp b/src/my_encoder.cpp index 2445d05..b706875 100644 --- a/src/my_encoder.cpp +++ b/src/my_encoder.cpp @@ -27,7 +27,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#include +#include #include #include #include @@ -48,9 +48,9 @@ int main(int /*argc*/, char ** /*argv*/) RCLCPP_INFO(logger_, "Using transport: %s", transport.c_str()); const std::string bagged_cloud_topic = "/point_cloud"; - std::filesystem::path shared_directory; - ament_index_cpp::get_package_share_directory("point_cloud_transport_tutorial", shared_directory); - const std::filesystem::path bag_file = shared_directory / "resources" / + const std::filesystem::path bag_file = + ament_index_cpp::get_package_share_path("point_cloud_transport_tutorial") / + "resources" / "rosbag2_2023_08_05-16_08_51"; // boiler-plate to tell rosbag2 how to read our bag diff --git a/src/my_publisher.cpp b/src/my_publisher.cpp index 24faa8c..ee82399 100644 --- a/src/my_publisher.cpp +++ b/src/my_publisher.cpp @@ -34,7 +34,7 @@ #include // for reading rosbag -#include +#include #include #include @@ -59,10 +59,8 @@ int main(int argc, char ** argv) const std::string bagged_cloud_topic = "/point_cloud"; std::filesystem::path shared_directory; - ament_index_cpp::get_package_share_directory( - "point_cloud_transport_tutorial", - shared_directory); - std::filesystem::path bag_file = shared_directory / "resources" / + std::filesystem::path bag_file = + ament_index_cpp::get_package_share_path("point_cloud_transport_tutorial") / "resources" / "rosbag2_2023_08_05-16_08_51"; if (argc > 1) {