vex_sdk/
arm.rs

1//! CTE Workcell Arm
2
3use core::ffi::c_double;
4
5use crate::V5_DeviceT;
6
7#[repr(C)]
8#[derive(Default, Debug, Copy, Clone, PartialEq)]
9pub struct V5_DeviceArmTipPosition {
10    pub tip_x: i32,
11    pub tip_y: i32,
12    pub tip_z: i32,
13    pub tip_roll: i32,
14    pub tip_pitch: i32,
15    pub tip_yaw: i32,
16    pub pose: i8,
17    pub velocity: i16,
18}
19
20unsafe extern "system" {
21    pub fn vexDeviceArmMoveTipCommandLinearAdv(
22        device: V5_DeviceT,
23        position: *mut V5_DeviceArmTipPosition,
24        j6_rotation: c_double,
25        j6_velocity: u16,
26        relative: bool,
27    );
28    pub fn vexDeviceArmMoveTipCommandJointAdv(
29        device: V5_DeviceT,
30        position: *mut V5_DeviceArmTipPosition,
31        j6_rotation: c_double,
32        j6_velocity: u16,
33        relative: bool,
34    );
35    pub fn vexDeviceArmTipPositionGetAdv(
36        device: V5_DeviceT,
37        position: *mut V5_DeviceArmTipPosition,
38    );
39    pub fn vexDeviceArmPoseSet(device: V5_DeviceT, pose: u8, velocity: u16);
40    pub fn vexDeviceArmMoveTipCommandLinear(
41        device: V5_DeviceT,
42        x: i32,
43        y: i32,
44        z: i32,
45        pose: u8,
46        velocity: u16,
47        rotation: c_double,
48        rot_velocity: u16,
49        relative: bool,
50    );
51    pub fn vexDeviceArmMoveTipCommandJoint(
52        device: V5_DeviceT,
53        x: i32,
54        y: i32,
55        z: i32,
56        pose: u8,
57        velocity: u16,
58        rotation: c_double,
59        rot_velocity: u16,
60        relative: bool,
61    );
62    pub fn vexDeviceArmMoveJointsCommand(
63        device: V5_DeviceT,
64        positions: *mut c_double,
65        velocities: *mut u16,
66        j6_rotation: c_double,
67        j6_velocity: u16,
68        j7_volts: c_double,
69        j7_timeout: u16,
70        j7_i_limit: u16,
71        relative: bool,
72    );
73    pub fn vexDeviceArmSpinJoints(device: V5_DeviceT, velocities: *mut c_double);
74    pub fn vexDeviceArmSetJointPositions(device: V5_DeviceT, new_positions: *mut c_double);
75    pub fn vexDeviceArmPickUpCommand(device: V5_DeviceT);
76    pub fn vexDeviceArmDropCommand(device: V5_DeviceT);
77    pub fn vexDeviceArmMoveVoltsCommand(device: V5_DeviceT, voltages: *mut c_double);
78    pub fn vexDeviceArmFullStop(device: V5_DeviceT, brakeMode: u8);
79    pub fn vexDeviceArmEnableProfiler(device: V5_DeviceT, enable: u8);
80    pub fn vexDeviceArmProfilerVelocitySet(
81        device: V5_DeviceT,
82        linear_velocity: u16,
83        joint_velocity: u16,
84    );
85    pub fn vexDeviceArmSaveZeroValues(device: V5_DeviceT);
86    pub fn vexDeviceArmForceZeroCommand(device: V5_DeviceT);
87    pub fn vexDeviceArmClearZeroValues(device: V5_DeviceT);
88    pub fn vexDeviceArmBootload(device: V5_DeviceT);
89    pub fn vexDeviceArmTipPositionGet(device: V5_DeviceT, x: *mut i32, y: *mut i32, z: *mut i32);
90    pub fn vexDeviceArmJointInfoGet(
91        device: V5_DeviceT,
92        positions: *mut c_double,
93        velocities: *mut c_double,
94        currents: *mut i32,
95    );
96    pub fn vexDeviceArmJ6PositionGet(device: V5_DeviceT) -> c_double;
97    pub fn vexDeviceArmBatteryGet(device: V5_DeviceT) -> i32;
98    pub fn vexDeviceArmServoFlagsGet(device: V5_DeviceT, servoID: u32) -> i32;
99    pub fn vexDeviceArmStatusGet(device: V5_DeviceT) -> u32;
100    pub fn vexDeviceArmDebugGet(device: V5_DeviceT, id: i32) -> u32;
101    pub fn vexDeviceArmJointErrorsGet(device: V5_DeviceT, errors: *mut u8);
102    pub fn vexDeviceArmJ6PositionSet(device: V5_DeviceT, position: i16);
103    pub fn vexDeviceArmStopJointsCommand(device: V5_DeviceT, brakeModes: *mut i16);
104    pub fn vexDeviceArmReboot(device: V5_DeviceT);
105    pub fn vexDeviceArmTipOffsetSet(device: V5_DeviceT, x: i32, y: i32, z: i32);
106}