update c_api
This commit is contained in:
@@ -1,620 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace NavigationExample
|
||||
{
|
||||
/// <summary>
|
||||
/// C# P/Invoke wrapper for Navigation C API
|
||||
/// </summary>
|
||||
public class NavigationAPI
|
||||
{
|
||||
private const string DllName = "libnav_c_api.so"; // Linux
|
||||
// For Windows: "nav_c_api.dll"
|
||||
// For macOS: "libnav_c_api.dylib"
|
||||
|
||||
// ============================================================================
|
||||
// Enums
|
||||
// ============================================================================
|
||||
public enum NavigationState
|
||||
{
|
||||
Pending = 0,
|
||||
Active = 1,
|
||||
Preempted = 2,
|
||||
Succeeded = 3,
|
||||
Aborted = 4,
|
||||
Rejected = 5,
|
||||
Preempting = 6,
|
||||
Recalling = 7,
|
||||
Recalled = 8,
|
||||
Lost = 9,
|
||||
Planning = 10,
|
||||
Controlling = 11,
|
||||
Clearing = 12,
|
||||
Paused = 13
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Structures
|
||||
// ============================================================================
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Point
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Pose2D
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double theta;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Twist2D
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double theta;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Quaternion
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
public double w;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Position
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Pose
|
||||
{
|
||||
public Position position;
|
||||
public Quaternion orientation;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Header
|
||||
{
|
||||
public uint seq;
|
||||
public long sec;
|
||||
public uint nsec;
|
||||
public IntPtr frame_id; // char*
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PoseStamped
|
||||
{
|
||||
public Header header;
|
||||
public Pose pose;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Twist2DStamped
|
||||
{
|
||||
public Header header;
|
||||
public Twist2D velocity;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Vector3
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NavFeedback
|
||||
{
|
||||
public NavigationState navigation_state;
|
||||
public IntPtr feed_back_str; // char*
|
||||
public Pose2D current_pose;
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool goal_checked;
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool is_ready;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedOccupancyGrid
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr map; // OccupancyGridHandle
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedLaserScan
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr scan; // LaserScanHandle
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedPointCloud
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr cloud; // PointCloudHandle
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedPointCloud2
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr cloud; // PointCloud2Handle
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PlannerDataOutput
|
||||
{
|
||||
public IntPtr plan; // Path2DHandle
|
||||
public IntPtr costmap; // OccupancyGridHandle
|
||||
public IntPtr costmap_update; // OccupancyGridUpdateHandle
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool is_costmap_updated;
|
||||
public IntPtr footprint; // PolygonStampedHandle
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// String Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void nav_c_api_free_string(IntPtr str);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Complex Message Handle Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_occupancy_grid(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_occupancy_grid_update(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_laser_scan(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_point_cloud(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_point_cloud2(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_odometry(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_path2d(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_polygon_stamped(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_order(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_occupancy_grids(IntPtr maps, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_laser_scans(IntPtr scans, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_point_clouds(IntPtr clouds, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_point_cloud2s(IntPtr clouds, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_planner_data(ref PlannerDataOutput data);
|
||||
|
||||
// ============================================================================
|
||||
// State Conversion
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public static extern IntPtr navigation_state_to_string(NavigationState state);
|
||||
|
||||
// ============================================================================
|
||||
// Helper Functions
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_offset_goal_2d(
|
||||
double pose_x, double pose_y, double pose_theta,
|
||||
string frame_id, double offset_distance,
|
||||
ref PoseStamped out_goal);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_offset_goal_stamped(
|
||||
ref PoseStamped in_pose, double offset_distance,
|
||||
ref PoseStamped out_goal);
|
||||
|
||||
// ============================================================================
|
||||
// Navigation Handle Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr navigation_create();
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_destroy(IntPtr handle);
|
||||
|
||||
// ============================================================================
|
||||
// TF Listener Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr tf_listener_create();
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void tf_listener_destroy(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool tf_listener_set_static_transform(
|
||||
IntPtr tf_handle,
|
||||
string parent_frame,
|
||||
string child_frame,
|
||||
double x, double y, double z,
|
||||
double qx, double qy, double qz, double qw);
|
||||
|
||||
// ============================================================================
|
||||
// Navigation Interface Methods
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_initialize(IntPtr handle, IntPtr tf_handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_set_robot_footprint(
|
||||
IntPtr handle, Point[] points, UIntPtr point_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_footprint(
|
||||
IntPtr handle, out IntPtr out_points, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_points(IntPtr points);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_move_to(
|
||||
IntPtr handle, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_move_to_order(
|
||||
IntPtr handle, IntPtr order, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_dock_to(
|
||||
IntPtr handle, string marker, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_dock_to_order(
|
||||
IntPtr handle, IntPtr order, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_move_straight_to(
|
||||
IntPtr handle, ref PoseStamped goal, double xy_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_rotate_to(
|
||||
IntPtr handle, ref PoseStamped goal, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_pause(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_resume(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_cancel(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_set_twist_linear(
|
||||
IntPtr handle, double linear_x, double linear_y, double linear_z);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_set_twist_angular(
|
||||
IntPtr handle, double angular_x, double angular_y, double angular_z);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_pose_stamped(
|
||||
IntPtr handle, ref PoseStamped out_pose);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_pose_2d(
|
||||
IntPtr handle, ref Pose2D out_pose);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_twist(
|
||||
IntPtr handle, ref Twist2DStamped out_twist);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_feedback(
|
||||
IntPtr handle, ref NavFeedback out_feedback);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_feedback(ref NavFeedback feedback);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Navigation Data Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_static_map(IntPtr handle, string map_name, IntPtr map);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_laser_scan(IntPtr handle, string laser_scan_name, IntPtr laser_scan);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_point_cloud(IntPtr handle, string point_cloud_name, IntPtr point_cloud);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_point_cloud2(IntPtr handle, string point_cloud2_name, IntPtr point_cloud2);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_odometry(IntPtr handle, string odometry_name, IntPtr odometry);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_static_map(IntPtr handle, string map_name, out IntPtr out_map);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_laser_scan(IntPtr handle, string laser_scan_name, out IntPtr out_scan);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_point_cloud(IntPtr handle, string point_cloud_name, out IntPtr out_cloud);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_point_cloud2(IntPtr handle, string point_cloud2_name, out IntPtr out_cloud);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_static_maps(IntPtr handle, out IntPtr out_maps, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_laser_scans(IntPtr handle, out IntPtr out_scans, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_point_clouds(IntPtr handle, out IntPtr out_clouds, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_point_cloud2s(IntPtr handle, out IntPtr out_clouds, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_static_map(IntPtr handle, string map_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_laser_scan(IntPtr handle, string laser_scan_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_point_cloud(IntPtr handle, string point_cloud_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_point_cloud2(IntPtr handle, string point_cloud2_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_static_maps(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_laser_scans(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_point_clouds(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_point_cloud2s(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_data(IntPtr handle);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Planner Data
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_global_data(IntPtr handle, ref PlannerDataOutput out_data);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_local_data(IntPtr handle, ref PlannerDataOutput out_data);
|
||||
|
||||
// ============================================================================
|
||||
// Helper Methods for String Conversion
|
||||
// ============================================================================
|
||||
public static string MarshalString(IntPtr ptr)
|
||||
{
|
||||
if (ptr == IntPtr.Zero)
|
||||
return string.Empty;
|
||||
return Marshal.PtrToStringAnsi(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Example Usage
|
||||
// ============================================================================
|
||||
class Program
|
||||
{
|
||||
// Helper method để hiển thị file và line number tự động
|
||||
static void LogError(string message,
|
||||
[CallerFilePath] string filePath = "",
|
||||
[CallerLineNumber] int lineNumber = 0,
|
||||
[CallerMemberName] string memberName = "")
|
||||
{
|
||||
// Lấy tên file từ đường dẫn đầy đủ
|
||||
string fileName = System.IO.Path.GetFileName(filePath);
|
||||
Console.WriteLine($"[{fileName}:{lineNumber}] {memberName}: {message}");
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Create TF listener
|
||||
IntPtr tfHandle = NavigationAPI.tf_listener_create();
|
||||
if (tfHandle == IntPtr.Zero)
|
||||
{
|
||||
LogError("Failed to create TF listener");
|
||||
return;
|
||||
}
|
||||
|
||||
// Inject a static TF so costmap can immediately canTransform(map <-> base_link).
|
||||
// If you already publish TF from localization/odometry, you can remove this call.
|
||||
if (!NavigationAPI.tf_listener_set_static_transform(tfHandle, "map", "odom",
|
||||
0, 0, 0,
|
||||
0, 0, 0, 1))
|
||||
{
|
||||
LogError("Failed to inject static TF map -> odom");
|
||||
NavigationAPI.tf_listener_destroy(tfHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NavigationAPI.tf_listener_set_static_transform(tfHandle, "odom", "base_footprint",
|
||||
0, 0, 0,
|
||||
0, 0, 0, 1))
|
||||
{
|
||||
LogError("Failed to inject static TF map -> base_link");
|
||||
NavigationAPI.tf_listener_destroy(tfHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NavigationAPI.tf_listener_set_static_transform(tfHandle, "base_footprint", "base_link",
|
||||
0, 0, 0,
|
||||
0, 0, 0, 1))
|
||||
{
|
||||
LogError("Failed to inject static TF map -> base_link");
|
||||
NavigationAPI.tf_listener_destroy(tfHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create navigation instance
|
||||
IntPtr navHandle = NavigationAPI.navigation_create();
|
||||
if (navHandle == IntPtr.Zero)
|
||||
{
|
||||
LogError("Failed to create navigation instance");
|
||||
NavigationAPI.tf_listener_destroy(tfHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize navigation
|
||||
if (!NavigationAPI.navigation_initialize(navHandle, tfHandle))
|
||||
{
|
||||
LogError("Failed to initialize navigation");
|
||||
NavigationAPI.navigation_destroy(navHandle);
|
||||
NavigationAPI.tf_listener_destroy(tfHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set robot footprint
|
||||
NavigationAPI.Point[] footprint = new NavigationAPI.Point[]
|
||||
{
|
||||
new NavigationAPI.Point { x = 0.3, y = -0.2, z = 0.0 },
|
||||
new NavigationAPI.Point { x = 0.3, y = 0.2, z = 0.0 },
|
||||
new NavigationAPI.Point { x = -0.3, y = 0.2, z = 0.0 },
|
||||
new NavigationAPI.Point { x = -0.3, y = -0.2, z = 0.0 }
|
||||
};
|
||||
NavigationAPI.navigation_set_robot_footprint(navHandle, footprint, new UIntPtr((uint)footprint.Length));
|
||||
|
||||
// Get robot pose
|
||||
NavigationAPI.Pose2D robotPose = new NavigationAPI.Pose2D();
|
||||
if (NavigationAPI.navigation_get_robot_pose_2d(navHandle, ref robotPose))
|
||||
{
|
||||
Console.WriteLine($"Robot pose: x={robotPose.x}, y={robotPose.y}, theta={robotPose.theta}");
|
||||
}
|
||||
|
||||
// Get navigation feedback
|
||||
NavigationAPI.NavFeedback feedback = new NavigationAPI.NavFeedback();
|
||||
if (NavigationAPI.navigation_get_feedback(navHandle, ref feedback))
|
||||
{
|
||||
string stateStr = NavigationAPI.MarshalString(
|
||||
NavigationAPI.navigation_state_to_string(feedback.navigation_state));
|
||||
string feedbackStr = NavigationAPI.MarshalString(feedback.feed_back_str);
|
||||
Console.WriteLine($"State: {stateStr}, Feedback: {feedbackStr}");
|
||||
NavigationAPI.navigation_free_feedback(ref feedback);
|
||||
}
|
||||
|
||||
|
||||
// Get global planner data (opaque handles)
|
||||
NavigationAPI.PlannerDataOutput globalData = new NavigationAPI.PlannerDataOutput();
|
||||
if (NavigationAPI.navigation_get_global_data(navHandle, ref globalData))
|
||||
{
|
||||
Console.WriteLine($"Global data received (costmap_updated={globalData.is_costmap_updated})");
|
||||
NavigationAPI.navigation_free_planner_data(ref globalData);
|
||||
}
|
||||
|
||||
// Get all static maps (names + opaque handles)
|
||||
IntPtr mapsPtr;
|
||||
UIntPtr mapsCount;
|
||||
if (NavigationAPI.navigation_get_all_static_maps(navHandle, out mapsPtr, out mapsCount))
|
||||
{
|
||||
ulong count = mapsCount.ToUInt64();
|
||||
Console.WriteLine($"Static maps: {count}");
|
||||
if (mapsPtr != IntPtr.Zero && count > 0)
|
||||
{
|
||||
int itemSize = Marshal.SizeOf<NavigationAPI.NamedOccupancyGrid>();
|
||||
for (ulong i = 0; i < count; i++)
|
||||
{
|
||||
IntPtr itemPtr = IntPtr.Add(mapsPtr, checked((int)(i * (ulong)itemSize)));
|
||||
var item = Marshal.PtrToStructure<NavigationAPI.NamedOccupancyGrid>(itemPtr);
|
||||
string name = NavigationAPI.MarshalString(item.name);
|
||||
Console.WriteLine($"- {name}");
|
||||
}
|
||||
NavigationAPI.navigation_free_named_occupancy_grids(mapsPtr, (UIntPtr)count);
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
NavigationAPI.navigation_destroy(navHandle);
|
||||
NavigationAPI.tf_listener_destroy(tfHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,18 @@ namespace NavigationExample
|
||||
public double theta;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NavFeedback
|
||||
{
|
||||
public NavigationState navigation_state;
|
||||
public IntPtr feed_back_str; // char*; free with nav_c_api_free_string
|
||||
public Pose2D current_pose;
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool goal_checked;
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool is_ready;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Twist2D
|
||||
{
|
||||
@@ -85,11 +97,27 @@ namespace NavigationExample
|
||||
public Quaternion orientation;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Vector3
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Twist
|
||||
{
|
||||
public Vector3 linear;
|
||||
public Vector3 angular;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Header
|
||||
{
|
||||
public uint seq;
|
||||
public long sec;
|
||||
public uint sec;
|
||||
public uint nsec;
|
||||
public IntPtr frame_id; // char*
|
||||
}
|
||||
@@ -108,384 +136,232 @@ namespace NavigationExample
|
||||
public Twist2D velocity;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Vector3
|
||||
public struct NavigationHandle
|
||||
{
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
public IntPtr ptr;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NavFeedback
|
||||
public struct TFListenerHandle
|
||||
{
|
||||
public NavigationState navigation_state;
|
||||
public IntPtr feed_back_str; // char*
|
||||
public Pose2D current_pose;
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool goal_checked;
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool is_ready;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedOccupancyGrid
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr map; // OccupancyGridHandle
|
||||
public IntPtr ptr;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedLaserScan
|
||||
public struct LaserScan
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr scan; // LaserScanHandle
|
||||
public Header header;
|
||||
public float angle_min;
|
||||
public float angle_max;
|
||||
public float angle_increment;
|
||||
public float time_increment;
|
||||
public float scan_time;
|
||||
public float range_min;
|
||||
public float range_max;
|
||||
public IntPtr ranges;
|
||||
public UIntPtr ranges_count;
|
||||
public IntPtr intensities;
|
||||
public UIntPtr intensities_count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedPointCloud
|
||||
public struct PoseWithCovariance
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr cloud; // PointCloudHandle
|
||||
public Pose pose;
|
||||
public IntPtr covariance;
|
||||
public UIntPtr covariance_count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NamedPointCloud2
|
||||
{
|
||||
public IntPtr name; // char*
|
||||
public IntPtr cloud; // PointCloud2Handle
|
||||
public struct TwistWithCovariance {
|
||||
public Twist twist;
|
||||
public IntPtr covariance;
|
||||
public UIntPtr covariance_count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PlannerDataOutput
|
||||
public struct Odometry
|
||||
{
|
||||
public IntPtr plan; // Path2DHandle
|
||||
public IntPtr costmap; // OccupancyGridHandle
|
||||
public IntPtr costmap_update; // OccupancyGridUpdateHandle
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool is_costmap_updated;
|
||||
public IntPtr footprint; // PolygonStampedHandle
|
||||
public Header header;
|
||||
public IntPtr child_frame_id;
|
||||
public PoseWithCovariance pose;
|
||||
public TwistWithCovariance twist;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// String Management
|
||||
// ============================================================================
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct OccupancyGrid
|
||||
{
|
||||
public Header header;
|
||||
public MapMetaData info;
|
||||
public IntPtr data;
|
||||
public UIntPtr data_count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MapMetaData
|
||||
{
|
||||
public Time map_load_time;
|
||||
public float resolution;
|
||||
public uint width;
|
||||
public uint height;
|
||||
public Pose origin;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Time
|
||||
{
|
||||
public uint sec;
|
||||
public uint nsec;
|
||||
}
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public static extern Header header_create(string frame_id);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public static extern Header header_set_data(
|
||||
uint seq,
|
||||
uint sec,
|
||||
uint nsec,
|
||||
string frame_id);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Time time_create();
|
||||
|
||||
/// <summary>Free a string allocated by the API (strdup).</summary>
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void nav_c_api_free_string(IntPtr str);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Complex Message Handle Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_occupancy_grid(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_occupancy_grid_update(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_laser_scan(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_point_cloud(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_point_cloud2(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_odometry(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_path2d(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_polygon_stamped(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_order(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_occupancy_grids(IntPtr maps, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_laser_scans(IntPtr scans, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_point_clouds(IntPtr clouds, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_named_point_cloud2s(IntPtr clouds, UIntPtr count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_planner_data(ref PlannerDataOutput data);
|
||||
|
||||
// ============================================================================
|
||||
// State Conversion
|
||||
// ============================================================================
|
||||
/// <summary>Convert NavigationState to string; caller must free with nav_c_api_free_string.</summary>
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public static extern IntPtr navigation_state_to_string(NavigationState state);
|
||||
|
||||
// ============================================================================
|
||||
// Helper Functions
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_offset_goal_2d(
|
||||
double pose_x, double pose_y, double pose_theta,
|
||||
string frame_id, double offset_distance,
|
||||
ref PoseStamped out_goal);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_offset_goal_stamped(
|
||||
ref PoseStamped in_pose, double offset_distance,
|
||||
ref PoseStamped out_goal);
|
||||
public static extern bool navigation_get_feedback(NavigationHandle handle, ref NavFeedback out_feedback);
|
||||
|
||||
// ============================================================================
|
||||
// Navigation Handle Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr navigation_create();
|
||||
/// <summary>Helper: copy unmanaged char* to managed string; does not free the pointer.</summary>
|
||||
public static string MarshalString(IntPtr p)
|
||||
{
|
||||
if (p == IntPtr.Zero) return string.Empty;
|
||||
return Marshal.PtrToStringAnsi(p) ?? string.Empty;
|
||||
}
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_destroy(IntPtr handle);
|
||||
/// <summary>Free strings inside NavFeedback (feed_back_str). Call after navigation_get_feedback when done.</summary>
|
||||
public static void navigation_free_feedback(ref NavFeedback feedback)
|
||||
{
|
||||
if (feedback.feed_back_str != IntPtr.Zero)
|
||||
{
|
||||
nav_c_api_free_string(feedback.feed_back_str);
|
||||
feedback.feed_back_str = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// TF Listener Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr tf_listener_create();
|
||||
public static extern TFListenerHandle tf_listener_create();
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void tf_listener_destroy(IntPtr handle);
|
||||
public static extern void tf_listener_destroy(TFListenerHandle handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool tf_listener_set_static_transform(
|
||||
IntPtr tf_handle,
|
||||
TFListenerHandle tf_handle,
|
||||
string parent_frame,
|
||||
string child_frame,
|
||||
double x, double y, double z,
|
||||
double qx, double qy, double qz, double qw);
|
||||
|
||||
// ============================================================================
|
||||
// Navigation Interface Methods
|
||||
// Navigation Handle Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_initialize(IntPtr handle, IntPtr tf_handle);
|
||||
public static extern NavigationHandle navigation_create();
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_destroy(NavigationHandle handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_set_robot_footprint(
|
||||
IntPtr handle, Point[] points, UIntPtr point_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_footprint(
|
||||
IntPtr handle, out IntPtr out_points, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_points(IntPtr points);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_move_to(
|
||||
IntPtr handle, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_move_to_order(
|
||||
IntPtr handle, IntPtr order, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
public static extern bool navigation_initialize(NavigationHandle handle, TFListenerHandle tf_handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_dock_to(
|
||||
IntPtr handle, string marker, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
public static extern bool navigation_set_robot_footprint(NavigationHandle handle, Point[] points, UIntPtr point_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_dock_to_order(
|
||||
IntPtr handle, IntPtr order, ref PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
public static extern bool navigation_get_robot_footprint(NavigationHandle handle, ref Point[] out_points, ref UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_move_straight_to(
|
||||
IntPtr handle, ref PoseStamped goal, double xy_goal_tolerance);
|
||||
public static extern bool navigation_move_to(NavigationHandle handle, PoseStamped goal, double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_rotate_to(
|
||||
IntPtr handle, ref PoseStamped goal, double yaw_goal_tolerance);
|
||||
public static extern bool navigation_dock_to(NavigationHandle handle, string marker, PoseStamped goal, double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_pause(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_resume(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_cancel(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_set_twist_linear(
|
||||
IntPtr handle, double linear_x, double linear_y, double linear_z);
|
||||
public static extern bool navigation_move_straight_to(NavigationHandle handle, PoseStamped goal, double xy_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_set_twist_angular(
|
||||
IntPtr handle, double angular_x, double angular_y, double angular_z);
|
||||
public static extern bool navigation_rotate_to(NavigationHandle handle, PoseStamped goal, double yaw_goal_tolerance);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_pose_stamped(
|
||||
IntPtr handle, ref PoseStamped out_pose);
|
||||
public static extern bool navigation_pause(NavigationHandle handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_pose_2d(
|
||||
IntPtr handle, ref Pose2D out_pose);
|
||||
public static extern bool navigation_resume(NavigationHandle handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_twist(
|
||||
IntPtr handle, ref Twist2DStamped out_twist);
|
||||
public static extern bool navigation_cancel(NavigationHandle handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_feedback(
|
||||
IntPtr handle, ref NavFeedback out_feedback);
|
||||
public static extern bool navigation_set_twist_linear(NavigationHandle handle, double linear_x, double linear_y, double linear_z);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void navigation_free_feedback(ref NavFeedback feedback);
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_set_twist_angular(NavigationHandle handle, double angular_x, double angular_y, double angular_z);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_pose_stamped(NavigationHandle handle, ref PoseStamped out_pose);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_robot_pose_2d(NavigationHandle handle, ref Pose2D out_pose);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_twist(NavigationHandle handle, ref Twist2DStamped out_twist);
|
||||
// ============================================================================
|
||||
// Navigation Data Management
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_static_map(IntPtr handle, string map_name, IntPtr map);
|
||||
public static extern bool navigation_add_laser_scan(NavigationHandle handle, string laser_scan_name, LaserScan laser_scan);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_laser_scan(IntPtr handle, string laser_scan_name, IntPtr laser_scan);
|
||||
public static extern bool navigation_add_odometry(NavigationHandle handle, string odometry_name, Odometry odometry);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_point_cloud(IntPtr handle, string point_cloud_name, IntPtr point_cloud);
|
||||
public static extern bool navigation_add_static_map(NavigationHandle handle, string map_name, OccupancyGrid occupancy_grid);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_point_cloud2(IntPtr handle, string point_cloud2_name, IntPtr point_cloud2);
|
||||
public static extern bool navigation_get_static_map(NavigationHandle handle, string map_name, ref OccupancyGrid occupancy_grid);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_add_odometry(IntPtr handle, string odometry_name, IntPtr odometry);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_static_map(IntPtr handle, string map_name, out IntPtr out_map);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_laser_scan(IntPtr handle, string laser_scan_name, out IntPtr out_scan);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_point_cloud(IntPtr handle, string point_cloud_name, out IntPtr out_cloud);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_point_cloud2(IntPtr handle, string point_cloud2_name, out IntPtr out_cloud);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_static_maps(IntPtr handle, out IntPtr out_maps, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_laser_scans(IntPtr handle, out IntPtr out_scans, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_point_clouds(IntPtr handle, out IntPtr out_clouds, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_all_point_cloud2s(IntPtr handle, out IntPtr out_clouds, out UIntPtr out_count);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_static_map(IntPtr handle, string map_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_laser_scan(IntPtr handle, string laser_scan_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_point_cloud(IntPtr handle, string point_cloud_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_point_cloud2(IntPtr handle, string point_cloud2_name);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_static_maps(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_laser_scans(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_point_clouds(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_point_cloud2s(IntPtr handle);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_remove_all_data(IntPtr handle);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Planner Data
|
||||
// ============================================================================
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_global_data(IntPtr handle, ref PlannerDataOutput out_data);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool navigation_get_local_data(IntPtr handle, ref PlannerDataOutput out_data);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Navigation Commands with Order
|
||||
// ============================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// Helper Methods for String Conversion
|
||||
// ============================================================================
|
||||
public static string MarshalString(IntPtr ptr)
|
||||
{
|
||||
if (ptr == IntPtr.Zero)
|
||||
return string.Empty;
|
||||
return Marshal.PtrToStringAnsi(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -507,8 +383,8 @@ namespace NavigationExample
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Create TF listener
|
||||
IntPtr tfHandle = NavigationAPI.tf_listener_create();
|
||||
if (tfHandle == IntPtr.Zero)
|
||||
NavigationAPI.TFListenerHandle tfHandle = NavigationAPI.tf_listener_create();
|
||||
if (tfHandle.ptr == IntPtr.Zero)
|
||||
{
|
||||
LogError("Failed to create TF listener");
|
||||
return;
|
||||
@@ -544,8 +420,8 @@ namespace NavigationExample
|
||||
}
|
||||
|
||||
// Create navigation instance
|
||||
IntPtr navHandle = NavigationAPI.navigation_create();
|
||||
if (navHandle == IntPtr.Zero)
|
||||
NavigationAPI.NavigationHandle navHandle = NavigationAPI.navigation_create();
|
||||
if (navHandle.ptr == IntPtr.Zero)
|
||||
{
|
||||
LogError("Failed to create navigation instance");
|
||||
NavigationAPI.tf_listener_destroy(tfHandle);
|
||||
@@ -571,53 +447,131 @@ namespace NavigationExample
|
||||
};
|
||||
NavigationAPI.navigation_set_robot_footprint(navHandle, footprint, new UIntPtr((uint)footprint.Length));
|
||||
|
||||
// Get robot pose
|
||||
NavigationAPI.Pose2D robotPose = new NavigationAPI.Pose2D();
|
||||
if (NavigationAPI.navigation_get_robot_pose_2d(navHandle, ref robotPose))
|
||||
{
|
||||
Console.WriteLine($"Robot pose: x={robotPose.x}, y={robotPose.y}, theta={robotPose.theta}");
|
||||
}
|
||||
|
||||
// Get navigation feedback
|
||||
NavigationAPI.NavFeedback feedback = new NavigationAPI.NavFeedback();
|
||||
if (NavigationAPI.navigation_get_feedback(navHandle, ref feedback))
|
||||
{
|
||||
string stateStr = NavigationAPI.MarshalString(
|
||||
NavigationAPI.navigation_state_to_string(feedback.navigation_state));
|
||||
IntPtr stateStrPtr = NavigationAPI.navigation_state_to_string(feedback.navigation_state);
|
||||
string stateStr = NavigationAPI.MarshalString(stateStrPtr);
|
||||
NavigationAPI.nav_c_api_free_string(stateStrPtr);
|
||||
string feedbackStr = NavigationAPI.MarshalString(feedback.feed_back_str);
|
||||
Console.WriteLine($"State: {stateStr}, Feedback: {feedbackStr}");
|
||||
NavigationAPI.navigation_free_feedback(ref feedback);
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
IntPtr fFrameId = Marshal.StringToHGlobalAnsi("fscan");
|
||||
NavigationAPI.Header fscanHeader = NavigationAPI.header_create(Marshal.PtrToStringAnsi(fFrameId));
|
||||
NavigationAPI.LaserScan fscanHandle;
|
||||
fscanHandle.header = fscanHeader;
|
||||
fscanHandle.angle_min = -1.57f;
|
||||
fscanHandle.angle_max = 1.57f;
|
||||
fscanHandle.angle_increment = 0.785f;
|
||||
fscanHandle.time_increment = 0.0f;
|
||||
fscanHandle.scan_time = 0.1f;
|
||||
fscanHandle.range_min = 0.05f;
|
||||
fscanHandle.range_max = 10.0f;
|
||||
fscanHandle.ranges = Marshal.AllocHGlobal(sizeof(float) * 5);
|
||||
Marshal.Copy(new float[] { 1.0f, 1.2f, 1.1f, 0.9f, 1.3f }, 0, fscanHandle.ranges, 5);
|
||||
fscanHandle.ranges_count = new UIntPtr(5);
|
||||
fscanHandle.intensities = Marshal.AllocHGlobal(sizeof(float) * 5);
|
||||
Marshal.Copy(new float[] { 100.0f, 120.0f, 110.0f, 90.0f, 130.0f }, 0, fscanHandle.intensities, 5);
|
||||
fscanHandle.intensities_count = new UIntPtr(5);
|
||||
NavigationAPI.navigation_add_laser_scan(navHandle, "/fscan", fscanHandle);
|
||||
|
||||
// Get global planner data (opaque handles)
|
||||
NavigationAPI.PlannerDataOutput globalData = new NavigationAPI.PlannerDataOutput();
|
||||
if (NavigationAPI.navigation_get_global_data(navHandle, ref globalData))
|
||||
{
|
||||
Console.WriteLine($"Global data received (costmap_updated={globalData.is_costmap_updated})");
|
||||
NavigationAPI.navigation_free_planner_data(ref globalData);
|
||||
}
|
||||
|
||||
// Get all static maps (names + opaque handles)
|
||||
IntPtr mapsPtr;
|
||||
UIntPtr mapsCount;
|
||||
if (NavigationAPI.navigation_get_all_static_maps(navHandle, out mapsPtr, out mapsCount))
|
||||
{
|
||||
ulong count = mapsCount.ToUInt64();
|
||||
Console.WriteLine($"Static maps: {count}");
|
||||
if (mapsPtr != IntPtr.Zero && count > 0)
|
||||
{
|
||||
int itemSize = Marshal.SizeOf<NavigationAPI.NamedOccupancyGrid>();
|
||||
for (ulong i = 0; i < count; i++)
|
||||
{
|
||||
IntPtr itemPtr = IntPtr.Add(mapsPtr, checked((int)(i * (ulong)itemSize)));
|
||||
var item = Marshal.PtrToStructure<NavigationAPI.NamedOccupancyGrid>(itemPtr);
|
||||
string name = NavigationAPI.MarshalString(item.name);
|
||||
Console.WriteLine($"- {name}");
|
||||
IntPtr bFrameId = Marshal.StringToHGlobalAnsi("bscan");
|
||||
NavigationAPI.Header bscanHeader = NavigationAPI.header_create(Marshal.PtrToStringAnsi(bFrameId));
|
||||
NavigationAPI.LaserScan bscanHandle;
|
||||
bscanHandle.header = bscanHeader;
|
||||
bscanHandle.angle_min = 1.57f;
|
||||
bscanHandle.angle_max = -1.57f;
|
||||
bscanHandle.angle_increment = -0.785f;
|
||||
bscanHandle.time_increment = 0.0f;
|
||||
bscanHandle.scan_time = 0.1f;
|
||||
bscanHandle.range_min = 0.05f;
|
||||
bscanHandle.range_max = 10.0f;
|
||||
bscanHandle.ranges = Marshal.AllocHGlobal(sizeof(float) * 5);
|
||||
Marshal.Copy(new float[] { 1.0f, 1.2f, 1.1f, 0.9f, 1.3f }, 0, bscanHandle.ranges, 5);
|
||||
bscanHandle.ranges_count = new UIntPtr(5);
|
||||
bscanHandle.intensities = Marshal.AllocHGlobal(sizeof(float) * 5);
|
||||
Marshal.Copy(new float[] { 100.0f, 120.0f, 110.0f, 90.0f, 130.0f }, 0, bscanHandle.intensities, 5);
|
||||
bscanHandle.intensities_count = new UIntPtr(5);
|
||||
NavigationAPI.navigation_add_laser_scan(navHandle, "/bscan", bscanHandle);
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
IntPtr oFrameId = Marshal.StringToHGlobalAnsi("odom");
|
||||
NavigationAPI.Header odometryHeader = NavigationAPI.header_create(Marshal.PtrToStringAnsi(oFrameId));
|
||||
NavigationAPI.Odometry odometryHandle = new NavigationAPI.Odometry();
|
||||
odometryHandle.header = odometryHeader;
|
||||
IntPtr childFrameId = Marshal.StringToHGlobalAnsi("base_footprint");
|
||||
odometryHandle.child_frame_id = childFrameId;
|
||||
odometryHandle.pose.pose.position.x = 0.0;
|
||||
odometryHandle.pose.pose.position.y = 0.0;
|
||||
odometryHandle.pose.pose.position.z = 0.0;
|
||||
odometryHandle.pose.pose.orientation.x = 0.0;
|
||||
odometryHandle.pose.pose.orientation.y = 0.0;
|
||||
odometryHandle.pose.pose.orientation.z = 0.0;
|
||||
odometryHandle.pose.pose.orientation.w = 1.0;
|
||||
|
||||
double[] pose_covariance = new double[36];
|
||||
for(int i = 0; i < pose_covariance.Length; i++) {
|
||||
pose_covariance[i] = 0.0;
|
||||
}
|
||||
NavigationAPI.navigation_free_named_occupancy_grids(mapsPtr, (UIntPtr)count);
|
||||
odometryHandle.pose.covariance = Marshal.AllocHGlobal(sizeof(double) * pose_covariance.Length);
|
||||
Marshal.Copy(pose_covariance, 0, odometryHandle.pose.covariance, pose_covariance.Length);
|
||||
odometryHandle.pose.covariance_count = new UIntPtr((uint)pose_covariance.Length);
|
||||
|
||||
odometryHandle.twist.twist.linear.x = 0.0;
|
||||
odometryHandle.twist.twist.linear.y = 0.0;
|
||||
odometryHandle.twist.twist.linear.z = 0.0;
|
||||
odometryHandle.twist.twist.angular.x = 0.0;
|
||||
odometryHandle.twist.twist.angular.y = 0.0;
|
||||
odometryHandle.twist.twist.angular.z = 0.0;
|
||||
double[] twist_covariance = new double[36];
|
||||
for(int i = 0; i < twist_covariance.Length; i++) {
|
||||
twist_covariance[i] = 0.0;
|
||||
}
|
||||
odometryHandle.twist.covariance = Marshal.AllocHGlobal(sizeof(double) * twist_covariance.Length);
|
||||
Marshal.Copy(twist_covariance, 0, odometryHandle.twist.covariance, twist_covariance.Length);
|
||||
odometryHandle.twist.covariance_count = new UIntPtr((uint)twist_covariance.Length);
|
||||
NavigationAPI.navigation_add_odometry(navHandle, "odometry", odometryHandle);
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
// Add static map
|
||||
NavigationAPI.Time mapLoadTime = NavigationAPI.time_create();
|
||||
NavigationAPI.MapMetaData mapMetaData = new NavigationAPI.MapMetaData();
|
||||
mapMetaData.map_load_time = mapLoadTime;
|
||||
mapMetaData.resolution = 0.05f;
|
||||
mapMetaData.width = 3;
|
||||
mapMetaData.height = 10;
|
||||
mapMetaData.origin = new NavigationAPI.Pose();
|
||||
mapMetaData.origin.position.x = 0.0;
|
||||
mapMetaData.origin.position.y = 0.0;
|
||||
mapMetaData.origin.position.z = 0.0;
|
||||
mapMetaData.origin.orientation.x = 0.0;
|
||||
mapMetaData.origin.orientation.y = 0.0;
|
||||
mapMetaData.origin.orientation.z = 0.0;
|
||||
mapMetaData.origin.orientation.w = 1.0;
|
||||
NavigationAPI.OccupancyGrid occupancyGrid = new NavigationAPI.OccupancyGrid();
|
||||
IntPtr mapFrameId = Marshal.StringToHGlobalAnsi("map");
|
||||
occupancyGrid.header = NavigationAPI.header_create(Marshal.PtrToStringAnsi(mapFrameId));
|
||||
occupancyGrid.info = mapMetaData;
|
||||
byte[] data = new byte[30];
|
||||
for (int i = 0; i < data.Length; i++) {
|
||||
data[i] = 100;
|
||||
}
|
||||
occupancyGrid.data = Marshal.AllocHGlobal(sizeof(byte) * data.Length);
|
||||
Marshal.Copy(data, 0, occupancyGrid.data, data.Length);
|
||||
occupancyGrid.data_count = new UIntPtr((uint)data.Length);
|
||||
Console.WriteLine("data length: {0} {1}", data.Length, occupancyGrid.data_count);
|
||||
Console.WriteLine("C# OccupancyGrid sizeof={0} data_off={1} data_count_off={2}",
|
||||
Marshal.SizeOf<NavigationAPI.OccupancyGrid>(),
|
||||
Marshal.OffsetOf<NavigationAPI.OccupancyGrid>("data"),
|
||||
Marshal.OffsetOf<NavigationAPI.OccupancyGrid>("data_count"));
|
||||
|
||||
NavigationAPI.navigation_add_static_map(navHandle, "/map", occupancyGrid);
|
||||
|
||||
// Cleanup
|
||||
NavigationAPI.navigation_destroy(navHandle);
|
||||
|
||||
Binary file not shown.
@@ -82,8 +82,6 @@ fi
|
||||
|
||||
# Luôn copy source code mới nhất (cập nhật file nếu đã có)
|
||||
cd "$EXAMPLE_DIR/NavigationExample"
|
||||
echo "Updating Program.cs from CSharpExample.cs..."
|
||||
cp ../CSharpExample.cs Program.cs
|
||||
|
||||
# Bước 3: Copy library
|
||||
echo "Copying library..."
|
||||
|
||||
@@ -10,13 +10,12 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
# Find Boost
|
||||
find_package(Boost REQUIRED)
|
||||
# Find Boost (filesystem needed for plugin path / boost::dll usage)
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem system)
|
||||
|
||||
# Dependencies
|
||||
set(PACKAGES_DIR
|
||||
move_base_core
|
||||
move_base
|
||||
tf3
|
||||
robot_time
|
||||
robot_cpp
|
||||
@@ -29,8 +28,28 @@ include_directories(
|
||||
)
|
||||
|
||||
# Tìm tất cả file source
|
||||
file(GLOB SOURCES "src/*.cpp")
|
||||
file(GLOB HEADERS "include/*.h")
|
||||
file(GLOB SOURCES
|
||||
"src/*.cpp"
|
||||
"src/std_msgs/*.cpp"
|
||||
"src/sensor_msgs/*.cpp"
|
||||
"src/geometry_msgs/*.cpp"
|
||||
"src/nav_msgs/*.cpp"
|
||||
"src/nav_2d_msgs/*.cpp"
|
||||
"src/robot_nav_msgs/*.cpp"
|
||||
"src/robot_geometry_msgs/*.cpp"
|
||||
"src/map_msgs/*.cpp"
|
||||
)
|
||||
file(GLOB HEADERS
|
||||
"include/*.h"
|
||||
"include/std_msgs/*.h"
|
||||
"include/sensor_msgs/*.h"
|
||||
"include/geometry_msgs/*.h"
|
||||
"include/nav_msgs/*.h"
|
||||
"include/nav_2d_msgs/*.h"
|
||||
"include/robot_nav_msgs/*.h"
|
||||
"include/robot_geometry_msgs/*.h"
|
||||
"include/map_msgs/*.h"
|
||||
)
|
||||
|
||||
# Tạo thư viện shared (.so)
|
||||
add_library(nav_c_api SHARED ${SOURCES} ${HEADERS})
|
||||
@@ -41,6 +60,8 @@ target_link_libraries(nav_c_api
|
||||
${PACKAGES_DIR}
|
||||
PRIVATE
|
||||
Boost::boost
|
||||
Boost::filesystem
|
||||
Boost::system
|
||||
dl
|
||||
)
|
||||
|
||||
|
||||
153
src/APIs/c_api/include/convertor.h
Normal file
153
src/APIs/c_api/include/convertor.h
Normal file
@@ -0,0 +1,153 @@
|
||||
#ifndef C_API_CONVERTOR_H
|
||||
#define C_API_CONVERTOR_H
|
||||
|
||||
// C
|
||||
#include "sensor_msgs/LaserScan.h"
|
||||
#include "sensor_msgs/PointCloud.h"
|
||||
#include "sensor_msgs/PointCloud2.h"
|
||||
#include "nav_msgs/Odometry.h"
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_msgs/OccupancyGrid.h"
|
||||
#include "geometry_msgs/Point.h"
|
||||
#include "geometry_msgs/PoseStamped.h"
|
||||
#include "geometry_msgs/Pose2D.h"
|
||||
#include "nav_2d_msgs/Twist2D.h"
|
||||
#include "nav_2d_msgs/Twist2DStamped.h"
|
||||
|
||||
// C++
|
||||
#include <robot_sensor_msgs/LaserScan.h>
|
||||
#include <robot_sensor_msgs/PointCloud.h>
|
||||
#include <robot_sensor_msgs/PointCloud2.h>
|
||||
#include <robot_nav_msgs/Odometry.h>
|
||||
#include <robot_nav_msgs/OccupancyGrid.h>
|
||||
#include <robot_geometry_msgs/PoseStamped.h>
|
||||
#include <robot_geometry_msgs/Pose2D.h>
|
||||
#include <robot_nav_2d_msgs/Twist2D.h>
|
||||
#include <robot_nav_2d_msgs/Twist2DStamped.h>
|
||||
|
||||
#include <move_base_core/navigation.h>
|
||||
#include <move_base_core/common.h>
|
||||
|
||||
/**
|
||||
* @brief Convert C LaserScan to C++ LaserScan
|
||||
* @param laser_scan C LaserScan
|
||||
* @return C++ LaserScan
|
||||
*/
|
||||
robot_sensor_msgs::LaserScan convert2CppLaserScan(const LaserScan& laser_scan);
|
||||
|
||||
/**
|
||||
* @brief Convert C OccupancyGrid to C++ OccupancyGrid
|
||||
* @param occupancy_grid C OccupancyGrid
|
||||
* @return C++ OccupancyGrid
|
||||
*/
|
||||
robot_nav_msgs::OccupancyGrid convert2CppOccupancyGrid(const OccupancyGrid& occupancy_grid);
|
||||
|
||||
/**
|
||||
* @brief Convert C++ OccupancyGrid to C OccupancyGrid
|
||||
* @param cpp C++ OccupancyGrid
|
||||
* @param out C OccupancyGrid
|
||||
*/
|
||||
void convert2COccupancyGrid(const robot_nav_msgs::OccupancyGrid& cpp, OccupancyGrid& out);
|
||||
|
||||
/**
|
||||
* @brief Convert C++ LaserScan to C LaserScan
|
||||
* @param cpp C++ LaserScan
|
||||
* @param out C LaserScan
|
||||
*/
|
||||
void convert2CLaserScan(const robot_sensor_msgs::LaserScan& cpp, LaserScan& out);
|
||||
|
||||
/**
|
||||
* @brief Convert C++ PointCloud to C PointCloud
|
||||
* @param cpp C++ PointCloud
|
||||
* @param out C PointCloud
|
||||
*/
|
||||
void convert2CPointCloud(const robot_sensor_msgs::PointCloud& cpp, PointCloud& out);
|
||||
|
||||
/**
|
||||
* @brief Convert C++ PointCloud2 to C PointCloud2
|
||||
* @param cpp C++ PointCloud2
|
||||
* @param out C PointCloud2
|
||||
*/
|
||||
void convert2CPointCloud2(const robot_sensor_msgs::PointCloud2& cpp, PointCloud2& out);
|
||||
|
||||
/**
|
||||
* @brief Convert C PointCloud to C++ PointCloud
|
||||
* @param c C PointCloud
|
||||
* @return C++ PointCloud
|
||||
*/
|
||||
robot_sensor_msgs::PointCloud convert2CppPointCloud(const PointCloud& c);
|
||||
|
||||
/**
|
||||
* @brief Convert C PointCloud2 to C++ PointCloud2
|
||||
* @param c C PointCloud2
|
||||
* @return C++ PointCloud2
|
||||
*/
|
||||
robot_sensor_msgs::PointCloud2 convert2CppPointCloud2(const PointCloud2& c);
|
||||
|
||||
/**
|
||||
* @brief Convert C Odometry to C++ Odometry
|
||||
* @param odometry C Odometry
|
||||
* @return C++ Odometry
|
||||
*/
|
||||
robot_nav_msgs::Odometry convert2CppOdometry(const Odometry& odometry);
|
||||
|
||||
/**
|
||||
* @brief Convert C PoseStamped to C++ PoseStamped
|
||||
* @param pose_stamped C PoseStamped
|
||||
* @return C++ PoseStamped
|
||||
*/
|
||||
robot_geometry_msgs::PoseStamped convert2CppPoseStamped(const PoseStamped& pose_stamped);
|
||||
|
||||
/**
|
||||
* @brief Convert C++ PoseStamped to C PoseStamped
|
||||
* @param cpp_pose_stamped C++ PoseStamped
|
||||
* @return C PoseStamped
|
||||
*/
|
||||
PoseStamped convert2CPoseStamped(const robot_geometry_msgs::PoseStamped& cpp_pose_stamped);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert C Pose2D to C++ Pose2D
|
||||
* @param pose_2d C Pose2D
|
||||
* @return C++ Pose2D
|
||||
*/
|
||||
robot_geometry_msgs::Pose2D convert2CppPose2D(const Pose2D& pose_2d);
|
||||
|
||||
/**
|
||||
* @brief Convert C++ Pose2D to C Pose2D
|
||||
* @param cpp_pose_2d C++ Pose2D
|
||||
* @return C Pose2D
|
||||
*/
|
||||
Pose2D convert2CPose2D(const robot_geometry_msgs::Pose2D& cpp_pose_2d);
|
||||
|
||||
/**
|
||||
* @brief Convert C Twist2D to C++ Twist2D
|
||||
* @param twist_2d C Twist2D
|
||||
* @return C++ Twist2D
|
||||
*/
|
||||
robot_nav_2d_msgs::Twist2D convert2CppTwist2D(const Twist2D& twist_2d);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert C++ Twist2D to C Twist2D
|
||||
* @param cpp_twist_2d C++ Twist2D
|
||||
* @return C Twist2D
|
||||
*/
|
||||
Twist2D convert2CTwist2D(const robot_nav_2d_msgs::Twist2D& cpp_twist_2d);
|
||||
|
||||
/**
|
||||
* @brief Convert C Twist2DStamped to C++ Twist2DStamped
|
||||
* @param twist_2d_stamped C Twist2DStamped
|
||||
* @return C++ Twist2DStamped
|
||||
*/
|
||||
robot_nav_2d_msgs::Twist2DStamped convert2CppTwist2DStamped(const Twist2DStamped& twist_2d_stamped);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert C++ Twist2DStamped to C Twist2DStamped
|
||||
* @param cpp_twist_2d_stamped C++ Twist2DStamped
|
||||
* @return C Twist2DStamped
|
||||
*/
|
||||
Twist2DStamped convert2CTwist2DStamped(const robot_nav_2d_msgs::Twist2DStamped& cpp_twist_2d_stamped);
|
||||
|
||||
#endif // C_API_CONVERTOR_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/Accel.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/Accel.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_ACCEL_H
|
||||
#define C_API_GEOMETRY_MSGS_ACCEL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Vector3.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Vector3 linear;
|
||||
Vector3 angular;
|
||||
} Accel;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_ACCEL_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/AccelStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/AccelStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_ACCELSTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_ACCELSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Accel.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Accel accel;
|
||||
} AccelStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_ACCELSTAMPED_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/AccelWithCovariance.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/AccelWithCovariance.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCE_H
|
||||
#define C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Accel.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Accel accel;
|
||||
double covariance[36];
|
||||
} AccelWithCovariance;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCE_H
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCESTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCESTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/AccelWithCovariance.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
AccelWithCovariance accel;
|
||||
} AccelWithCovarianceStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCESTAMPED_H
|
||||
28
src/APIs/c_api/include/geometry_msgs/Inertia.h
Normal file
28
src/APIs/c_api/include/geometry_msgs/Inertia.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_INERTIA_H
|
||||
#define C_API_GEOMETRY_MSGS_INERTIA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Vector3.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double m;
|
||||
Vector3 com;
|
||||
double ixx;
|
||||
double ixy;
|
||||
double ixz;
|
||||
double iyy;
|
||||
double iyz;
|
||||
double izz;
|
||||
} Inertia;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_INERTIA_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/InertiaStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/InertiaStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_INERTIASTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_INERTIASTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Inertia.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Inertia inertia;
|
||||
} InertiaStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_INERTIASTAMPED_H
|
||||
21
src/APIs/c_api/include/geometry_msgs/Point.h
Normal file
21
src/APIs/c_api/include/geometry_msgs/Point.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POINT_H
|
||||
#define C_API_GEOMETRY_MSGS_POINT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
} Point;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // C_API_GEOMETRY_MSGS_POINT_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/Point32.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/Point32.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POINT32_H
|
||||
#define C_API_GEOMETRY_MSGS_POINT32_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} Point32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POINT32_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/PointStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/PointStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POINTSTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_POINTSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Point.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Point point;
|
||||
} PointStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POINTSTAMPED_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/Polygon.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/Polygon.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POLYGON_H
|
||||
#define C_API_GEOMETRY_MSGS_POLYGON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Point32.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Point32 *points;
|
||||
size_t points_count;
|
||||
} Polygon;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POLYGON_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/PolygonStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/PolygonStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POLYGONSTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_POLYGONSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Polygon.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Polygon polygon;
|
||||
} PolygonStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POLYGONSTAMPED_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/Pose.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/Pose.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POSE_H
|
||||
#define C_API_GEOMETRY_MSGS_POSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Point.h"
|
||||
#include "geometry_msgs/Quaternion.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Point position;
|
||||
Quaternion orientation;
|
||||
} Pose;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POSE_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/Pose2D.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/Pose2D.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POSE2D_H
|
||||
#define C_API_GEOMETRY_MSGS_POSE2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double theta;
|
||||
} Pose2D;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POSE2D_H
|
||||
24
src/APIs/c_api/include/geometry_msgs/PoseArray.h
Normal file
24
src/APIs/c_api/include/geometry_msgs/PoseArray.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POSEARRAY_H
|
||||
#define C_API_GEOMETRY_MSGS_POSEARRAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Pose.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Pose *poses;
|
||||
size_t poses_count;
|
||||
} PoseArray;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POSEARRAY_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/PoseStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/PoseStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POSESTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_POSESTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Pose.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Pose pose;
|
||||
} PoseStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POSESTAMPED_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/PoseWithCovariance.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/PoseWithCovariance.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCE_H
|
||||
#define C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Pose.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Pose pose;
|
||||
double *covariance;
|
||||
size_t covariance_count;
|
||||
} PoseWithCovariance;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCE_H
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCESTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCESTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/PoseWithCovariance.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
PoseWithCovariance pose;
|
||||
} PoseWithCovarianceStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCESTAMPED_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/Quaternion.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/Quaternion.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_QUATERNION_H
|
||||
#define C_API_GEOMETRY_MSGS_QUATERNION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
double w;
|
||||
} Quaternion;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_QUATERNION_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/QuaternionStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/QuaternionStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_QUATERNIONSTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_QUATERNIONSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Quaternion.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Quaternion quaternion;
|
||||
} QuaternionStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_QUATERNIONSTAMPED_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/Transform.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/Transform.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_TRANSFORM_H
|
||||
#define C_API_GEOMETRY_MSGS_TRANSFORM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Vector3.h"
|
||||
#include "geometry_msgs/Quaternion.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Vector3 translation;
|
||||
Quaternion rotation;
|
||||
} Transform;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_TRANSFORM_H
|
||||
24
src/APIs/c_api/include/geometry_msgs/TransformStamped.h
Normal file
24
src/APIs/c_api/include/geometry_msgs/TransformStamped.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_TRANSFORMSTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_TRANSFORMSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Transform.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
char *child_frame_id;
|
||||
Transform transform;
|
||||
} TransformStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_TRANSFORMSTAMPED_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/Twist.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/Twist.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_TWIST_H
|
||||
#define C_API_GEOMETRY_MSGS_TWIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Vector3.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Vector3 linear;
|
||||
Vector3 angular;
|
||||
} Twist;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_TWIST_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/TwistStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/TwistStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_TWISTSTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_TWISTSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Twist.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Twist twist;
|
||||
} TwistStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_TWISTSTAMPED_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/TwistWithCovariance.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/TwistWithCovariance.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCE_H
|
||||
#define C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Twist.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Twist twist;
|
||||
double *covariance;
|
||||
size_t covariance_count;
|
||||
} TwistWithCovariance;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCE_H
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCESTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCESTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/TwistWithCovariance.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
TwistWithCovariance twist;
|
||||
} TwistWithCovarianceStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCESTAMPED_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/Vector3.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/Vector3.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_VECTOR3_H
|
||||
#define C_API_GEOMETRY_MSGS_VECTOR3_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
} Vector3;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_VECTOR3_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/Vector3Stamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/Vector3Stamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_VECTOR3STAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_VECTOR3STAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Vector3.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Vector3 vector;
|
||||
} Vector3Stamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_VECTOR3STAMPED_H
|
||||
22
src/APIs/c_api/include/geometry_msgs/Wrench.h
Normal file
22
src/APIs/c_api/include/geometry_msgs/Wrench.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_WRENCH_H
|
||||
#define C_API_GEOMETRY_MSGS_WRENCH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/Vector3.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Vector3 force;
|
||||
Vector3 torque;
|
||||
} Wrench;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_WRENCH_H
|
||||
23
src/APIs/c_api/include/geometry_msgs/WrenchStamped.h
Normal file
23
src/APIs/c_api/include/geometry_msgs/WrenchStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_GEOMETRY_MSGS_WRENCHSTAMPED_H
|
||||
#define C_API_GEOMETRY_MSGS_WRENCHSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Wrench.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Wrench wrench;
|
||||
} WrenchStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_GEOMETRY_MSGS_WRENCHSTAMPED_H
|
||||
33
src/APIs/c_api/include/map_msgs/OccupancyGridUpdate.h
Normal file
33
src/APIs/c_api/include/map_msgs/OccupancyGridUpdate.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef C_API_ROBOT_MAP_MSGS_OCCUPANCYGRIDUPDATE_C_H
|
||||
#define C_API_ROBOT_MAP_MSGS_OCCUPANCYGRIDUPDATE_C_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
/**
|
||||
* C representation of robot_map_msgs::OccupancyGridUpdate.
|
||||
* Note: This header is intentionally named *_c.h to avoid
|
||||
* shadowing the C++ header `robot_map_msgs/OccupancyGridUpdate.h`.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int8_t *data;
|
||||
size_t data_count;
|
||||
} OccupancyGridUpdate;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_ROBOT_MAP_MSGS_OCCUPANCYGRIDUPDATE_C_H
|
||||
|
||||
23
src/APIs/c_api/include/nav_2d_msgs/ComplexPolygon2D.h
Normal file
23
src/APIs/c_api/include/nav_2d_msgs/ComplexPolygon2D.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_COMPLEXPOLYGON2D_H
|
||||
#define C_API_NAV_2D_MSGS_COMPLEXPOLYGON2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_2d_msgs/Polygon2D.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Polygon2D outer;
|
||||
Polygon2D *inner;
|
||||
size_t inner_count;
|
||||
} ComplexPolygon2D;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_COMPLEXPOLYGON2D_H
|
||||
25
src/APIs/c_api/include/nav_2d_msgs/NavGridInfo.h
Normal file
25
src/APIs/c_api/include/nav_2d_msgs/NavGridInfo.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_NAVGRIDINFO_H
|
||||
#define C_API_NAV_2D_MSGS_NAVGRIDINFO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
double resolution;
|
||||
char *frame_id;
|
||||
double origin_x;
|
||||
double origin_y;
|
||||
} NavGridInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_NAVGRIDINFO_H
|
||||
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfChars.h
Normal file
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfChars.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFCHARS_H
|
||||
#define C_API_NAV_2D_MSGS_NAVGRIDOFCHARS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Time.h"
|
||||
#include "nav_2d_msgs/NavGridInfo.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Time stamp;
|
||||
NavGridInfo info;
|
||||
uint8_t *data;
|
||||
size_t data_count;
|
||||
} NavGridOfChars;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_NAVGRIDOFCHARS_H
|
||||
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfCharsUpdate.h
Normal file
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfCharsUpdate.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFCHARSUPDATE_H
|
||||
#define C_API_NAV_2D_MSGS_NAVGRIDOFCHARSUPDATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Time.h"
|
||||
#include "nav_2d_msgs/UIntBounds.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Time stamp;
|
||||
UIntBounds bounds;
|
||||
uint8_t *data;
|
||||
size_t data_count;
|
||||
} NavGridOfCharsUpdate;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_NAVGRIDOFCHARSUPDATE_H
|
||||
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoubles.h
Normal file
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoubles.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLES_H
|
||||
#define C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Time.h"
|
||||
#include "nav_2d_msgs/NavGridInfo.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Time stamp;
|
||||
NavGridInfo info;
|
||||
double *data;
|
||||
size_t data_count;
|
||||
} NavGridOfDoubles;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLES_H
|
||||
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoublesUpdate.h
Normal file
25
src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoublesUpdate.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLESUPDATE_H
|
||||
#define C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLESUPDATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Time.h"
|
||||
#include "nav_2d_msgs/UIntBounds.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Time stamp;
|
||||
UIntBounds bounds;
|
||||
double *data;
|
||||
size_t data_count;
|
||||
} NavGridOfDoublesUpdate;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLESUPDATE_H
|
||||
24
src/APIs/c_api/include/nav_2d_msgs/Path2D.h
Normal file
24
src/APIs/c_api/include/nav_2d_msgs/Path2D.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_PATH2D_H
|
||||
#define C_API_NAV_2D_MSGS_PATH2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_2d_msgs/Pose2DStamped.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Pose2DStamped *poses;
|
||||
size_t poses_count;
|
||||
} Path2D;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_PATH2D_H
|
||||
21
src/APIs/c_api/include/nav_2d_msgs/Point2D.h
Normal file
21
src/APIs/c_api/include/nav_2d_msgs/Point2D.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_POINT2D_H
|
||||
#define C_API_NAV_2D_MSGS_POINT2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
} Point2D;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_POINT2D_H
|
||||
22
src/APIs/c_api/include/nav_2d_msgs/Polygon2D.h
Normal file
22
src/APIs/c_api/include/nav_2d_msgs/Polygon2D.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_POLYGON2D_H
|
||||
#define C_API_NAV_2D_MSGS_POLYGON2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_2d_msgs/Point2D.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Point2D *points;
|
||||
size_t points_count;
|
||||
} Polygon2D;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_POLYGON2D_H
|
||||
27
src/APIs/c_api/include/nav_2d_msgs/Polygon2DCollection.h
Normal file
27
src/APIs/c_api/include/nav_2d_msgs/Polygon2DCollection.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_POLYGON2DCOLLECTION_H
|
||||
#define C_API_NAV_2D_MSGS_POLYGON2DCOLLECTION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "std_msgs/ColorRGBA.h"
|
||||
#include "nav_2d_msgs/ComplexPolygon2D.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
ComplexPolygon2D *polygons;
|
||||
size_t polygons_count;
|
||||
ColorRGBA *colors;
|
||||
size_t colors_count;
|
||||
} Polygon2DCollection;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_POLYGON2DCOLLECTION_H
|
||||
23
src/APIs/c_api/include/nav_2d_msgs/Polygon2DStamped.h
Normal file
23
src/APIs/c_api/include/nav_2d_msgs/Polygon2DStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_POLYGON2DSTAMPED_H
|
||||
#define C_API_NAV_2D_MSGS_POLYGON2DSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_2d_msgs/Polygon2D.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Polygon2D polygon;
|
||||
} Polygon2DStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_POLYGON2DSTAMPED_H
|
||||
22
src/APIs/c_api/include/nav_2d_msgs/Pose2D32.h
Normal file
22
src/APIs/c_api/include/nav_2d_msgs/Pose2D32.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_POSE2D32_H
|
||||
#define C_API_NAV_2D_MSGS_POSE2D32_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float theta;
|
||||
} Pose2D32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_POSE2D32_H
|
||||
23
src/APIs/c_api/include/nav_2d_msgs/Pose2DStamped.h
Normal file
23
src/APIs/c_api/include/nav_2d_msgs/Pose2DStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_POSE2DSTAMPED_H
|
||||
#define C_API_NAV_2D_MSGS_POSE2DSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Pose2D.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Pose2D pose;
|
||||
} Pose2DStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_POSE2DSTAMPED_H
|
||||
23
src/APIs/c_api/include/nav_2d_msgs/SwitchPlugin.h
Normal file
23
src/APIs/c_api/include/nav_2d_msgs/SwitchPlugin.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_SWITCHPLUGIN_H
|
||||
#define C_API_NAV_2D_MSGS_SWITCHPLUGIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_2d_msgs/SwitchPluginRequest.h"
|
||||
#include "nav_2d_msgs/SwitchPluginResponse.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SwitchPluginRequest request;
|
||||
SwitchPluginResponse response;
|
||||
} SwitchPlugin;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_SWITCHPLUGIN_H
|
||||
20
src/APIs/c_api/include/nav_2d_msgs/SwitchPluginRequest.h
Normal file
20
src/APIs/c_api/include/nav_2d_msgs/SwitchPluginRequest.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_SWITCHPLUGINREQUEST_H
|
||||
#define C_API_NAV_2D_MSGS_SWITCHPLUGINREQUEST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *new_plugin;
|
||||
} SwitchPluginRequest;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_SWITCHPLUGINREQUEST_H
|
||||
21
src/APIs/c_api/include/nav_2d_msgs/SwitchPluginResponse.h
Normal file
21
src/APIs/c_api/include/nav_2d_msgs/SwitchPluginResponse.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_SWITCHPLUGINRESPONSE_H
|
||||
#define C_API_NAV_2D_MSGS_SWITCHPLUGINRESPONSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t success;
|
||||
char *message;
|
||||
} SwitchPluginResponse;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_SWITCHPLUGINRESPONSE_H
|
||||
22
src/APIs/c_api/include/nav_2d_msgs/Twist2D.h
Normal file
22
src/APIs/c_api/include/nav_2d_msgs/Twist2D.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_TWIST2D_H
|
||||
#define C_API_NAV_2D_MSGS_TWIST2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double theta;
|
||||
} Twist2D;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_TWIST2D_H
|
||||
22
src/APIs/c_api/include/nav_2d_msgs/Twist2D32.h
Normal file
22
src/APIs/c_api/include/nav_2d_msgs/Twist2D32.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_TWIST2D32_H
|
||||
#define C_API_NAV_2D_MSGS_TWIST2D32_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float theta;
|
||||
} Twist2D32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_TWIST2D32_H
|
||||
23
src/APIs/c_api/include/nav_2d_msgs/Twist2DStamped.h
Normal file
23
src/APIs/c_api/include/nav_2d_msgs/Twist2DStamped.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_TWIST2DSTAMPED_H
|
||||
#define C_API_NAV_2D_MSGS_TWIST2DSTAMPED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_2d_msgs/Twist2D.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Twist2D velocity;
|
||||
} Twist2DStamped;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_TWIST2DSTAMPED_H
|
||||
23
src/APIs/c_api/include/nav_2d_msgs/UIntBounds.h
Normal file
23
src/APIs/c_api/include/nav_2d_msgs/UIntBounds.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_2D_MSGS_UINTBOUNDS_H
|
||||
#define C_API_NAV_2D_MSGS_UINTBOUNDS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t min_x;
|
||||
uint32_t min_y;
|
||||
uint32_t max_x;
|
||||
uint32_t max_y;
|
||||
} UIntBounds;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_2D_MSGS_UINTBOUNDS_H
|
||||
@@ -6,154 +6,58 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
/* C struct types only - do not include convertor.h here (it pulls C++ code into extern "C") */
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Point.h"
|
||||
#include "geometry_msgs/Pose2D.h"
|
||||
#include "geometry_msgs/PoseStamped.h"
|
||||
#include "nav_msgs/OccupancyGrid.h"
|
||||
#include "nav_msgs/Odometry.h"
|
||||
#include "map_msgs/OccupancyGridUpdate.h"
|
||||
#include "nav_2d_msgs/Twist2D.h"
|
||||
#include "nav_2d_msgs/Twist2DStamped.h"
|
||||
#include "nav_2d_msgs/Path2D.h"
|
||||
#include "sensor_msgs/LaserScan.h"
|
||||
#include "sensor_msgs/PointCloud.h"
|
||||
#include "sensor_msgs/PointCloud2.h"
|
||||
#include "geometry_msgs/PolygonStamped.h"
|
||||
|
||||
// Forward declarations
|
||||
typedef void *NavigationHandle;
|
||||
typedef void *TFListenerHandle;
|
||||
typedef void *OccupancyGridHandle;
|
||||
typedef void *OccupancyGridUpdateHandle;
|
||||
typedef void *LaserScanHandle;
|
||||
typedef void *PointCloudHandle;
|
||||
typedef void *PointCloud2Handle;
|
||||
typedef void *OdometryHandle;
|
||||
typedef void *Path2DHandle;
|
||||
typedef void *PolygonStampedHandle;
|
||||
typedef void *OrderHandle;
|
||||
typedef struct { char *name; OccupancyGrid grid; } NamedOccupancyGrid;
|
||||
typedef struct { char *name; LaserScan scan; } NamedLaserScan;
|
||||
typedef struct { char *name; PointCloud cloud; } NamedPointCloud;
|
||||
typedef struct { char *name; PointCloud2 cloud; } NamedPointCloud2;
|
||||
|
||||
// ============================================================================
|
||||
// Enums
|
||||
// ============================================================================
|
||||
typedef struct
|
||||
{
|
||||
void *ptr;
|
||||
} NavigationHandle;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *ptr;
|
||||
} TFListenerHandle;
|
||||
|
||||
/**
|
||||
* @brief Navigation states, including planning and controller status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NAV_STATE_PENDING = 0,
|
||||
NAV_STATE_ACTIVE = 1,
|
||||
NAV_STATE_PREEMPTED = 2,
|
||||
NAV_STATE_SUCCEEDED = 3,
|
||||
NAV_STATE_ABORTED = 4,
|
||||
NAV_STATE_REJECTED = 5,
|
||||
NAV_STATE_PREEMPTING = 6,
|
||||
NAV_STATE_RECALLING = 7,
|
||||
NAV_STATE_RECALLED = 8,
|
||||
NAV_STATE_LOST = 9,
|
||||
NAV_STATE_PLANNING = 10,
|
||||
NAV_STATE_CONTROLLING = 11,
|
||||
NAV_STATE_CLEARING = 12,
|
||||
NAV_STATE_PAUSED = 13
|
||||
PENDING = 0,
|
||||
ACTIVE = 1,
|
||||
PREEMPTED = 2,
|
||||
SUCCEEDED = 3,
|
||||
ABORTED = 4,
|
||||
REJECTED = 5,
|
||||
PREEMPTING = 6,
|
||||
RECALLING = 7,
|
||||
RECALLED = 8,
|
||||
LOST = 9,
|
||||
PLANNING = 10,
|
||||
CONTROLLING = 11,
|
||||
CLEARING = 12,
|
||||
PAUSED = 13
|
||||
} NavigationState;
|
||||
|
||||
// ============================================================================
|
||||
// Structures
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Point structure (x, y, z)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
} Point;
|
||||
|
||||
/**
|
||||
* @brief Pose2D structure (x, y, theta)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double theta;
|
||||
} Pose2D;
|
||||
|
||||
/**
|
||||
* @brief Twist2D structure (x, y, theta velocities)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double theta;
|
||||
} Twist2D;
|
||||
|
||||
/**
|
||||
* @brief Quaternion structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
double w;
|
||||
} Quaternion;
|
||||
|
||||
/**
|
||||
* @brief Position structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
} Position;
|
||||
|
||||
/**
|
||||
* @brief Pose structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Position position;
|
||||
Quaternion orientation;
|
||||
} Pose;
|
||||
|
||||
/**
|
||||
* @brief Header structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t seq;
|
||||
int64_t sec;
|
||||
uint32_t nsec;
|
||||
char *frame_id;
|
||||
} Header;
|
||||
|
||||
/**
|
||||
* @brief PoseStamped structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Pose pose;
|
||||
} PoseStamped;
|
||||
|
||||
/**
|
||||
* @brief Twist2DStamped structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Twist2D velocity;
|
||||
} Twist2DStamped;
|
||||
|
||||
/**
|
||||
* @brief Vector3 structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
} Vector3;
|
||||
|
||||
/**
|
||||
* @brief Navigation feedback structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
NavigationState navigation_state;
|
||||
@@ -164,201 +68,24 @@ extern "C"
|
||||
} NavFeedback;
|
||||
|
||||
/**
|
||||
* @brief Named OccupancyGrid structure
|
||||
* @note map is an opaque handle to a C++ robot_nav_msgs::OccupancyGrid
|
||||
* @brief Planner data output structure (C version).
|
||||
* Mirrors robot::move_base_core::PlannerDataOutput in `move_base_core/navigation.h`.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
OccupancyGridHandle map;
|
||||
} NamedOccupancyGrid;
|
||||
|
||||
/**
|
||||
* @brief Named LaserScan structure
|
||||
* @note scan is an opaque handle to a C++ robot_sensor_msgs::LaserScan
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
LaserScanHandle scan;
|
||||
} NamedLaserScan;
|
||||
|
||||
/**
|
||||
* @brief Named PointCloud structure
|
||||
* @note cloud is an opaque handle to a C++ robot_sensor_msgs::PointCloud
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
PointCloudHandle cloud;
|
||||
} NamedPointCloud;
|
||||
|
||||
/**
|
||||
* @brief Named PointCloud2 structure
|
||||
* @note cloud is an opaque handle to a C++ robot_sensor_msgs::PointCloud2
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
PointCloud2Handle cloud;
|
||||
} NamedPointCloud2;
|
||||
|
||||
/**
|
||||
* @brief Planner data output structure (opaque message handles)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Path2DHandle plan;
|
||||
OccupancyGridHandle costmap;
|
||||
OccupancyGridUpdateHandle costmap_update;
|
||||
Path2D plan;
|
||||
OccupancyGrid costmap;
|
||||
OccupancyGridUpdate costmap_update;
|
||||
bool is_costmap_updated;
|
||||
PolygonStampedHandle footprint;
|
||||
PolygonStamped footprint;
|
||||
} PlannerDataOutput;
|
||||
|
||||
// ============================================================================
|
||||
// String Management
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Free a string allocated by the library
|
||||
* @param str String to free
|
||||
* @brief Free a string allocated by the API (e.g. feed_back_str, navigation_state_to_string result).
|
||||
* @param str Pointer from strdup; no-op if NULL.
|
||||
*/
|
||||
void nav_c_api_free_string(char *str);
|
||||
|
||||
// ============================================================================
|
||||
// Complex Message Handle Management
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Free an occupancy grid handle
|
||||
* @param handle Occupancy grid handle to free
|
||||
*/
|
||||
void navigation_free_occupancy_grid(OccupancyGridHandle handle);
|
||||
/**
|
||||
* @brief Free an occupancy grid update handle
|
||||
* @param handle Occupancy grid update handle to free
|
||||
*/
|
||||
void navigation_free_occupancy_grid_update(OccupancyGridUpdateHandle handle);
|
||||
|
||||
/**
|
||||
* @brief Free a laser scan handle
|
||||
* @param handle Laser scan handle to free
|
||||
*/
|
||||
void navigation_free_laser_scan(LaserScanHandle handle);
|
||||
|
||||
/**
|
||||
* @brief Free a point cloud handle
|
||||
* @param handle Point cloud handle to free
|
||||
*/
|
||||
void navigation_free_point_cloud(PointCloudHandle handle);
|
||||
|
||||
/**
|
||||
* @brief Free a point cloud2 handle
|
||||
* @param handle Point cloud2 handle to free
|
||||
*/
|
||||
void navigation_free_point_cloud2(PointCloud2Handle handle);
|
||||
|
||||
/**
|
||||
* @brief Free an odometry handle
|
||||
* @param handle Odometry handle to free
|
||||
*/
|
||||
void navigation_free_odometry(OdometryHandle handle);
|
||||
|
||||
/**
|
||||
* @brief Free a path2d handle
|
||||
* @param handle Path2d handle to free
|
||||
*/
|
||||
void navigation_free_path2d(Path2DHandle handle);
|
||||
|
||||
/**
|
||||
* @brief Free a polygon stamped handle
|
||||
* @param handle Polygon stamped handle to free
|
||||
*/
|
||||
void navigation_free_polygon_stamped(PolygonStampedHandle handle);
|
||||
|
||||
/**
|
||||
* @brief Free an order handle
|
||||
* @param handle Order handle to free
|
||||
*/
|
||||
void navigation_free_order(OrderHandle handle);
|
||||
|
||||
/**
|
||||
* @brief Free an array of named occupancy grids
|
||||
* @param maps Array of named occupancy grids to free
|
||||
* @param count Number of named occupancy grids in the array
|
||||
*/
|
||||
void navigation_free_named_occupancy_grids(NamedOccupancyGrid *maps, size_t count);
|
||||
|
||||
/**
|
||||
* @brief Free an array of named laser scans
|
||||
* @param scans Array of named laser scans to free
|
||||
* @param count Number of named laser scans in the array
|
||||
*/
|
||||
void navigation_free_named_laser_scans(NamedLaserScan *scans, size_t count);
|
||||
|
||||
/**
|
||||
* @brief Free an array of named point clouds
|
||||
* @param clouds Array of named point clouds to free
|
||||
* @param count Number of named point clouds in the array
|
||||
*/
|
||||
void navigation_free_named_point_clouds(NamedPointCloud *clouds, size_t count);
|
||||
|
||||
/**
|
||||
* @brief Free an array of named point cloud2s
|
||||
* @param clouds Array of named point cloud2s to free
|
||||
* @param count Number of named point cloud2s in the array
|
||||
*/
|
||||
void navigation_free_named_point_cloud2s(NamedPointCloud2 *clouds, size_t count);
|
||||
|
||||
/**
|
||||
* @brief Free a planner data output
|
||||
* @param data Planner data output to free
|
||||
*/
|
||||
void navigation_free_planner_data(PlannerDataOutput *data);
|
||||
|
||||
// ============================================================================
|
||||
// State Conversion
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Convert a State enum to its string representation
|
||||
* @param state Enum value of NavigationState
|
||||
* @return String representation (caller must free with nav_c_api_free_string)
|
||||
*/
|
||||
char *navigation_state_to_string(NavigationState state);
|
||||
|
||||
// ============================================================================
|
||||
// Helper Functions
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Creates a target pose by offsetting a given 2D pose along its heading direction
|
||||
* @param pose_x X coordinate of the original pose
|
||||
* @param pose_y Y coordinate of the original pose
|
||||
* @param pose_theta Heading angle in radians
|
||||
* @param frame_id The coordinate frame ID (null-terminated string)
|
||||
* @param offset_distance Distance to offset along heading (positive = forward, negative = backward)
|
||||
* @param out_goal Output parameter for the offset pose
|
||||
* @return true on success, false on failure
|
||||
*/
|
||||
bool navigation_offset_goal_2d(double pose_x, double pose_y, double pose_theta,
|
||||
const char *frame_id, double offset_distance,
|
||||
PoseStamped *out_goal);
|
||||
|
||||
/**
|
||||
* @brief Creates an offset target pose from a given PoseStamped
|
||||
* @param in_pose Input pose
|
||||
* @param offset_distance Distance to offset along heading direction
|
||||
* @param out_goal Output parameter for the offset pose
|
||||
* @return true on success, false on failure
|
||||
*/
|
||||
bool navigation_offset_goal_stamped(const PoseStamped *in_pose, double offset_distance,
|
||||
PoseStamped *out_goal);
|
||||
|
||||
// ============================================================================
|
||||
// Navigation Handle Management
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Create a new navigation instance
|
||||
* @return Navigation handle, or NULL on failure
|
||||
@@ -371,10 +98,6 @@ extern "C"
|
||||
*/
|
||||
void navigation_destroy(NavigationHandle handle);
|
||||
|
||||
// ============================================================================
|
||||
// TF Listener Management
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Create a TF listener instance
|
||||
* @return TF listener handle, or NULL on failure
|
||||
@@ -439,13 +162,8 @@ extern "C"
|
||||
* @param out_count Output number of points in the array
|
||||
* @return true on success, false on failure
|
||||
*/
|
||||
bool navigation_get_robot_footprint(NavigationHandle handle, Point **out_points, size_t *out_count);
|
||||
bool navigation_get_robot_footprint(NavigationHandle handle, Point *out_points, size_t &out_count);
|
||||
|
||||
/**
|
||||
* @brief Free a points array allocated by navigation_get_robot_footprint
|
||||
* @param points Pointer to point array
|
||||
*/
|
||||
void navigation_free_points(Point *points);
|
||||
|
||||
/**
|
||||
* @brief Send a goal for the robot to navigate to
|
||||
@@ -455,21 +173,21 @@ extern "C"
|
||||
* @param yaw_goal_tolerance Acceptable angular error (radians)
|
||||
* @return true if goal was accepted and sent successfully
|
||||
*/
|
||||
bool navigation_move_to(NavigationHandle handle, const PoseStamped *goal,
|
||||
bool navigation_move_to(NavigationHandle handle, const PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
/**
|
||||
* @brief Send a goal for the robot to navigate to
|
||||
* @param handle Navigation handle
|
||||
* @param order Order message
|
||||
* @param goal Target pose in the global frame
|
||||
* @param xy_goal_tolerance Acceptable error in X/Y (meters)
|
||||
* @param yaw_goal_tolerance Acceptable angular error (radians)
|
||||
* @return true if goal was accepted and sent successfully
|
||||
*/
|
||||
bool navigation_move_to_order(NavigationHandle handle, const OrderHandle order,
|
||||
const PoseStamped *goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
// /**
|
||||
// * @brief Send a goal for the robot to navigate to
|
||||
// * @param handle Navigation handle
|
||||
// * @param order Order message
|
||||
// * @param goal Target pose in the global frame
|
||||
// * @param xy_goal_tolerance Acceptable error in X/Y (meters)
|
||||
// * @param yaw_goal_tolerance Acceptable angular error (radians)
|
||||
// * @return true if goal was accepted and sent successfully
|
||||
// */
|
||||
// bool navigation_move_to_order(NavigationHandle handle, const OrderHandle order,
|
||||
// const PoseStamped &goal,
|
||||
// double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
/**
|
||||
* @brief Send a docking goal to a predefined marker
|
||||
@@ -481,21 +199,21 @@ extern "C"
|
||||
* @return true if docking command succeeded
|
||||
*/
|
||||
bool navigation_dock_to(NavigationHandle handle, const char *marker,
|
||||
const PoseStamped *goal,
|
||||
const PoseStamped goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
/**
|
||||
* @brief Send a docking goal to a predefined marker
|
||||
* @param handle Navigation handle
|
||||
* @param order Order message
|
||||
* @param goal Target pose for docking
|
||||
* @param xy_goal_tolerance Acceptable XY error (meters)
|
||||
* @param yaw_goal_tolerance Acceptable heading error (radians)
|
||||
* @return true if docking command succeeded
|
||||
*/
|
||||
bool navigation_dock_to_order(NavigationHandle handle, const OrderHandle order,
|
||||
const PoseStamped *goal,
|
||||
double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
// /**
|
||||
// * @brief Send a docking goal to a predefined marker
|
||||
// * @param handle Navigation handle
|
||||
// * @param order Order message
|
||||
// * @param goal Target pose for docking
|
||||
// * @param xy_goal_tolerance Acceptable XY error (meters)
|
||||
// * @param yaw_goal_tolerance Acceptable heading error (radians)
|
||||
// * @return true if docking command succeeded
|
||||
// */
|
||||
// bool navigation_dock_to_order(NavigationHandle handle, const OrderHandle order,
|
||||
// const PoseStamped &goal,
|
||||
// double xy_goal_tolerance, double yaw_goal_tolerance);
|
||||
|
||||
/**
|
||||
* @brief Move straight toward the target position
|
||||
@@ -504,7 +222,7 @@ extern "C"
|
||||
* @param xy_goal_tolerance Acceptable positional error (meters)
|
||||
* @return true if command issued successfully
|
||||
*/
|
||||
bool navigation_move_straight_to(NavigationHandle handle, const PoseStamped *goal,
|
||||
bool navigation_move_straight_to(NavigationHandle handle, const PoseStamped goal,
|
||||
double xy_goal_tolerance);
|
||||
|
||||
/**
|
||||
@@ -514,7 +232,7 @@ extern "C"
|
||||
* @param yaw_goal_tolerance Acceptable angular error (radians)
|
||||
* @return true if rotation command was sent successfully
|
||||
*/
|
||||
bool navigation_rotate_to(NavigationHandle handle, const PoseStamped *goal,
|
||||
bool navigation_rotate_to(NavigationHandle handle, const PoseStamped goal,
|
||||
double yaw_goal_tolerance);
|
||||
|
||||
/**
|
||||
@@ -563,7 +281,7 @@ extern "C"
|
||||
* @param out_pose Output parameter with the robot's current pose
|
||||
* @return true if pose was successfully retrieved
|
||||
*/
|
||||
bool navigation_get_robot_pose_stamped(NavigationHandle handle, PoseStamped *out_pose);
|
||||
bool navigation_get_robot_pose_stamped(NavigationHandle handle, PoseStamped &out_pose);
|
||||
|
||||
/**
|
||||
* @brief Get the robot's pose as a 2D pose
|
||||
@@ -571,7 +289,7 @@ extern "C"
|
||||
* @param out_pose Output parameter with the robot's current 2D pose
|
||||
* @return true if pose was successfully retrieved
|
||||
*/
|
||||
bool navigation_get_robot_pose_2d(NavigationHandle handle, Pose2D *out_pose);
|
||||
bool navigation_get_robot_pose_2d(NavigationHandle handle, Pose2D &out_pose);
|
||||
|
||||
/**
|
||||
* @brief Get the robot's current twist
|
||||
@@ -580,7 +298,7 @@ extern "C"
|
||||
* @return true if twist was successfully retrieved
|
||||
* @note out_twist->header.frame_id must be freed using nav_c_api_free_string
|
||||
*/
|
||||
bool navigation_get_twist(NavigationHandle handle, Twist2DStamped *out_twist);
|
||||
bool navigation_get_twist(NavigationHandle handle, Twist2DStamped &out_twist);
|
||||
|
||||
/**
|
||||
* @brief Get navigation feedback
|
||||
@@ -589,13 +307,7 @@ extern "C"
|
||||
* @return true if feedback was successfully retrieved
|
||||
* @note The feed_back_str field must be freed using nav_c_api_free_string
|
||||
*/
|
||||
bool navigation_get_feedback(NavigationHandle handle, NavFeedback *out_feedback);
|
||||
|
||||
/**
|
||||
* @brief Free navigation feedback structure
|
||||
* @param feedback Feedback structure to free
|
||||
*/
|
||||
void navigation_free_feedback(NavFeedback *feedback);
|
||||
bool navigation_get_feedback(NavigationHandle handle, NavFeedback &out_feedback);
|
||||
|
||||
/**
|
||||
* @brief Add a static map to the navigation system
|
||||
@@ -604,7 +316,7 @@ extern "C"
|
||||
* @param map Occupancy grid handle
|
||||
* @return true if the map was added successfully
|
||||
*/
|
||||
bool navigation_add_static_map(NavigationHandle handle, const char *map_name, OccupancyGridHandle map);
|
||||
bool navigation_add_static_map(NavigationHandle handle, const char *map_name, const OccupancyGrid occupancy_grid);
|
||||
|
||||
/**
|
||||
* @brief Add a laser scan to the navigation system
|
||||
@@ -613,7 +325,7 @@ extern "C"
|
||||
* @param laser_scan Laser scan handle
|
||||
* @return true if the laser scan was added successfully
|
||||
*/
|
||||
bool navigation_add_laser_scan(NavigationHandle handle, const char *laser_scan_name, LaserScanHandle laser_scan);
|
||||
bool navigation_add_laser_scan(NavigationHandle handle, const char *laser_scan_name, const LaserScan laser_scan);
|
||||
|
||||
/**
|
||||
* @brief Add a point cloud to the navigation system
|
||||
@@ -622,7 +334,7 @@ extern "C"
|
||||
* @param point_cloud Point cloud handle
|
||||
* @return true if the point cloud was added successfully
|
||||
*/
|
||||
bool navigation_add_point_cloud(NavigationHandle handle, const char *point_cloud_name, PointCloudHandle point_cloud);
|
||||
bool navigation_add_point_cloud(NavigationHandle handle, const char *point_cloud_name, const PointCloud point_cloud);
|
||||
|
||||
/**
|
||||
* @brief Add a point cloud2 to the navigation system
|
||||
@@ -631,7 +343,7 @@ extern "C"
|
||||
* @param point_cloud2 Point cloud2 handle
|
||||
* @return true if the point cloud2 was added successfully
|
||||
*/
|
||||
bool navigation_add_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, PointCloud2Handle point_cloud2);
|
||||
bool navigation_add_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, const PointCloud2 point_cloud2);
|
||||
|
||||
/**
|
||||
* @brief Add an odometry to the navigation system
|
||||
@@ -640,7 +352,7 @@ extern "C"
|
||||
* @param odometry Odometry handle
|
||||
* @return true if the odometry was added successfully
|
||||
*/
|
||||
bool navigation_add_odometry(NavigationHandle handle, const char *odometry_name, OdometryHandle odometry);
|
||||
bool navigation_add_odometry(NavigationHandle handle, const char *odometry_name, const Odometry odometry);
|
||||
|
||||
/**
|
||||
* @brief Get a static map from the navigation system
|
||||
@@ -649,7 +361,7 @@ extern "C"
|
||||
* @param out_map Output parameter for the map handle
|
||||
* @return true if the map was retrieved successfully
|
||||
*/
|
||||
bool navigation_get_static_map(NavigationHandle handle, const char *map_name, OccupancyGridHandle *out_map);
|
||||
bool navigation_get_static_map(NavigationHandle handle, const char *map_name, OccupancyGrid &out_map);
|
||||
|
||||
/**
|
||||
* @brief Get a laser scan from the navigation system
|
||||
@@ -658,7 +370,7 @@ extern "C"
|
||||
* @param out_scan Output parameter for the laser scan handle
|
||||
* @return true if the laser scan was retrieved successfully
|
||||
*/
|
||||
bool navigation_get_laser_scan(NavigationHandle handle, const char *laser_scan_name, LaserScanHandle *out_scan);
|
||||
bool navigation_get_laser_scan(NavigationHandle handle, const char *laser_scan_name, LaserScan &out_scan);
|
||||
|
||||
/**
|
||||
* @brief Get a point cloud from the navigation system
|
||||
@@ -667,7 +379,7 @@ extern "C"
|
||||
* @param out_cloud Output parameter for the point cloud handle
|
||||
* @return true if the point cloud was retrieved successfully
|
||||
*/
|
||||
bool navigation_get_point_cloud(NavigationHandle handle, const char *point_cloud_name, PointCloudHandle *out_cloud);
|
||||
bool navigation_get_point_cloud(NavigationHandle handle, const char *point_cloud_name, PointCloud &out_cloud);
|
||||
|
||||
/**
|
||||
* @brief Get a point cloud2 from the navigation system
|
||||
@@ -676,7 +388,7 @@ extern "C"
|
||||
* @param out_cloud Output parameter for the point cloud2 handle
|
||||
* @return true if the point cloud2 was retrieved successfully
|
||||
*/
|
||||
bool navigation_get_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, PointCloud2Handle *out_cloud);
|
||||
bool navigation_get_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, PointCloud2 &out_cloud);
|
||||
|
||||
/**
|
||||
* @brief Get all static maps from the navigation system
|
||||
@@ -685,7 +397,7 @@ extern "C"
|
||||
* @param out_count Output parameter for the number of maps
|
||||
* @return true if the maps were retrieved successfully
|
||||
*/
|
||||
bool navigation_get_all_static_maps(NavigationHandle handle, NamedOccupancyGrid **out_maps, size_t *out_count);
|
||||
bool navigation_get_all_static_maps(NavigationHandle handle, NamedOccupancyGrid *out_maps, size_t &out_count);
|
||||
|
||||
/**
|
||||
* @brief Get all laser scans from the navigation system
|
||||
@@ -694,7 +406,7 @@ extern "C"
|
||||
* @param out_count Output parameter for the number of scans
|
||||
* @return true if the scans were retrieved successfully
|
||||
*/
|
||||
bool navigation_get_all_laser_scans(NavigationHandle handle, NamedLaserScan **out_scans, size_t *out_count);
|
||||
bool navigation_get_all_laser_scans(NavigationHandle handle, NamedLaserScan *out_scans, size_t &out_count);
|
||||
|
||||
/**
|
||||
* @brief Get all point clouds from the navigation system
|
||||
@@ -703,7 +415,7 @@ extern "C"
|
||||
* @param out_count Output parameter for the number of clouds
|
||||
* @return true if the clouds were retrieved successfully
|
||||
*/
|
||||
bool navigation_get_all_point_clouds(NavigationHandle handle, NamedPointCloud **out_clouds, size_t *out_count);
|
||||
bool navigation_get_all_point_clouds(NavigationHandle handle, NamedPointCloud *out_clouds, size_t &out_count);
|
||||
|
||||
/**
|
||||
* @brief Get all point cloud2s from the navigation system
|
||||
@@ -712,7 +424,7 @@ extern "C"
|
||||
* @param out_count Output parameter for the number of clouds
|
||||
* @return true if the clouds were retrieved successfully
|
||||
*/
|
||||
bool navigation_get_all_point_cloud2s(NavigationHandle handle, NamedPointCloud2 **out_clouds, size_t *out_count);
|
||||
bool navigation_get_all_point_cloud2s(NavigationHandle handle, NamedPointCloud2 *out_clouds, size_t &out_count);
|
||||
|
||||
/**
|
||||
* @brief Remove a static map from the navigation system
|
||||
|
||||
29
src/APIs/c_api/include/nav_msgs/ActionTypes.h
Normal file
29
src/APIs/c_api/include/nav_msgs/ActionTypes.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef C_API_NAV_MSGS_ACTIONTYPES_H
|
||||
#define C_API_NAV_MSGS_ACTIONTYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Time.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Time stamp;
|
||||
char *id;
|
||||
} GoalID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GoalID goal_id;
|
||||
uint8_t status;
|
||||
char *text;
|
||||
} GoalStatus;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_ACTIONTYPES_H
|
||||
23
src/APIs/c_api/include/nav_msgs/GetMap.h
Normal file
23
src/APIs/c_api/include/nav_msgs/GetMap.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAP_H
|
||||
#define C_API_NAV_MSGS_GETMAP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/GetMapRequest.h"
|
||||
#include "nav_msgs/GetMapResponse.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GetMapRequest request;
|
||||
GetMapResponse response;
|
||||
} GetMap;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAP_H
|
||||
25
src/APIs/c_api/include/nav_msgs/GetMapAction.h
Normal file
25
src/APIs/c_api/include/nav_msgs/GetMapAction.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPACTION_H
|
||||
#define C_API_NAV_MSGS_GETMAPACTION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/GetMapActionGoal.h"
|
||||
#include "nav_msgs/GetMapActionResult.h"
|
||||
#include "nav_msgs/GetMapActionFeedback.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GetMapActionGoal action_goal;
|
||||
GetMapActionResult action_result;
|
||||
GetMapActionFeedback action_feedback;
|
||||
} GetMapAction;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPACTION_H
|
||||
25
src/APIs/c_api/include/nav_msgs/GetMapActionFeedback.h
Normal file
25
src/APIs/c_api/include/nav_msgs/GetMapActionFeedback.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPACTIONFEEDBACK_H
|
||||
#define C_API_NAV_MSGS_GETMAPACTIONFEEDBACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_msgs/ActionTypes.h"
|
||||
#include "nav_msgs/GetMapFeedback.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
GoalStatus status;
|
||||
GetMapFeedback feedback;
|
||||
} GetMapActionFeedback;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPACTIONFEEDBACK_H
|
||||
25
src/APIs/c_api/include/nav_msgs/GetMapActionGoal.h
Normal file
25
src/APIs/c_api/include/nav_msgs/GetMapActionGoal.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPACTIONGOAL_H
|
||||
#define C_API_NAV_MSGS_GETMAPACTIONGOAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_msgs/ActionTypes.h"
|
||||
#include "nav_msgs/GetMapGoal.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
GoalID goal_id;
|
||||
GetMapGoal goal;
|
||||
} GetMapActionGoal;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPACTIONGOAL_H
|
||||
25
src/APIs/c_api/include/nav_msgs/GetMapActionResult.h
Normal file
25
src/APIs/c_api/include/nav_msgs/GetMapActionResult.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPACTIONRESULT_H
|
||||
#define C_API_NAV_MSGS_GETMAPACTIONRESULT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_msgs/ActionTypes.h"
|
||||
#include "nav_msgs/GetMapResult.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
GoalStatus status;
|
||||
GetMapResult result;
|
||||
} GetMapActionResult;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPACTIONRESULT_H
|
||||
20
src/APIs/c_api/include/nav_msgs/GetMapFeedback.h
Normal file
20
src/APIs/c_api/include/nav_msgs/GetMapFeedback.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPFEEDBACK_H
|
||||
#define C_API_NAV_MSGS_GETMAPFEEDBACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t _dummy;
|
||||
} GetMapFeedback;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPFEEDBACK_H
|
||||
20
src/APIs/c_api/include/nav_msgs/GetMapGoal.h
Normal file
20
src/APIs/c_api/include/nav_msgs/GetMapGoal.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPGOAL_H
|
||||
#define C_API_NAV_MSGS_GETMAPGOAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t _dummy;
|
||||
} GetMapGoal;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPGOAL_H
|
||||
20
src/APIs/c_api/include/nav_msgs/GetMapRequest.h
Normal file
20
src/APIs/c_api/include/nav_msgs/GetMapRequest.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPREQUEST_H
|
||||
#define C_API_NAV_MSGS_GETMAPREQUEST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t _dummy;
|
||||
} GetMapRequest;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPREQUEST_H
|
||||
21
src/APIs/c_api/include/nav_msgs/GetMapResponse.h
Normal file
21
src/APIs/c_api/include/nav_msgs/GetMapResponse.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPRESPONSE_H
|
||||
#define C_API_NAV_MSGS_GETMAPRESPONSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/OccupancyGrid.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OccupancyGrid map;
|
||||
} GetMapResponse;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPRESPONSE_H
|
||||
21
src/APIs/c_api/include/nav_msgs/GetMapResult.h
Normal file
21
src/APIs/c_api/include/nav_msgs/GetMapResult.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_NAV_MSGS_GETMAPRESULT_H
|
||||
#define C_API_NAV_MSGS_GETMAPRESULT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/OccupancyGrid.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OccupancyGrid map;
|
||||
} GetMapResult;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETMAPRESULT_H
|
||||
23
src/APIs/c_api/include/nav_msgs/GetPlan.h
Normal file
23
src/APIs/c_api/include/nav_msgs/GetPlan.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_MSGS_GETPLAN_H
|
||||
#define C_API_NAV_MSGS_GETPLAN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/GetPlanRequest.h"
|
||||
#include "nav_msgs/GetPlanResponse.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GetPlanRequest request;
|
||||
GetPlanResponse response;
|
||||
} GetPlan;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETPLAN_H
|
||||
23
src/APIs/c_api/include/nav_msgs/GetPlanRequest.h
Normal file
23
src/APIs/c_api/include/nav_msgs/GetPlanRequest.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_MSGS_GETPLANREQUEST_H
|
||||
#define C_API_NAV_MSGS_GETPLANREQUEST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "geometry_msgs/PoseStamped.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PoseStamped start;
|
||||
PoseStamped goal;
|
||||
float tolerance;
|
||||
} GetPlanRequest;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETPLANREQUEST_H
|
||||
21
src/APIs/c_api/include/nav_msgs/GetPlanResponse.h
Normal file
21
src/APIs/c_api/include/nav_msgs/GetPlanResponse.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_NAV_MSGS_GETPLANRESPONSE_H
|
||||
#define C_API_NAV_MSGS_GETPLANRESPONSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/Path.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Path plan;
|
||||
} GetPlanResponse;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GETPLANRESPONSE_H
|
||||
26
src/APIs/c_api/include/nav_msgs/GridCells.h
Normal file
26
src/APIs/c_api/include/nav_msgs/GridCells.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef C_API_NAV_MSGS_GRIDCELLS_H
|
||||
#define C_API_NAV_MSGS_GRIDCELLS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Point.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
float cell_width;
|
||||
float cell_height;
|
||||
Point *cells;
|
||||
size_t cells_count;
|
||||
} GridCells;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_GRIDCELLS_H
|
||||
23
src/APIs/c_api/include/nav_msgs/LoadMap.h
Normal file
23
src/APIs/c_api/include/nav_msgs/LoadMap.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_MSGS_LOADMAP_H
|
||||
#define C_API_NAV_MSGS_LOADMAP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/LoadMapRequest.h"
|
||||
#include "nav_msgs/LoadMapResponse.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LoadMapRequest request;
|
||||
LoadMapResponse response;
|
||||
} LoadMap;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_LOADMAP_H
|
||||
20
src/APIs/c_api/include/nav_msgs/LoadMapRequest.h
Normal file
20
src/APIs/c_api/include/nav_msgs/LoadMapRequest.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef C_API_NAV_MSGS_LOADMAPREQUEST_H
|
||||
#define C_API_NAV_MSGS_LOADMAPREQUEST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *map_url;
|
||||
} LoadMapRequest;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_LOADMAPREQUEST_H
|
||||
23
src/APIs/c_api/include/nav_msgs/LoadMapResponse.h
Normal file
23
src/APIs/c_api/include/nav_msgs/LoadMapResponse.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_MSGS_LOADMAPRESPONSE_H
|
||||
#define C_API_NAV_MSGS_LOADMAPRESPONSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/OccupancyGrid.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OccupancyGrid map;
|
||||
bool result;
|
||||
} LoadMapResponse;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_LOADMAPRESPONSE_H
|
||||
26
src/APIs/c_api/include/nav_msgs/MapMetaData.h
Normal file
26
src/APIs/c_api/include/nav_msgs/MapMetaData.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef C_API_NAV_MSGS_MAPMETADATA_H
|
||||
#define C_API_NAV_MSGS_MAPMETADATA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Time.h"
|
||||
#include "geometry_msgs/Pose.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Time map_load_time;
|
||||
float resolution;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
Pose origin;
|
||||
} MapMetaData;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_MAPMETADATA_H
|
||||
25
src/APIs/c_api/include/nav_msgs/OccupancyGrid.h
Normal file
25
src/APIs/c_api/include/nav_msgs/OccupancyGrid.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_NAV_MSGS_OCCUPANCYGRID_H
|
||||
#define C_API_NAV_MSGS_OCCUPANCYGRID_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "nav_msgs/MapMetaData.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
MapMetaData info;
|
||||
int8_t *data;
|
||||
size_t data_count;
|
||||
} OccupancyGrid;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_OCCUPANCYGRID_H
|
||||
35
src/APIs/c_api/include/nav_msgs/Odometry.h
Normal file
35
src/APIs/c_api/include/nav_msgs/Odometry.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef C_API_NAV_MSGS_ODOMETRY_H
|
||||
#define C_API_NAV_MSGS_ODOMETRY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/PoseWithCovariance.h"
|
||||
#include "geometry_msgs/TwistWithCovariance.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
char *child_frame_id;
|
||||
PoseWithCovariance pose;
|
||||
TwistWithCovariance twist;
|
||||
} Odometry;
|
||||
|
||||
|
||||
extern "C" Odometry odometry_create(void);
|
||||
|
||||
extern "C" Odometry odometry_set_data(
|
||||
Header header,
|
||||
char *child_frame_id,
|
||||
PoseWithCovariance pose,
|
||||
TwistWithCovariance twist);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_ODOMETRY_H
|
||||
24
src/APIs/c_api/include/nav_msgs/Path.h
Normal file
24
src/APIs/c_api/include/nav_msgs/Path.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef C_API_NAV_MSGS_PATH_H
|
||||
#define C_API_NAV_MSGS_PATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/PoseStamped.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
PoseStamped *poses;
|
||||
size_t poses_count;
|
||||
} Path;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_PATH_H
|
||||
23
src/APIs/c_api/include/nav_msgs/SetMap.h
Normal file
23
src/APIs/c_api/include/nav_msgs/SetMap.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_MSGS_SETMAP_H
|
||||
#define C_API_NAV_MSGS_SETMAP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/SetMapRequest.h"
|
||||
#include "nav_msgs/SetMapResponse.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SetMapRequest request;
|
||||
SetMapResponse response;
|
||||
} SetMap;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_SETMAP_H
|
||||
23
src/APIs/c_api/include/nav_msgs/SetMapRequest.h
Normal file
23
src/APIs/c_api/include/nav_msgs/SetMapRequest.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_NAV_MSGS_SETMAPREQUEST_H
|
||||
#define C_API_NAV_MSGS_SETMAPREQUEST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "nav_msgs/OccupancyGrid.h"
|
||||
#include "geometry_msgs/PoseWithCovariance.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OccupancyGrid map;
|
||||
PoseWithCovariance initial_pose;
|
||||
} SetMapRequest;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_SETMAPREQUEST_H
|
||||
21
src/APIs/c_api/include/nav_msgs/SetMapResponse.h
Normal file
21
src/APIs/c_api/include/nav_msgs/SetMapResponse.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_NAV_MSGS_SETMAPRESPONSE_H
|
||||
#define C_API_NAV_MSGS_SETMAPRESPONSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool success;
|
||||
} SetMapResponse;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_NAV_MSGS_SETMAPRESPONSE_H
|
||||
38
src/APIs/c_api/include/sensor_msgs/BatteryState.h
Normal file
38
src/APIs/c_api/include/sensor_msgs/BatteryState.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef C_API_SENSOR_MSGS_BATTERYSTATE_H
|
||||
#define C_API_SENSOR_MSGS_BATTERYSTATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
float voltage;
|
||||
float current;
|
||||
float charge;
|
||||
float capacity;
|
||||
float design_capacity;
|
||||
float percentage;
|
||||
uint8_t power_supply_status;
|
||||
uint8_t power_supply_health;
|
||||
uint8_t power_supply_technology;
|
||||
bool present;
|
||||
float *cell_voltage;
|
||||
size_t cell_voltage_count;
|
||||
float *cell_temperature;
|
||||
size_t cell_temperature_count;
|
||||
char *location;
|
||||
char *serial_number;
|
||||
} BatteryState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_BATTERYSTATE_H
|
||||
33
src/APIs/c_api/include/sensor_msgs/CameraInfo.h
Normal file
33
src/APIs/c_api/include/sensor_msgs/CameraInfo.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef C_API_SENSOR_MSGS_CAMERAINFO_H
|
||||
#define C_API_SENSOR_MSGS_CAMERAINFO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "sensor_msgs/RegionOfInterest.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
char *distortion_model;
|
||||
double *D;
|
||||
size_t D_count;
|
||||
double K[9];
|
||||
double R[9];
|
||||
double P[12];
|
||||
uint32_t binning_x;
|
||||
uint32_t binning_y;
|
||||
RegionOfInterest roi;
|
||||
} CameraInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_CAMERAINFO_H
|
||||
22
src/APIs/c_api/include/sensor_msgs/ChannelFloat32.h
Normal file
22
src/APIs/c_api/include/sensor_msgs/ChannelFloat32.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_SENSOR_MSGS_CHANNELFLOAT32_H
|
||||
#define C_API_SENSOR_MSGS_CHANNELFLOAT32_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
float *values;
|
||||
size_t values_count;
|
||||
} ChannelFloat32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_CHANNELFLOAT32_H
|
||||
24
src/APIs/c_api/include/sensor_msgs/CompressedImage.h
Normal file
24
src/APIs/c_api/include/sensor_msgs/CompressedImage.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef C_API_SENSOR_MSGS_COMPRESSEDIMAGE_H
|
||||
#define C_API_SENSOR_MSGS_COMPRESSEDIMAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
char *format;
|
||||
uint8_t *data;
|
||||
size_t data_count;
|
||||
} CompressedImage;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_COMPRESSEDIMAGE_H
|
||||
23
src/APIs/c_api/include/sensor_msgs/FluidPressure.h
Normal file
23
src/APIs/c_api/include/sensor_msgs/FluidPressure.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_SENSOR_MSGS_FLUIDPRESSURE_H
|
||||
#define C_API_SENSOR_MSGS_FLUIDPRESSURE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
double fluid_pressure;
|
||||
double variance;
|
||||
} FluidPressure;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_FLUIDPRESSURE_H
|
||||
23
src/APIs/c_api/include/sensor_msgs/Illuminance.h
Normal file
23
src/APIs/c_api/include/sensor_msgs/Illuminance.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_SENSOR_MSGS_ILLUMINANCE_H
|
||||
#define C_API_SENSOR_MSGS_ILLUMINANCE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
double illuminance;
|
||||
double variance;
|
||||
} Illuminance;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_ILLUMINANCE_H
|
||||
28
src/APIs/c_api/include/sensor_msgs/Image.h
Normal file
28
src/APIs/c_api/include/sensor_msgs/Image.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef C_API_SENSOR_MSGS_IMAGE_H
|
||||
#define C_API_SENSOR_MSGS_IMAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
char *encoding;
|
||||
uint8_t is_bigendian;
|
||||
uint32_t step;
|
||||
uint8_t *data;
|
||||
size_t data_count;
|
||||
} Image;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_IMAGE_H
|
||||
29
src/APIs/c_api/include/sensor_msgs/Imu.h
Normal file
29
src/APIs/c_api/include/sensor_msgs/Imu.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef C_API_SENSOR_MSGS_IMU_H
|
||||
#define C_API_SENSOR_MSGS_IMU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Quaternion.h"
|
||||
#include "geometry_msgs/Vector3.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Quaternion orientation;
|
||||
double orientation_covariance[9];
|
||||
Vector3 angular_velocity;
|
||||
double angular_velocity_covariance[9];
|
||||
Vector3 linear_acceleration;
|
||||
double linear_acceleration_covariance[9];
|
||||
} Imu;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_IMU_H
|
||||
29
src/APIs/c_api/include/sensor_msgs/JointState.h
Normal file
29
src/APIs/c_api/include/sensor_msgs/JointState.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef C_API_SENSOR_MSGS_JOINTSTATE_H
|
||||
#define C_API_SENSOR_MSGS_JOINTSTATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
char **name;
|
||||
size_t name_count;
|
||||
double *position;
|
||||
size_t position_count;
|
||||
double *velocity;
|
||||
size_t velocity_count;
|
||||
double *effort;
|
||||
size_t effort_count;
|
||||
} JointState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_JOINTSTATE_H
|
||||
25
src/APIs/c_api/include/sensor_msgs/Joy.h
Normal file
25
src/APIs/c_api/include/sensor_msgs/Joy.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef C_API_SENSOR_MSGS_JOY_H
|
||||
#define C_API_SENSOR_MSGS_JOY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
float *axes;
|
||||
size_t axes_count;
|
||||
int32_t *buttons;
|
||||
size_t buttons_count;
|
||||
} Joy;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_JOY_H
|
||||
22
src/APIs/c_api/include/sensor_msgs/JoyFeedback.h
Normal file
22
src/APIs/c_api/include/sensor_msgs/JoyFeedback.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_SENSOR_MSGS_JOYFEEDBACK_H
|
||||
#define C_API_SENSOR_MSGS_JOYFEEDBACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t id;
|
||||
float intensity;
|
||||
} JoyFeedback;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_JOYFEEDBACK_H
|
||||
22
src/APIs/c_api/include/sensor_msgs/JoyFeedbackArray.h
Normal file
22
src/APIs/c_api/include/sensor_msgs/JoyFeedbackArray.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef C_API_SENSOR_MSGS_JOYFEEDBACKARRAY_H
|
||||
#define C_API_SENSOR_MSGS_JOYFEEDBACKARRAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "sensor_msgs/JoyFeedback.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
JoyFeedback *array;
|
||||
size_t array_count;
|
||||
} JoyFeedbackArray;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_JOYFEEDBACKARRAY_H
|
||||
21
src/APIs/c_api/include/sensor_msgs/LaserEcho.h
Normal file
21
src/APIs/c_api/include/sensor_msgs/LaserEcho.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef C_API_SENSOR_MSGS_LASERECHO_H
|
||||
#define C_API_SENSOR_MSGS_LASERECHO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float *echoes;
|
||||
size_t echoes_count;
|
||||
} LaserEcho;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_LASERECHO_H
|
||||
32
src/APIs/c_api/include/sensor_msgs/LaserScan.h
Normal file
32
src/APIs/c_api/include/sensor_msgs/LaserScan.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef C_API_SENSOR_MSGS_LASER_SCAN_H
|
||||
#define C_API_SENSOR_MSGS_LASER_SCAN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
float angle_min;
|
||||
float angle_max;
|
||||
float angle_increment;
|
||||
float time_increment;
|
||||
float scan_time;
|
||||
float range_min;
|
||||
float range_max;
|
||||
float *ranges;
|
||||
size_t ranges_count;
|
||||
float *intensities;
|
||||
size_t intensities_count;
|
||||
} LaserScan;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // C_API_SENSOR_MSGS_LASER_SCAN_H
|
||||
33
src/APIs/c_api/include/sensor_msgs/MultiEchoLaserScan.h
Normal file
33
src/APIs/c_api/include/sensor_msgs/MultiEchoLaserScan.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef C_API_SENSOR_MSGS_MULTIECHOLASERSCAN_H
|
||||
#define C_API_SENSOR_MSGS_MULTIECHOLASERSCAN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "sensor_msgs/LaserEcho.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
float angle_min;
|
||||
float angle_max;
|
||||
float angle_increment;
|
||||
float time_increment;
|
||||
float scan_time;
|
||||
float range_min;
|
||||
float range_max;
|
||||
LaserEcho *ranges;
|
||||
size_t ranges_count;
|
||||
LaserEcho *intensities;
|
||||
size_t intensities_count;
|
||||
} MultiEchoLaserScan;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_MULTIECHOLASERSCAN_H
|
||||
27
src/APIs/c_api/include/sensor_msgs/PointCloud.h
Normal file
27
src/APIs/c_api/include/sensor_msgs/PointCloud.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef C_API_SENSOR_MSGS_POINTCLOUD_H
|
||||
#define C_API_SENSOR_MSGS_POINTCLOUD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "geometry_msgs/Point32.h"
|
||||
#include "sensor_msgs/ChannelFloat32.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
Point32 *points;
|
||||
size_t points_count;
|
||||
ChannelFloat32 *channels;
|
||||
size_t channels_count;
|
||||
} PointCloud;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_POINTCLOUD_H
|
||||
33
src/APIs/c_api/include/sensor_msgs/PointCloud2.h
Normal file
33
src/APIs/c_api/include/sensor_msgs/PointCloud2.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef C_API_SENSOR_MSGS_POINTCLOUD2_H
|
||||
#define C_API_SENSOR_MSGS_POINTCLOUD2_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "std_msgs/Header.h"
|
||||
#include "sensor_msgs/PointField.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Header header;
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
PointField *fields;
|
||||
size_t fields_count;
|
||||
bool is_bigendian;
|
||||
uint32_t point_step;
|
||||
uint32_t row_step;
|
||||
uint8_t *data;
|
||||
size_t data_count;
|
||||
bool is_dense;
|
||||
} PointCloud2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_POINTCLOUD2_H
|
||||
23
src/APIs/c_api/include/sensor_msgs/PointField.h
Normal file
23
src/APIs/c_api/include/sensor_msgs/PointField.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef C_API_SENSOR_MSGS_POINTFIELD_H
|
||||
#define C_API_SENSOR_MSGS_POINTFIELD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
uint32_t offset;
|
||||
uint8_t datatype;
|
||||
uint32_t count;
|
||||
} PointField;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_API_SENSOR_MSGS_POINTFIELD_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user