sua ten file

This commit is contained in:
2025-12-30 09:58:57 +07:00
parent 92fedb1ee8
commit e12033556b
40 changed files with 96 additions and 96 deletions

View File

@@ -24,7 +24,7 @@ target_include_directories(robot_nav_2d_msgs
# Các dependencies này cũng là header-only từ common_msgs
target_link_libraries(robot_nav_2d_msgs
INTERFACE
std_msgs
robot_std_msgs
geometry_msgs
)
@@ -41,7 +41,7 @@ install(TARGETS robot_nav_2d_msgs
RUNTIME DESTINATION bin)
# Export targets
# Bây giờ có thể export dependencies vì std_msgs và geometry_msgs đã được export
# Bây giờ có thể export dependencies vì robot_std_msgs và geometry_msgs đã được export
install(EXPORT robot_nav_2d_msgs-targets
FILE robot_nav_2d_msgs-targets.cmake
NAMESPACE robot_nav_2d_msgs::
@@ -56,6 +56,6 @@ message(STATUS "Headers found:")
foreach(hdr ${HEADERS})
message(STATUS " - ${hdr}")
endforeach()
message(STATUS "Dependencies: std_msgs, geometry_msgs")
message(STATUS "Dependencies: robot_std_msgs, geometry_msgs")
message(STATUS "=================================")

View File

@@ -10,7 +10,7 @@
#include <vector>
#include <memory>
#include <std_msgs/Header.h>
#include <robot_std_msgs/Header.h>
#include <robot_nav_2d_msgs/Pose2DStamped.h>
namespace robot_nav_2d_msgs
@@ -30,7 +30,7 @@ struct Path2D_
(void)_alloc;
}
typedef ::std_msgs::Header _header_type;
typedef ::robot_std_msgs::Header _header_type;
_header_type header;
typedef std::vector< ::robot_nav_2d_msgs::Pose2DStamped_<ContainerAllocator> , typename std::allocator_traits<ContainerAllocator>::template rebind_alloc< ::robot_nav_2d_msgs::Pose2DStamped_<ContainerAllocator> >> _poses_type;

View File

@@ -10,9 +10,9 @@
#include <vector>
#include <memory>
#include <std_msgs/Header.h>
#include <robot_std_msgs/Header.h>
#include <robot_nav_2d_msgs/ComplexPolygon2D.h>
#include <std_msgs/ColorRGBA.h>
#include <robot_std_msgs/ColorRGBA.h>
namespace robot_nav_2d_msgs
{
@@ -35,13 +35,13 @@ struct Polygon2DCollection_
typedef ::std_msgs::Header _header_type;
typedef ::robot_std_msgs::Header _header_type;
_header_type header;
typedef std::vector< ::robot_nav_2d_msgs::ComplexPolygon2D_<ContainerAllocator> , typename std::allocator_traits<ContainerAllocator>::template rebind_alloc< ::robot_nav_2d_msgs::ComplexPolygon2D_<ContainerAllocator> >> _polygons_type;
_polygons_type polygons;
typedef std::vector< ::std_msgs::ColorRGBA , typename std::allocator_traits<ContainerAllocator>::template rebind_alloc< ::std_msgs::ColorRGBA >> _colors_type;
typedef std::vector< ::robot_std_msgs::ColorRGBA , typename std::allocator_traits<ContainerAllocator>::template rebind_alloc< ::robot_std_msgs::ColorRGBA >> _colors_type;
_colors_type colors;

View File

@@ -10,7 +10,7 @@
#include <vector>
#include <memory>
#include <std_msgs/Header.h>
#include <robot_std_msgs/Header.h>
#include <robot_nav_2d_msgs/Polygon2D.h>
namespace robot_nav_2d_msgs
@@ -32,7 +32,7 @@ struct Polygon2DStamped_
typedef ::std_msgs::Header _header_type;
typedef ::robot_std_msgs::Header _header_type;
_header_type header;
typedef ::robot_nav_2d_msgs::Polygon2D_<ContainerAllocator> _polygon_type;

View File

@@ -10,7 +10,7 @@
#include <vector>
#include <memory>
#include <std_msgs/Header.h>
#include <robot_std_msgs/Header.h>
#include <robot_geometry_msgs/Pose2D.h>
namespace robot_nav_2d_msgs
@@ -32,7 +32,7 @@ struct Pose2DStamped_
typedef ::std_msgs::Header _header_type;
typedef ::robot_std_msgs::Header _header_type;
_header_type header;
typedef ::robot_geometry_msgs::Pose2D _pose_type;

View File

@@ -10,7 +10,7 @@
#include <vector>
#include <memory>
#include <std_msgs/Header.h>
#include <robot_std_msgs/Header.h>
#include <robot_nav_2d_msgs/Twist2D.h>
namespace robot_nav_2d_msgs
@@ -32,7 +32,7 @@ struct Twist2DStamped_
typedef ::std_msgs::Header _header_type;
typedef ::robot_std_msgs::Header _header_type;
_header_type header;
typedef ::robot_nav_2d_msgs::Twist2D_<ContainerAllocator> _velocity_type;

View File

@@ -29,7 +29,7 @@ target_link_libraries(conversions
PUBLIC
robot_nav_2d_msgs
robot_geometry_msgs
nav_msgs
robot_nav_msgs
nav_grid
nav_core2
robot_cpp
@@ -166,5 +166,5 @@ message(STATUS "Project: ${PROJECT_NAME}")
message(STATUS "Version: ${PROJECT_VERSION}")
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "Libraries: conversions, path_ops, polygons, bounds, tf_help")
message(STATUS "Dependencies: robot_nav_2d_msgs, robot_geometry_msgs, nav_msgs, nav_grid, nav_core2, tf3, console_bridge, Boost")
message(STATUS "Dependencies: robot_nav_2d_msgs, robot_geometry_msgs, robot_nav_msgs, nav_grid, nav_core2, tf3, console_bridge, Boost")
message(STATUS "=================================")

View File

@@ -2,7 +2,7 @@
A handful of useful utility functions for nav_core2 packages.
* Bounds - Utilities for `nav_core2::Bounds` objects interacting with other messages/types and for dividing a `UIntBounds` into multiple smaller bounds.
* [Conversions](doc/Conversions.md) - Tools for converting between `robot_nav_2d_msgs` and other types.
* OdomSubscriber - subscribes to the standard `nav_msgs::Odometry` message and provides access to the velocity component as a `robot_nav_2d_msgs::Twist`
* OdomSubscriber - subscribes to the standard `robot_nav_msgs::Odometry` message and provides access to the velocity component as a `robot_nav_2d_msgs::Twist`
* Parameters - a couple ROS parameter patterns
* PathOps - functions for working with `robot_nav_2d_msgs::Path2D` objects (beyond strict conversion)
* [Plugin Mux](doc/PluginMux.md) - tool for switching between multiple `pluginlib` plugins

View File

@@ -24,10 +24,10 @@
## Path Transformations
| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` |
| -- | -- |
| `Path2D pathToPath(nav_msgs::Path)` |`nav_msgs::Path pathToPath(Path2D)`
| `Path2D posesToPath2D(std::vector<robot_geometry_msgs::PoseStamped>)` | `nav_msgs::Path poses2DToPath(std::vector<robot_geometry_msgs::Pose2D>, std::string, robot::Time)`
| `Path2D pathToPath(robot_nav_msgs::Path)` |`robot_nav_msgs::Path pathToPath(Path2D)`
| `Path2D posesToPath2D(std::vector<robot_geometry_msgs::PoseStamped>)` | `robot_nav_msgs::Path poses2DToPath(std::vector<robot_geometry_msgs::Pose2D>, std::string, robot::Time)`
Also, `nav_msgs::Path posesToPath(std::vector<robot_geometry_msgs::PoseStamped>)`
Also, `robot_nav_msgs::Path posesToPath(std::vector<robot_geometry_msgs::PoseStamped>)`
## Polygon Transformations
| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` |
@@ -42,7 +42,7 @@ Also, `nav_msgs::Path posesToPath(std::vector<robot_geometry_msgs::PoseStamped>)
| to `nav_grid` info | from `nav_grid` info |
| -- | -- |
|`nav_grid::NavGridInfo infoToInfo(nav_msgs::MapMetaData, std::string)` | `nav_msgs::MapMetaData infoToInfo(nav_grid::NavGridInfo)`
|`nav_grid::NavGridInfo infoToInfo(robot_nav_msgs::MapMetaData, std::string)` | `robot_nav_msgs::MapMetaData infoToInfo(nav_grid::NavGridInfo)`
| to two dimensional pose | to three dimensional pose |
| -- | -- |

View File

@@ -47,8 +47,8 @@
#include <robot_nav_2d_msgs/Pose2DStamped.h>
#include <robot_nav_2d_msgs/NavGridInfo.h>
#include <robot_nav_2d_msgs/UIntBounds.h>
#include <nav_msgs/MapMetaData.h>
#include <nav_msgs/Path.h>
#include <robot_nav_msgs/MapMetaData.h>
#include <robot_nav_msgs/Path.h>
#include <nav_grid/nav_grid.h>
#include <nav_core2/bounds.h>
// #include <tf/tf.h>
@@ -76,12 +76,12 @@ namespace robot_nav_2d_utils
const ::std::string &frame, const robot::Time &stamp);
// Path Transformations
::robot_nav_2d_msgs::Path2D pathToPath(const nav_msgs::Path &path);
nav_msgs::Path posesToPath(const ::std::vector<::robot_geometry_msgs::PoseStamped> &poses);
::robot_nav_2d_msgs::Path2D pathToPath(const robot_nav_msgs::Path &path);
robot_nav_msgs::Path posesToPath(const ::std::vector<::robot_geometry_msgs::PoseStamped> &poses);
::robot_nav_2d_msgs::Path2D posesToPath2D(const ::std::vector<::robot_geometry_msgs::PoseStamped> &poses);
nav_msgs::Path poses2DToPath(const ::std::vector<::robot_geometry_msgs::Pose2D> &poses,
robot_nav_msgs::Path poses2DToPath(const ::std::vector<::robot_geometry_msgs::Pose2D> &poses,
const ::std::string &frame, const robot::Time &stamp);
nav_msgs::Path pathToPath(const ::robot_nav_2d_msgs::Path2D &path2d);
robot_nav_msgs::Path pathToPath(const ::robot_nav_2d_msgs::Path2D &path2d);
// Polygon Transformations
::robot_geometry_msgs::Polygon polygon2Dto3D(const ::robot_nav_2d_msgs::Polygon2D &polygon_2d);
@@ -94,8 +94,8 @@ namespace robot_nav_2d_utils
nav_grid::NavGridInfo fromMsg(const ::robot_nav_2d_msgs::NavGridInfo &msg);
::robot_geometry_msgs::Pose getOrigin3D(const nav_grid::NavGridInfo &info);
::robot_geometry_msgs::Pose2D getOrigin2D(const nav_grid::NavGridInfo &info);
nav_grid::NavGridInfo infoToInfo(const nav_msgs::MapMetaData &metadata, const ::std::string &frame);
nav_msgs::MapMetaData infoToInfo(const nav_grid::NavGridInfo &info);
nav_grid::NavGridInfo infoToInfo(const robot_nav_msgs::MapMetaData &metadata, const ::std::string &frame);
robot_nav_msgs::MapMetaData infoToInfo(const nav_grid::NavGridInfo &info);
// Bounds Transformations
robot_nav_2d_msgs::UIntBounds toMsg(const nav_core2::UIntBounds &bounds);

View File

@@ -36,7 +36,7 @@
#define ROBOT_NAV_2D_UTILS_ODOM_SUBSCRIBER_H
#include <robot_nav_2d_utils/conversions.h>
#include <nav_msgs/Odometry.h>
#include <robot_nav_msgs/Odometry.h>
#include <robot_nav_2d_msgs/Twist2DStamped.h>
#include <boost/thread/mutex.hpp>
#include <string>
@@ -63,14 +63,14 @@ namespace robot_nav_2d_utils
{
std::string odom_topic;
// nh.param("odom_topic", odom_topic, default_topic);
// odom_sub_ = nh.subscribe<nav_msgs::Odometry>(odom_topic, 1, boost::bind(&OdomSubscriber::odomCallback, this, _1));
// odom_sub_ = nh.subscribe<robot_nav_msgs::Odometry>(odom_topic, 1, boost::bind(&OdomSubscriber::odomCallback, this, _1));
}
inline robot_nav_2d_msgs::Twist2D getTwist() { return odom_vel_.velocity; }
inline robot_nav_2d_msgs::Twist2DStamped getTwistStamped() { return odom_vel_; }
protected:
void odomCallback(const nav_msgs::Odometry::ConstPtr &msg)
void odomCallback(const robot_nav_msgs::Odometry::ConstPtr &msg)
{
std::cout << "odom received!" << std::endl;
boost::mutex::scoped_lock lock(odom_mutex_);

View File

@@ -37,7 +37,7 @@
#include <ros/ros.h>
#include <pluginlib/class_loader.h>
#include <std_msgs/String.h>
#include <robot_std_msgs/String.h>
#include <robot_nav_2d_msgs/SwitchPlugin.h>
#include <map>
#include <string>
@@ -101,7 +101,7 @@ namespace robot_nav_2d_utils
current_plugin_ = name;
// Update ROS info
std_msgs::String str_msg;
robot_std_msgs::String str_msg;
str_msg.data = current_plugin_;
current_plugin_pub_.publish(str_msg);
private_nh_.setParam(ros_name_, current_plugin_);
@@ -225,7 +225,7 @@ namespace robot_nav_2d_utils
: plugin_loader_(plugin_package, plugin_class), private_nh_("~"), ros_name_(ros_name), switch_callback_(nullptr)
{
// Create the latched publisher
current_plugin_pub_ = private_nh_.advertise<std_msgs::String>(ros_name_, 1, true);
current_plugin_pub_ = private_nh_.advertise<robot_std_msgs::String>(ros_name_, 1, true);
// Load Plugins
std::string plugin_class_name;

View File

@@ -138,7 +138,7 @@ namespace robot_nav_2d_utils
// return pose;
// }
robot_nav_2d_msgs::Path2D pathToPath(const nav_msgs::Path &path)
robot_nav_2d_msgs::Path2D pathToPath(const robot_nav_msgs::Path &path)
{
robot_nav_2d_msgs::Path2D path2d;
path2d.header = path.header;
@@ -152,9 +152,9 @@ namespace robot_nav_2d_utils
return path2d;
}
nav_msgs::Path posesToPath(const std::vector<robot_geometry_msgs::PoseStamped> &poses)
robot_nav_msgs::Path posesToPath(const std::vector<robot_geometry_msgs::PoseStamped> &poses)
{
nav_msgs::Path path;
robot_nav_msgs::Path path;
if (poses.empty())
return path;
@@ -186,10 +186,10 @@ namespace robot_nav_2d_utils
return path;
}
// nav_msgs::Path poses2DToPath(const std::vector<robot_geometry_msgs::Pose2D>& poses,
// robot_nav_msgs::Path poses2DToPath(const std::vector<robot_geometry_msgs::Pose2D>& poses,
// const std::string& frame, const robot::Time& stamp)
// {
// nav_msgs::Path path;
// robot_nav_msgs::Path path;
// path.poses.resize(poses.size());
// path.header.frame_id = frame;
// path.header.stamp = stamp;
@@ -200,9 +200,9 @@ namespace robot_nav_2d_utils
// return path;
// }
nav_msgs::Path pathToPath(const robot_nav_2d_msgs::Path2D &path2d)
robot_nav_msgs::Path pathToPath(const robot_nav_2d_msgs::Path2D &path2d)
{
nav_msgs::Path path;
robot_nav_msgs::Path path;
path.header = path2d.header;
path.poses.resize(path2d.poses.size());
for (unsigned int i = 0; i < path.poses.size(); i++)
@@ -275,7 +275,7 @@ namespace robot_nav_2d_utils
return info;
}
nav_grid::NavGridInfo infoToInfo(const nav_msgs::MapMetaData &metadata, const std::string &frame)
nav_grid::NavGridInfo infoToInfo(const robot_nav_msgs::MapMetaData &metadata, const std::string &frame)
{
nav_grid::NavGridInfo info;
info.frame_id = frame;
@@ -308,9 +308,9 @@ namespace robot_nav_2d_utils
return origin;
}
nav_msgs::MapMetaData infoToInfo(const nav_grid::NavGridInfo &info)
robot_nav_msgs::MapMetaData infoToInfo(const nav_grid::NavGridInfo &info)
{
nav_msgs::MapMetaData metadata;
robot_nav_msgs::MapMetaData metadata;
metadata.resolution = info.resolution;
metadata.width = info.width;
metadata.height = info.height;

View File

@@ -29,7 +29,7 @@ Some packages that implement this interface:
- tf2_eigen
- tf2_geometry_msgs
- tf2_kdl
- tf2_sensor_msgs
- tf2_robot_sensor_msgs
More documentation for the conversion interface is available on the <A HREF="http://wiki.ros.org/tf2/Tutorials/Migration/DataConversions">ROS Wiki</A>.