56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
/*********************************************************************
|
|
*
|
|
* Software License Agreement (BSD License)
|
|
*
|
|
* Nguồn mission từ một goal đơn lẻ (schema "geometry.pose_stamped").
|
|
*
|
|
* Author: DuongTD
|
|
*********************************************************************/
|
|
#ifndef MISSION_ADAPTERS_PLUGINS_GOAL_SOURCE_ADAPTER_H_
|
|
#define MISSION_ADAPTERS_PLUGINS_GOAL_SOURCE_ADAPTER_H_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <robot/node_handle.h>
|
|
|
|
#include <mission_adapters/adapter.h>
|
|
|
|
namespace mission_plugins
|
|
{
|
|
|
|
/**
|
|
* @class GoalSourceAdapter
|
|
* @brief Goal đơn lẻ từ host -> đúng một mission.
|
|
*
|
|
* Không có state giữa các lần gọi, nhưng vẫn không dùng biến static: một tiến trình có thể chạy
|
|
* nhiều instance (nhiều robot mô phỏng) và state static sẽ nối chúng lại với nhau.
|
|
*/
|
|
class GoalSourceAdapter : public mission_adapters::MissionSourceAdapter
|
|
{
|
|
public:
|
|
/// @brief Factory được PluginRegistry nạp qua boost::dll::import_alias.
|
|
static mission_adapters::MissionSourceAdapter::Ptr create();
|
|
|
|
bool configure(const std::string& name, robot::NodeHandle& nh) override;
|
|
|
|
std::string schema() const override;
|
|
|
|
bool validate(const mission_adapters::MissionRequest& request,
|
|
std::string& reason) const override;
|
|
|
|
mission_adapters::ConversionResult
|
|
convert(const mission_adapters::MissionRequest& request) override;
|
|
|
|
private:
|
|
/// Dưới ngưỡng này thì quaternion coi như không mang hướng nào. [không đơn vị]
|
|
static constexpr double kMinQuaternionNorm = 1e-6;
|
|
|
|
std::string name_;
|
|
};
|
|
|
|
} // namespace mission_plugins
|
|
|
|
#endif // MISSION_ADAPTERS_PLUGINS_GOAL_SOURCE_ADAPTER_H_
|