Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Take a look at my_publisher.cpp
#include <point_cloud_transport/point_cloud_transport.hpp>

// for reading rosbag
#include <ament_index_cpp/get_package_share_directory.hpp>
#include <ament_index_cpp/get_package_share_path.hpp>
#include <rclcpp/serialization.hpp>
#include <rclcpp/rclcpp.hpp>
#include <rosbag2_cpp/reader.hpp>
Expand All @@ -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";

Expand Down
8 changes: 4 additions & 4 deletions src/my_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ament_index_cpp/get_package_share_directory.hpp>
#include <ament_index_cpp/get_package_share_path.hpp>
#include <rclcpp/serialization.hpp>
#include <rclcpp/rclcpp.hpp>
#include <rosbag2_cpp/reader.hpp>
Expand All @@ -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
Expand Down
8 changes: 3 additions & 5 deletions src/my_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <string>

// for reading rosbag
#include <ament_index_cpp/get_package_share_directory.hpp>
#include <ament_index_cpp/get_package_share_path.hpp>

#include <point_cloud_transport/point_cloud_transport.hpp>
#include <rclcpp/serialization.hpp>
Expand All @@ -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) {
Expand Down
Loading