spring_ai_rs/ai_interface/callback/command/command_data/
path.rs1use spring_ai_sys::{
2 SFreePathCommand, SGetApproximateLengthPathCommand, SGetNextWaypointPathCommand,
3 SInitPathCommand,
4};
5
6use crate::ai_interface::callback::command::command_data::{CData, CommandData};
7
8pub struct FreePathCommandData {
10 pub path_id: i32,
11}
12
13impl CommandData for FreePathCommandData {
14 type CDataType = SFreePathCommand;
15
16 fn c_data(&mut self) -> Self::CDataType {
17 SFreePathCommand {
18 pathId: self.path_id,
19 }
20 }
21}
22
23impl CData for SFreePathCommand {}
24
25pub struct GetApproximateLengthPathCommandData {
27 pub start_pos: [f32; 3],
28 pub end_pos: [f32; 3],
29 pub path_type: i32,
30 pub goal_radius: f32,
31}
32
33impl CommandData for GetApproximateLengthPathCommandData {
34 type CDataType = SGetApproximateLengthPathCommand;
35
36 fn c_data(&mut self) -> Self::CDataType {
37 SGetApproximateLengthPathCommand {
38 start_posF3: self.start_pos.as_mut_ptr(),
39 end_posF3: self.end_pos.as_mut_ptr(),
40 pathType: self.path_type,
41 goalRadius: self.goal_radius,
42 ret_approximatePathLength: 0.0,
43 }
44 }
45}
46
47impl CData for SGetApproximateLengthPathCommand {}
48
49pub struct InitPathCommandData {
51 pub start_pos: [f32; 3],
52 pub end_pos: [f32; 3],
53 pub path_type: i32,
54 pub goal_radius: f32,
55}
56
57impl CommandData for InitPathCommandData {
58 type CDataType = SInitPathCommand;
59
60 fn c_data(&mut self) -> Self::CDataType {
61 SInitPathCommand {
62 start_posF3: self.start_pos.as_mut_ptr(),
63 end_posF3: self.end_pos.as_mut_ptr(),
64 pathType: self.path_type,
65 goalRadius: self.goal_radius,
66 ret_pathId: 0,
67 }
68 }
69}
70
71impl CData for SInitPathCommand {}
72
73pub struct GetNextWaypointPathCommandData {
75 pub path_id: i32,
76 pub next_waypoint_position: [f32; 3],
77}
78
79impl CommandData for GetNextWaypointPathCommandData {
80 type CDataType = SGetNextWaypointPathCommand;
81
82 fn c_data(&mut self) -> Self::CDataType {
83 SGetNextWaypointPathCommand {
84 pathId: self.path_id,
85 ret_nextWaypoint_posF3_out: self.next_waypoint_position.as_mut_ptr(),
86 }
87 }
88}
89
90impl CData for SGetNextWaypointPathCommand {}