update file costmap_2d_robot

This commit is contained in:
2025-11-26 15:00:26 +07:00
parent 19a96c27d5
commit 2e0a4348dd
9 changed files with 551 additions and 1200 deletions

View File

@@ -41,27 +41,31 @@
#include <costmap_2d/layered_costmap.h>
#include <costmap_2d/layer.h>
#include <costmap_2d/footprint.h>
#include <geometry_msgs/Polygon.h>
#include <geometry_msgs/PolygonStamped.h>
#include <geometry_msgs/PoseStamped.h>
#include <tf3/LinearMath/Transform.h>
#include <robot/rate.h>
#include <costmap_2d/data_convert.h>
#include <tf3_geometry_msgs/tf3_geometry_msgs.h>
// class SuperValue : public XmlRpc::XmlRpcValue
// {
// public:
// void setStruct(XmlRpc::XmlRpcValue::ValueStruct* a)
// {
// _type = TypeStruct;
// _value.asStruct = new XmlRpc::XmlRpcValue::ValueStruct(*a);
// }
// void setArray(XmlRpc::XmlRpcValue::ValueArray* a)
// {
// _type = TypeArray;
// _value.asArray = new std::vector<XmlRpc::XmlRpcValue>(*a);
// }
// };
#include <xmlrpcpp/XmlRpcValue.h>
class SuperValue : public XmlRpc::XmlRpcValue
{
public:
void setStruct(XmlRpc::XmlRpcValue::ValueStruct* a)
{
_type = TypeStruct;
_value.asStruct = new XmlRpc::XmlRpcValue::ValueStruct(*a);
}
void setArray(XmlRpc::XmlRpcValue::ValueArray* a)
{
_type = TypeArray;
_value.asArray = new std::vector<XmlRpc::XmlRpcValue>(*a);
}
};
namespace costmap_2d
{
@@ -242,40 +246,30 @@ protected:
double transform_tolerance_; ///< timeout before transform errors
private:
// /** @brief Set the footprint from the new_config object.
// *
// * If the values of footprint and robot_radius are the same in
// * new_config and old_config, nothing is changed. */
// void readFootprintFromConfig(const costmap_2d::Costmap2DConfig &new_config,
// const costmap_2d::Costmap2DConfig &old_config);
/** @brief Set the footprint from the new_config object.
*
* If the values of footprint and robot_radius are the same in
* new_config and old_config, nothing is changed. */
void readFootprintFromConfig(const std::vector<geometry_msgs::Point> &new_footprint,
const std::vector<geometry_msgs::Point> &old_footprint,
const double &robot_radius);
// void loadOldParameters(ros::NodeHandle& nh);
// void warnForOldParameters(ros::NodeHandle& nh);
// void checkOldParam(ros::NodeHandle& nh, const std::string &param_name);
// void copyParentParameters(const std::string& plugin_name, const std::string& plugin_type, ros::NodeHandle& nh);
// void reconfigureCB(costmap_2d::Costmap2DConfig &config, uint32_t level);
// void movementCB(const ros::TimerEvent &event);
void checkMovement();
void mapUpdateLoop(double frequency);
bool map_update_thread_shutdown_;
bool stop_updates_, initialized_, stopped_;
boost::thread* map_update_thread_; ///< @brief A thread for updating the map
robot::Time last_publish_;
robot::Duration publish_cycle;
// pluginlib::ClassLoader<costmap_2d::Layer> plugin_loader_;
// Costmap2DPublisher* publisher_;
// dynamic_reconfigure::Server<costmap_2d::Costmap2DConfig> *dsrv_;
boost::recursive_mutex configuration_mutex_;
// ros::Subscriber footprint_sub_;
// ros::Publisher footprint_pub_;
std::vector<geometry_msgs::Point> unpadded_footprint_;
std::vector<geometry_msgs::Point> padded_footprint_;
float footprint_padding_;
// costmap_2d::Costmap2DConfig old_config_;
private:
void getParams();
void getParams(const std::string& config_file_name);
};
// class Costmap2DROBOT
} // namespace costmap_2d