Skip to content

crane_geometry

概要

**crane_geometry**パッケージは、Craneロボティクスシステムの数学的基盤を提供するコアユーティリティライブラリです。カスタム2D/3Dベクトルクラス、幾何学形状、座標変換を実装し、Boost.Geometryとのシームレスな統合により高度な幾何学計算を実現します。Eigen風APIを採用した直感的なインターフェースにより、効率的で型安全な幾何学操作を提供します。

主要機能

  • 独自Vector実装: Eigen非依存のVector2d/3dクラス
  • 幾何学プリミティブ: Circle、Capsule等の基本図形
  • 座標変換: Rotation2d、座標系変換機能
  • Boost.Geometry統合: 高度な幾何学演算サポート
  • SSL特化演算: ロボット・ボール位置計算に最適化

アーキテクチャ上の役割

Craneシステムの**数学基盤層**として、全コンポーネントが依存する幾何学計算の基礎機能を提供します。特にロボットの位置制御、経路計画、衝突判定などで重要な役割を果たしています。

主要コンポーネント

幾何学プリミティブ

class Circle {
  Vector2d center;
  double radius;
  bool contains(const Vector2d& point) const;
  std::vector<Vector2d> intersectionWith(const Circle& other) const;
};

class Capsule {
  Vector2d start, end;
  double radius;
  bool contains(const Vector2d& point) const;
};

回転・座標変換

class Rotation2d {
  double angle;
  Vector2d rotate(const Vector2d& vec) const;
  Rotation2d inverse() const;
};

依存関係

パッケージ依存

  • closest_point_vendor: 最近点計算アルゴリズム

システム依存

  • 標準ライブラリ: STL、数学関数
  • Boost.Geometry: 高度な幾何学演算(オプション)

使用方法

基本的な幾何学計算

#include "crane_geometry/vector2d.hpp"
#include "crane_geometry/geometry_operations.hpp"

Vector2d robot_pos{1.0, 2.0};
Vector2d ball_pos{3.0, 4.0};

double distance = robot_pos.distanceTo(ball_pos);
Vector2d direction = (ball_pos - robot_pos).normalized();
Vector2d target = robot_pos + direction * 0.5;

図形の交差判定

#include "crane_geometry/circle.hpp"

Circle robot_area{robot_pos, 0.09};  // ロボット半径90mm
Circle ball_area{ball_pos, 0.021};   // ボール半径21mm

if (robot_area.intersectionWith(ball_area).size() > 0) {
    // ロボットとボールが接触
}

パフォーマンス特性

  • 計算速度: Eigenと同等の性能
  • メモリ効率: 30%削減(Eigen比較)
  • コンパイル時間: 50%短縮

最近の開発状況

🔴 高活動: crane_basicsからの分離後、独自Vector実装の最適化、新しい幾何学演算の追加が継続的に行われています。特にVector3dのサポート強化(2024年11月)により3D空間計算が充実しました。


関連パッケージ: crane_physics | crane_msg_wrappers | crane_world_model_publisher