pros_sys/motor.rs
1use core::ffi::*;
2
3pub const E_MOTOR_FAULT_NO_FAULTS: u32 = 0x00;
4/// Analogous to motor_is_over_temp()
5pub const E_MOTOR_FAULT_MOTOR_OVER_TEMP: u32 = 0x01;
6/// Indicates a motor h-bridge fault
7pub const E_MOTOR_FAULT_DRIVER_FAULT: u32 = 0x02;
8/// Analogous to motor_is_over_current()
9pub const E_MOTOR_FAULT_OVER_CURRENT: u32 = 0x04;
10/// Indicates an h-bridge over current
11pub const E_MOTOR_FAULT_DRV_OVER_CURRENT: u32 = 0x08;
12pub type motor_fault_e_t = u32;
13
14pub const E_MOTOR_FLAGS_NONE: u32 = 0x00;
15/// Cannot currently communicate to the motor
16pub const E_MOTOR_FLAGS_BUSY: u32 = 0x01;
17/// Analogous to motor_is_stopped()
18pub const E_MOTOR_FLAGS_ZERO_VELOCITY: u32 = 0x02;
19pub const E_MOTOR_FLAGS_ZERO_POSITION: u32 = 0x04;
20pub type motor_flag_e_t = u32;
21
22/// Motor coasts when stopped, traditional behavior
23pub const E_MOTOR_BRAKE_COAST: i32 = 0;
24/// Motor brakes when stopped
25pub const E_MOTOR_BRAKE_BRAKE: i32 = 1;
26/// Motor actively holds position when stopped
27pub const E_MOTOR_BRAKE_HOLD: i32 = 2;
28pub const E_MOTOR_BRAKE_INVALID: i32 = i32::MAX;
29pub type motor_brake_mode_e_t = i32;
30
31/// Position is recorded as angle in degrees as a floating point number
32pub const E_MOTOR_ENCODER_DEGREES: i32 = 0;
33/// Position is recorded as angle in rotations as a floating point number
34pub const E_MOTOR_ENCODER_ROTATIONS: i32 = 1;
35/// Position is recorded as raw encoder ticks as a whole number
36pub const E_MOTOR_ENCODER_COUNTS: i32 = 2;
37pub const E_MOTOR_ENCODER_INVALID: i32 = i32::MAX;
38pub type motor_encoder_units_e_t = i32;
39
40/// 36:1, 100 RPM, Red gear set
41pub const E_MOTOR_GEARSET_36: i32 = 0;
42pub const E_MOTOR_GEAR_RED: i32 = E_MOTOR_GEARSET_36;
43pub const E_MOTOR_GEAR_100: i32 = E_MOTOR_GEARSET_36;
44/// 18:1, 200 RPM, Green gear set
45pub const E_MOTOR_GEARSET_18: i32 = 1;
46pub const E_MOTOR_GEAR_GREEN: i32 = E_MOTOR_GEARSET_18;
47pub const E_MOTOR_GEAR_200: i32 = E_MOTOR_GEARSET_18;
48/// 6:1, 600 RPM, Blue gear set
49pub const E_MOTOR_GEARSET_06: i32 = 2;
50pub const E_MOTOR_GEAR_BLUE: i32 = E_MOTOR_GEARSET_06;
51pub const E_MOTOR_GEAR_600: i32 = E_MOTOR_GEARSET_06;
52pub const E_MOTOR_GEARSET_INVALID: i32 = i32::MAX;
53pub type motor_gearset_e_t = i32;
54
55/**
56Holds the information about a Motor's position or velocity PID controls.
57
58These values are in 4.4 format, meaning that a value of 0x20 represents 2.0,
590x21 represents 2.0625, 0x22 represents 2.125, etc.
60*/
61#[repr(C)]
62pub struct motor_pid_full_s_t {
63 /// The feedforward constant
64 pub kf: u8,
65 /// The proportional constant
66 pub kp: u8,
67 /// The integral constants
68 pub ki: u8,
69 /// The derivative constant
70 pub kd: u8,
71 /// A constant used for filtering the profile acceleration
72 pub filter: u8,
73 /// The integral limit
74 pub limit: u16,
75 /// The threshold for determining if a position movement has
76 /// reached its goal. This has no effect for velocity PID calculations.
77 pub threshold: u8,
78 /// The rate at which the PID computation is run in ms
79 pub loopspeed: u8,
80}
81
82/**
83Holds just the constants for a Motor's position or velocity PID controls.
84
85These values are in 4.4 format, meaning that a value of 0x20 represents 2.0,
860x21 represents 2.0625, 0x22 represents 2.125, etc.
87*/
88#[repr(C)]
89pub struct motor_pid_s_t {
90 /// The feedforward constant
91 pub kf: u8,
92 /// The proportional constant
93 pub kp: u8,
94 /// The integral constant
95 pub ki: u8,
96 /// The derivative constant
97 pub kd: u8,
98}
99
100extern "C" {
101 /**
102 Sets the voltage for the motor from -127 to 127.
103
104 This is designed to map easily to the input from the controller's analog
105 stick for simple opcontrol use. The actual behavior of the motor is analogous
106 to use of motor_move_voltage(), or motorSet() from the PROS 2 API.
107
108 This function uses the following values of errno when an error state is
109 reached:
110 ENXIO - The given value is not within the range of V5 ports (1-21).
111 ENODEV - The port cannot be configured as a motor
112
113 \param port
114 The V5 port number from 1-21
115 \param voltage
116 The new motor voltage from -127 to 127
117
118 \return 1 if the operation was successful or PROS_ERR if the operation
119 failed, setting errno.
120 */
121 pub fn motor_move(port: i8, voltage: i32) -> i32;
122 /**
123 Stops the motor using the currently configured brake mode.
124
125 This function sets motor velocity to zero, which will cause it to act
126 according to the set brake mode. If brake mode is set to MOTOR_BRAKE_HOLD,
127 this function may behave differently than calling motor_move_absolute(port, 0)
128 or motor_move_relative(port, 0).
129
130 This function uses the following values of errno when an error state is
131 reached:
132 ENXIO - The given value is not within the range of V5 ports (1-21).
133 ENODEV - The port cannot be configured as a motor
134
135 \param port
136 The V5 port number from 1-21
137
138 \return 1 if the operation was successful or PROS_ERR if the operation
139 failed, setting errno.
140 */
141 pub fn motor_brake(port: i8) -> i32;
142 /**
143 Sets the target absolute position for the motor to move to.
144
145 This movement is relative to the position of the motor when initialized or
146 the position when it was most recently reset with motor_set_zero_position().
147
148 \note This function simply sets the target for the motor, it does not block
149 program execution until the movement finishes.
150
151 This function uses the following values of errno when an error state is
152 reached:
153 ENXIO - The given value is not within the range of V5 ports (1-21).
154 ENODEV - The port cannot be configured as a motor
155
156 \param port
157 The V5 port number from 1-21
158 \param position
159 The absolute position to move to in the motor's encoder units
160 \param velocity
161 The maximum allowable velocity for the movement in RPM
162
163 \return 1 if the operation was successful or PROS_ERR if the operation
164 failed, setting errno.
165 */
166 pub fn motor_move_absolute(port: i8, position: c_double, velocity: i32) -> i32;
167 /**
168 Sets the relative target position for the motor to move to.
169
170 This movement is relative to the current position of the motor as given in
171 motor_get_position(). Providing 10.0 as the position parameter would result
172 in the motor moving clockwise 10 units, no matter what the current position
173 is.
174
175 \note This function simply sets the target for the motor, it does not block
176 program execution until the movement finishes.
177
178 This function uses the following values of errno when an error state is
179 reached:
180 ENXIO - The given value is not within the range of V5 ports (1-21).
181 ENODEV - The port cannot be configured as a motor
182
183 \param port
184 The V5 port number from 1-21
185 \param position
186 The relative position to move to in the motor's encoder units
187 \param velocity
188 The maximum allowable velocity for the movement in RPM
189
190 \return 1 if the operation was successful or PROS_ERR if the operation
191 failed, setting errno.
192 */
193 pub fn motor_move_relative(port: i8, position: c_double, velocity: i32) -> i32;
194 /**
195 Sets the velocity for the motor.
196
197 This velocity corresponds to different actual speeds depending on the gearset
198 used for the motor. This results in a range of +-100 for E_MOTOR_GEARSET_36,
199 +-200 for E_MOTOR_GEARSET_18, and +-600 for E_MOTOR_GEARSET_6. The velocity
200 is held with PID to ensure consistent speed, as opposed to setting the
201 motor's voltage.
202
203 This function uses the following values of errno when an error state is
204 reached:
205 ENXIO - The given value is not within the range of V5 ports (1-21).
206 ENODEV - The port cannot be configured as a motor
207
208 \param port
209 The V5 port number from 1-21
210 \param velocity
211 The new motor velocity from +-100, +-200, or +-600 depending on the
212 motor's gearset
213
214 \return 1 if the operation was successful or PROS_ERR if the operation
215 failed, setting errno.
216 */
217 pub fn motor_move_velocity(port: i8, velocity: i32) -> i32;
218 /**
219 Sets the output voltage for the motor from -12000 to 12000 in millivolts
220
221 This function uses the following values of errno when an error state is
222 reached:
223 ENXIO - The given value is not within the range of V5 ports (1-21).
224 ENODEV - The port cannot be configured as a motor
225
226 \param port
227 The V5 port number from 1-21
228 \param voltage
229 The new voltage value from -12000 to 12000
230
231 \return 1 if the operation was successful or PROS_ERR if the operation
232 failed, setting errno.
233 */
234 pub fn motor_move_voltage(port: i8, voltage: i32) -> i32;
235 /**
236 Changes the output velocity for a profiled movement (motor_move_absolute or
237 motor_move_relative). This will have no effect if the motor is not following
238 a profiled movement.
239
240 This function uses the following values of errno when an error state is
241 reached:
242 ENXIO - The given value is not within the range of V5 ports (1-21).
243 ENODEV - The port cannot be configured as a motor
244
245 \param port
246 The V5 port number from 1-21
247 \param velocity
248 The new motor velocity from +-100, +-200, or +-600 depending on the
249 motor's gearset
250
251 \return 1 if the operation was successful or PROS_ERR if the operation
252 failed, setting errno.
253 */
254 pub fn motor_modify_profiled_velocity(port: i8, velocity: i32) -> i32;
255 /**
256 Gets the target position set for the motor by the user.
257
258 This function uses the following values of errno when an error state is
259 reached:
260 ENXIO - The given value is not within the range of V5 ports (1-21).
261 ENODEV - The port cannot be configured as a motor
262
263 \param port
264 The V5 port number from 1-21
265
266 \return The target position in its encoder units or PROS_ERR_F if the
267 operation failed, setting errno.
268 */
269 pub fn motor_get_target_position(port: i8) -> c_double;
270 /**
271 Gets the velocity commanded to the motor by the user.
272
273 This function uses the following values of errno when an error state is
274 reached:
275 ENXIO - The given value is not within the range of V5 ports (1-21).
276 ENODEV - The port cannot be configured as a motor
277
278 \param port
279 The V5 port number from 1-21
280
281 \return The commanded motor velocity from +-100, +-200, or +-600, or PROS_ERR
282 if the operation failed, setting errno.
283 */
284 pub fn motor_get_target_velocity(port: i8) -> i32;
285 /**
286 Gets the actual velocity of the motor.
287
288 This function uses the following values of errno when an error state is
289 reached:
290 ENXIO - The given value is not within the range of V5 ports (1-21).
291 ENODEV - The port cannot be configured as a motor
292
293 \param port
294 The V5 port number from 1-21
295
296 \return The motor's actual velocity in RPM or PROS_ERR_F if the operation
297 failed, setting errno.
298 */
299 pub fn motor_get_actual_velocity(port: i8) -> c_double;
300 /**
301 Gets the current drawn by the motor in mA.
302
303 This function uses the following values of errno when an error state is
304 reached:
305 ENXIO - The given value is not within the range of V5 ports (1-21).
306 ENODEV - The port cannot be configured as a motor
307
308 \param port
309 The V5 port number from 1-21
310
311 \return The motor's current in mA or PROS_ERR if the operation failed,
312 setting errno.
313 */
314 pub fn motor_get_current_draw(port: i8) -> i32;
315 /**
316 Gets the direction of movement for the motor.
317
318 This function uses the following values of errno when an error state is
319 reached:
320 ENXIO - The given value is not within the range of V5 ports (1-21).
321 ENODEV - The port cannot be configured as a motor
322
323 \param port
324 The V5 port number from 1-21
325
326 \return 1 for moving in the positive direction, -1 for moving in the
327 negative direction, or PROS_ERR if the operation failed, setting errno.
328 */
329 pub fn motor_get_direction(port: i8) -> i32;
330 /**
331 Gets the efficiency of the motor in percent.
332
333 An efficiency of 100% means that the motor is moving electrically while
334 drawing no electrical power, and an efficiency of 0% means that the motor
335 is drawing power but not moving.
336
337 This function uses the following values of errno when an error state is
338 reached:
339 ENXIO - The given value is not within the range of V5 ports (1-21).
340 ENODEV - The port cannot be configured as a motor
341
342 \param port
343 The V5 port number from 1-21
344
345 \return The motor's efficiency in percent or PROS_ERR_F if the operation
346 failed, setting errno.
347 */
348 pub fn motor_get_efficiency(port: i8) -> c_double;
349 /**
350 Checks if the motor is drawing over its current limit.
351
352 This function uses the following values of errno when an error state is
353 reached:
354 ENXIO - The given value is not within the range of V5 ports (1-21).
355 ENODEV - The port cannot be configured as a motor
356
357 \param port
358 The V5 port number from 1-21
359
360 \return 1 if the motor's current limit is being exceeded and 0 if the current
361 limit is not exceeded, or PROS_ERR if the operation failed, setting errno.
362 */
363 pub fn motor_is_over_current(port: i8) -> i32;
364 /**
365 Checks if the motor's temperature is above its limit.
366
367 This function uses the following values of errno when an error state is
368 reached:
369 ENXIO - The given value is not within the range of V5 ports (1-21).
370 ENODEV - The port cannot be configured as a motor
371
372 \param port
373 The V5 port number from 1-21
374
375 \return 1 if the temperature limit is exceeded and 0 if the the temperature
376 is below the limit, or PROS_ERR if the operation failed, setting errno.
377 */
378 pub fn motor_is_over_temp(port: i8) -> i32;
379 /**
380 Checks if the motor is stopped.
381
382 \note Although this function forwards data from the motor, the motor
383 presently does not provide any value. This function returns PROS_ERR with
384 errno set to ENOSYS.
385
386 \param port
387 The V5 port number from 1-21
388
389 \return 1 if the motor is not moving, 0 if the motor is moving, or PROS_ERR
390 if the operation failed, setting errno
391 */
392 pub fn motor_is_stopped(port: i8) -> i32;
393 /**
394 Checks if the motor is at its zero position.
395
396 \note Although this function forwards data from the motor, the motor
397 presently does not provide any value. This function returns PROS_ERR with
398 errno set to ENOSYS.
399
400 \param port
401 The V5 port number from 1-21
402
403 \return 1 if the motor is at zero absolute position, 0 if the motor has
404 moved from its absolute zero, or PROS_ERR if the operation failed,
405 setting errno
406 */
407 pub fn motor_get_zero_position_flag(port: i8) -> i32;
408
409 /**
410 Gets the faults experienced by the motor.
411
412 Compare this bitfield to the bitmasks in motor_fault_e_t.
413
414 This function uses the following values of errno when an error state is
415 reached:
416 ENXIO - The given value is not within the range of V5 ports (1-21).
417 ENODEV - The port cannot be configured as a motor
418
419 \param port
420 The V5 port number from 1-21
421
422 \return A bitfield containing the motor's faults.
423 */
424 pub fn motor_get_faults(port: i8) -> motor_fault_e_t;
425 /**
426 Gets the flags set by the motor's operation.
427
428 Compare this bitfield to the bitmasks in motor_flag_e_t.
429
430 This function uses the following values of errno when an error state is
431 reached:
432 ENXIO - The given value is not within the range of V5 ports (1-21).
433 ENODEV - The port cannot be configured as a motor
434
435 \param port
436 The V5 port number from 1-21
437
438 \return A bitfield containing the motor's flags.
439 */
440 pub fn motor_get_flags(port: i8) -> motor_flag_e_t;
441
442 /**
443 Gets the raw encoder count of the motor at a given timestamp.
444
445 This function uses the following values of errno when an error state is
446 reached:
447 ENXIO - The given value is not within the range of V5 ports (1-21).
448 ENODEV - The port cannot be configured as a motor
449
450 \param port
451 The V5 port number from 1-21
452 \param\[in] timestamp
453 A pointer to a time in milliseconds for which the encoder count
454 will be returned. If NULL, the timestamp at which the encoder
455 count was read will not be supplied
456
457 \return The raw encoder count at the given timestamp or PROS_ERR if the
458 operation failed.
459 */
460 pub fn motor_get_raw_position(port: i8, timestamp: *const u32) -> i32;
461 /**
462 Gets the absolute position of the motor in its encoder units.
463
464 This function uses the following values of errno when an error state is
465 reached:
466 ENXIO - The given value is not within the range of V5 ports (1-21).
467 ENODEV - The port cannot be configured as a motor
468
469 \param port
470 The V5 port number from 1-21
471
472 \return The motor's absolute position in its encoder units or PROS_ERR_F
473 if the operation failed, setting errno.
474 */
475 pub fn motor_get_position(port: i8) -> c_double;
476 /**
477 Gets the power drawn by the motor in Watts.
478
479 This function uses the following values of errno when an error state is
480 reached:
481 ENXIO - The given value is not within the range of V5 ports (1-21).
482 ENODEV - The port cannot be configured as a motor
483
484 \param port
485 The V5 port number from 1-21
486
487 \return The motor's power draw in Watts or PROS_ERR_F if the operation
488 failed, setting errno.
489 */
490 pub fn motor_get_power(port: i8) -> c_double;
491 /**
492 Gets the temperature of the motor in degrees Celsius.
493
494 This function uses the following values of errno when an error state is
495 reached:
496 ENXIO - The given value is not within the range of V5 ports (1-21).
497 ENODEV - The port cannot be configured as a motor
498
499 \param port
500 The V5 port number from 1-21
501
502 \return The motor's temperature in degrees Celsius or PROS_ERR_F if the
503 operation failed, setting errno.
504 */
505 pub fn motor_get_temperature(port: i8) -> c_double;
506 /**
507 Gets the torque generated by the motor in Newton Meters (Nm).
508
509 This function uses the following values of errno when an error state is
510 reached:
511 ENXIO - The given value is not within the range of V5 ports (1-21).
512 ENODEV - The port cannot be configured as a motor
513
514 \param port
515 The V5 port number from 1-21
516
517 \return The motor's torque in Nm or PROS_ERR_F if the operation failed,
518 setting errno.
519 */
520 pub fn motor_get_torque(port: i8) -> c_double;
521 /**
522 Gets the voltage delivered to the motor in millivolts.
523
524 This function uses the following values of errno when an error state is
525 reached:
526 ENXIO - The given value is not within the range of V5 ports (1-21).
527 ENODEV - The port cannot be configured as a motor
528
529 \param port
530 The V5 port number from 1-21
531
532 \return The motor's voltage in mV or PROS_ERR_F if the operation failed,
533 setting errno.
534 */
535 pub fn motor_get_voltage(port: i8) -> i32;
536
537 /**
538 Sets the position for the motor in its encoder units.
539
540 This will be the future reference point for the motor's "absolute" position.
541
542 This function uses the following values of errno when an error state is
543 reached:
544 ENXIO - The given value is not within the range of V5 ports (1-21).
545 ENODEV - The port cannot be configured as a motor
546
547 \param port
548 The V5 port number from 1-21
549 \param position
550 The new reference position in its encoder units
551
552 \return 1 if the operation was successful or PROS_ERR if the operation
553 failed, setting errno.
554 */
555 pub fn motor_set_zero_position(port: i8, position: c_double) -> i32;
556 /**
557 Sets the "absolute" zero position of the motor to its current position.
558
559 This function uses the following values of errno when an error state is
560 reached:
561 ENXIO - The given value is not within the range of V5 ports (1-21).
562 ENODEV - The port cannot be configured as a motor
563
564 \param port
565 The V5 port number from 1-21
566
567 \return 1 if the operation was successful or PROS_ERR if the operation
568 failed, setting errno.
569 */
570 pub fn motor_tare_position(port: i8) -> i32;
571 /**
572 Sets one of motor_brake_mode_e_t to the motor.
573
574 This function uses the following values of errno when an error state is
575 reached:
576 ENXIO - The given value is not within the range of V5 ports (1-21).
577 ENODEV - The port cannot be configured as a motor
578
579 \param port
580 The V5 port number from 1-21
581 \param mode
582 The motor_brake_mode_e_t to set for the motor
583
584 \return 1 if the operation was successful or PROS_ERR if the operation
585 failed, setting errno.
586 */
587 pub fn motor_set_brake_mode(port: i8, mode: motor_brake_mode_e_t) -> i32;
588 /**
589 Sets the current limit for the motor in mA.
590
591 This function uses the following values of errno when an error state is
592 reached:
593 ENXIO - The given value is not within the range of V5 ports (1-21).
594 ENODEV - The port cannot be configured as a motor
595
596 \param port
597 The V5 port number from 1-21
598 \param limit
599 The new current limit in mA
600
601 \return 1 if the operation was successful or PROS_ERR if the operation
602 failed, setting errno.
603 */
604 pub fn motor_set_current_limit(port: i8, limit: i32) -> i32;
605 /**
606 Sets one of motor_encoder_units_e_t for the motor encoder.
607
608 This function uses the following values of errno when an error state is
609 reached:
610 ENXIO - The given value is not within the range of V5 ports (1-21).
611 ENODEV - The port cannot be configured as a motor
612
613 \param port
614 The V5 port number from 1-21
615 \param units
616 The new motor encoder units
617
618 \return 1 if the operation was successful or PROS_ERR if the operation
619 failed, setting errno.
620 */
621 pub fn motor_set_encoder_units(port: i8, units: motor_encoder_units_e_t) -> i32;
622 /**
623 Sets one of motor_gearset_e_t for the motor.
624
625 This function uses the following values of errno when an error state is
626 reached:
627 ENXIO - The given value is not within the range of V5 ports (1-21).
628 ENODEV - The port cannot be configured as a motor
629
630 \param port
631 The V5 port number from 1-21
632 \param gearset
633 The new motor gearset
634
635 \return 1 if the operation was successful or PROS_ERR if the operation
636 failed, setting errno.
637 */
638 pub fn motor_set_gearing(port: i8, gearset: motor_gearset_e_t) -> i32;
639
640 /**
641 Takes in floating point values and returns a properly formatted pid struct.
642 The motor_pid_s_t struct is in 4.4 format, i.e. 0x20 is 2.0, 0x21 is 2.0625,
643 etc.
644 This function will convert the floating point values to the nearest 4.4
645 value.
646
647 This function uses the following values of errno when an error state is
648 reached:
649 ENXIO - The given value is not within the range of V5 ports (1-21).
650 ENODEV - The port cannot be configured as a motor
651
652 \param kf
653 The feedforward constant
654 \param kp
655 The proportional constant
656 \param ki
657 The integral constant
658 \param kd
659 The derivative constant
660
661 \return A motor_pid_s_t struct formatted properly in 4.4.
662 */
663 #[deprecated(
664 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
665 )]
666 pub fn motor_convert_pid(
667 kf: c_double,
668 kp: c_double,
669 ki: c_double,
670 kd: c_double,
671 ) -> motor_pid_s_t;
672 /**
673 Takes in floating point values and returns a properly formatted pid struct.
674 The motor_pid_s_t struct is in 4.4 format, i.e. 0x20 is 2.0, 0x21 is 2.0625,
675 etc.
676 This function will convert the floating point values to the nearest 4.4
677 value.
678
679 This function uses the following values of errno when an error state is
680 reached:
681 ENXIO - The given value is not within the range of V5 ports (1-21).
682 ENODEV - The port cannot be configured as a motor
683
684 \param kf
685 The feedforward constant
686 \param kp
687 The proportional constant
688 \param ki
689 The integral constant
690 \param kd
691 The derivative constant
692 \param filter
693 A constant used for filtering the profile acceleration
694 \param limit
695 The integral limit
696 \param threshold
697 The threshold for determining if a position movement has reached its
698 goal. This has no effect for velocity PID calculations.
699 \param loopspeed
700 The rate at which the PID computation is run in ms
701
702 \return A motor_pid_s_t struct formatted properly in 4.4.
703 */
704 #[deprecated(
705 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
706 )]
707 pub fn motor_convert_pid_full(
708 kf: c_double,
709 kp: c_double,
710 ki: c_double,
711 kd: c_double,
712 filter: c_double,
713 limit: c_double,
714 threshold: c_double,
715 loopspeed: c_double,
716 ) -> motor_pid_full_s_t;
717 /**
718 Sets one of motor_pid_s_t for the motor. This intended to just modify the
719 main PID constants.
720
721 Only non-zero values of the struct will change the existing motor constants.
722
723 \note This feature is in beta, it is advised to use caution when modifying
724 the PID values. The motor could be damaged by particularly large constants.
725
726 This function uses the following values of errno when an error state is
727 reached:
728 ENXIO - The given value is not within the range of V5 ports (1-21).
729 ENODEV - The port cannot be configured as a motor
730
731 \param port
732 The V5 port number from 1-21
733 \param pid
734 The new motor PID constants
735
736 \return 1 if the operation was successful or PROS_ERR if the operation
737 failed, setting errno.
738 */
739 #[deprecated(
740 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
741 )]
742 pub fn motor_set_pos_pid(port: i8, pid: motor_pid_s_t) -> i32;
743 /**
744 Sets one of motor_pid_full_s_t for the motor.
745
746 Only non-zero values of the struct will change the existing motor constants.
747
748 \note This feature is in beta, it is advised to use caution when modifying
749 the PID values. The motor could be damaged by particularly large constants.
750
751 This function uses the following values of errno when an error state is
752 reached:
753 ENXIO - The given value is not within the range of V5 ports (1-21).
754 ENODEV - The port cannot be configured as a motor
755
756 \param port
757 The V5 port number from 1-21
758 \param pid
759 The new motor PID constants
760
761 \return 1 if the operation was successful or PROS_ERR if the operation
762 failed, setting errno.
763 */
764 #[deprecated(
765 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
766 )]
767 pub fn motor_set_pos_pid_full(port: i8, pid: motor_pid_full_s_t) -> i32;
768 /**
769 Sets one of motor_pid_s_t for the motor. This intended to just modify the
770 main PID constants.
771
772 Only non-zero values of the struct will change the existing motor constants.
773
774 \note This feature is in beta, it is advised to use caution when modifying
775 the PID values. The motor could be damaged by particularly large constants.
776
777 This function uses the following values of errno when an error state is
778 reached:
779 ENXIO - The given value is not within the range of V5 ports (1-21).
780 ENODEV - The port cannot be configured as a motor
781
782 \param port
783 The V5 port number from 1-21
784 \param pid
785 The new motor PID constants
786
787 \return 1 if the operation was successful or PROS_ERR if the operation
788 failed, setting errno.
789 */
790 #[deprecated(
791 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
792 )]
793 pub fn motor_set_vel_pid(port: i8, pid: motor_pid_s_t) -> i32;
794 /**
795 Sets one of motor_pid_full_s_t for the motor.
796
797 Only non-zero values of the struct will change the existing motor constants.
798
799 \note This feature is in beta, it is advised to use caution when modifying
800 the PID values. The motor could be damaged by particularly large constants.
801
802 This function uses the following values of errno when an error state is
803 reached:
804 ENXIO - The given value is not within the range of V5 ports (1-21).
805 ENODEV - The port cannot be configured as a motor
806
807 \param port
808 The V5 port number from 1-21
809 \param pid
810 The new motor PID constants
811
812 \return 1 if the operation was successful or PROS_ERR if the operation
813 failed, setting errno.
814 */
815 #[deprecated(
816 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
817 )]
818 pub fn motor_set_vel_pid_full(port: i8, pid: motor_pid_full_s_t) -> i32;
819 /**
820 Gets the position PID that was set for the motor. This function will return
821 zero for all of the parameters if the motor_set_pos_pid() or
822 motor_set_pos_pid_full() functions have not been used.
823
824 This function uses the following values of errno when an error state is
825 reached:
826 ENXIO - The given value is not within the range of V5 ports (1-21).
827 ENODEV - The port cannot be configured as a motor
828
829 Additionally, in an error state all values of the returned struct are set
830 to their negative maximum values.
831
832 \param port
833 The V5 port number from 1-21
834
835 \return A motor_pid_full_s_t containing the position PID constants last set
836 to the given motor
837 */
838 #[deprecated(
839 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
840 )]
841 pub fn motor_get_pos_pid(port: i8) -> motor_pid_full_s_t;
842 /**
843 Gets the velocity PID that was set for the motor. This function will return
844 zero for all of the parameters if the motor_set_vel_pid() or
845 motor_set_vel_pid_full() functions have not been used.
846
847 This function uses the following values of errno when an error state is
848 reached:
849 ENXIO - The given value is not within the range of V5 ports (1-21).
850 ENODEV - The port cannot be configured as a motor
851
852 Additionally, in an error state all values of the returned struct are set
853 to their negative maximum values.
854
855 \param port
856 The V5 port number from 1-21
857
858 \return A motor_pid_full_s_t containing the velocity PID constants last set
859 to the given motor
860 */
861 #[deprecated(
862 note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
863 )]
864 pub fn motor_get_vel_pid(port: i8) -> motor_pid_full_s_t;
865 /**
866 Sets the reverse flag for the motor.
867
868 This will invert its movements and the values returned for its position.
869
870 This function uses the following values of errno when an error state is
871 reached:
872 ENXIO - The given value is not within the range of V5 ports (1-21).
873 ENODEV - The port cannot be configured as a motor
874
875 \param port
876 The V5 port number from 1-21
877 \param reverse
878 True reverses the motor, false is default
879
880 \return 1 if the operation was successful or PROS_ERR if the operation
881 failed, setting errno.
882 */
883 pub fn motor_set_reversed(port: i8, reversed: bool) -> i32;
884 /**
885 Sets the voltage limit for the motor in Volts.
886
887 This function uses the following values of errno when an error state is
888 reached:
889 ENXIO - The given value is not within the range of V5 ports (1-21).
890 ENODEV - The port cannot be configured as a motor
891
892 \param port
893 The V5 port number from 1-21
894 \param limit
895 The new voltage limit in Volts
896
897 \return 1 if the operation was successful or PROS_ERR if the operation
898 failed, setting errno.
899 */
900 pub fn motor_set_voltage_limit(port: i8, limit: i32) -> i32;
901 /**
902 Gets the brake mode that was set for the motor.
903
904 This function uses the following values of errno when an error state is
905 reached:
906 ENXIO - The given value is not within the range of V5 ports (1-21).
907 ENODEV - The port cannot be configured as a motor
908
909 \param port
910 The V5 port number from 1-21
911
912 \return One of motor_brake_mode_e_t, according to what was set for the motor,
913 or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno.
914 */
915 pub fn motor_get_brake_mode(port: i8) -> motor_brake_mode_e_t;
916 /**
917 Gets the current limit for the motor in mA.
918
919 The default value is 2500 mA.
920
921 This function uses the following values of errno when an error state is
922 reached:
923 ENXIO - The given value is not within the range of V5 ports (1-21).
924 ENODEV - The port cannot be configured as a motor
925
926 \param port
927 The V5 port number from 1-21
928
929 \return The motor's current limit in mA or PROS_ERR if the operation failed,
930 setting errno.
931 */
932 pub fn motor_get_current_limit(port: i8) -> i32;
933 /**
934 Gets the encoder units that were set for the motor.
935
936 This function uses the following values of errno when an error state is
937 reached:
938 ENXIO - The given value is not within the range of V5 ports (1-21).
939 ENODEV - The port cannot be configured as a motor
940
941 \param port
942 The V5 port number from 1-21
943
944 \return One of motor_encoder_units_e_t according to what is set for the motor
945 or E_MOTOR_ENCODER_INVALID if the operation failed.
946 */
947 pub fn motor_get_encoder_units(port: i8) -> motor_encoder_units_e_t;
948 /**
949 Gets the gearset that was set for the motor.
950
951 This function uses the following values of errno when an error state is
952 reached:
953 ENXIO - The given value is not within the range of V5 ports (1-21).
954 ENODEV - The port cannot be configured as a motor
955
956 \param port
957 The V5 port number from 1-21
958
959 \return One of motor_gearset_e_t according to what is set for the motor,
960 or E_GEARSET_INVALID if the operation failed.
961 */
962 pub fn motor_get_gearing(port: i8) -> motor_gearset_e_t;
963 /**
964 Gets the operation direction of the motor as set by the user.
965
966 This function uses the following values of errno when an error state is
967 reached:
968 ENXIO - The given value is not within the range of V5 ports (1-21).
969 ENODEV - The port cannot be configured as a motor
970
971 \param port
972 The V5 port number from 1-21
973
974 \return 1 if the motor has been reversed and 0 if the motor was not reversed,
975 or PROS_ERR if the operation failed, setting errno.
976 */
977 pub fn motor_is_reversed(port: i8) -> i32;
978 /**
979 Gets the voltage limit set by the user.
980
981 Default value is 0V, which means that there is no software limitation imposed
982 on the voltage.
983
984 This function uses the following values of errno when an error state is
985 reached:
986 ENXIO - The given value is not within the range of V5 ports (1-21).
987 ENODEV - The port cannot be configured as a motor
988
989 \param port
990 The V5 port number from 1-21
991
992 \return The motor's voltage limit in V or PROS_ERR if the operation failed,
993 setting errno.
994 */
995 pub fn motor_get_voltage_limit(port: i8) -> i32;
996}