WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
XRPMotor.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <frc/MotorSafety.h>
9
10#include <map>
11#include <set>
12#include <string>
13
14#include <hal/SimDevice.h>
15#include <wpi/deprecated.h>
16
17namespace frc {
18
20
21/**
22 * @defgroup xrp_api XRP Hardware API
23 * @{
24 */
25
26/**
27 * XRPMotor.
28 *
29 * <p>A SimDevice based motor controller representing the motors on an XRP robot
30 */
32 public:
33 /**
34 * Constructs an XRPMotor.
35 *
36 * @param deviceNum the motor channel
37 */
38 explicit XRPMotor(int deviceNum);
39
40 void Set(double value) override;
41 double Get() const override;
42
43 void SetInverted(bool isInverted) override;
44 bool GetInverted() const override;
45
46 void Disable() override;
47
48 void StopMotor() override;
49 std::string GetDescription() const override;
50
51 private:
52 hal::SimDevice m_simDevice;
53 hal::SimDouble m_simSpeed;
54 hal::SimBoolean m_simInverted;
55
56 std::string m_deviceName;
57
58 static std::map<int, std::string> s_simDeviceMap;
59 static std::set<int> s_registeredDevices;
60
61 static void CheckDeviceAllocation(int deviceNum);
62};
63
64/** @} */
65
67
68} // namespace frc
Interface for motor controlling devices.
Definition MotorController.h:14
The Motor Safety feature acts as a watchdog timer for an individual motor.
Definition MotorSafety.h:25
XRPMotor.
Definition XRPMotor.h:31
XRPMotor(int deviceNum)
Constructs an XRPMotor.
void StopMotor() override
Common interface to stop the motor until Set is called again.
void Disable() override
Common interface for disabling a motor.
void Set(double value) override
Common interface for setting the speed of a motor controller.
void SetInverted(bool isInverted) override
Common interface for inverting direction of a motor controller.
std::string GetDescription() const override
Returns a description to print when an error occurs.
bool GetInverted() const override
Common interface for returning the inversion state of a motor controller.
double Get() const override
Common interface for getting the current set speed of a motor controller.
C++ wrapper around a HAL simulator boolean value handle.
Definition SimDevice.h:611
A move-only C++ wrapper around a HAL simulator device handle.
Definition SimDevice.h:645
C++ wrapper around a HAL simulator double value handle.
Definition SimDevice.h:536
#define WPI_IGNORE_DEPRECATED
Definition deprecated.h:16
#define WPI_UNIGNORE_DEPRECATED
Definition deprecated.h:27
Definition CAN.h:11