WPILibC++ 2024.3.2
MotorControllerGroup.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 <functional>
8#include <vector>
9
10#include <wpi/deprecated.h>
13
15
17
18namespace frc {
19
20/**
21 * Allows multiple MotorController objects to be linked together.
22 */
23class [[deprecated(
24 "Use PWMMotorController::AddFollower() or if using CAN motor controllers,"
25 "use their method of following.")]] MotorControllerGroup
26 : public wpi::Sendable,
27 public MotorController,
28 public wpi::SendableHelper<MotorControllerGroup> {
29 public:
30 /**
31 * Create a new MotorControllerGroup with the provided MotorControllers.
32 *
33 * @tparam MotorControllers The MotorController types.
34 * @param motorController The first MotorController to add
35 * @param motorControllers The MotorControllers to add
36 */
37 template <class... MotorControllers>
38 explicit MotorControllerGroup(MotorController& motorController,
39 MotorControllers&... motorControllers);
40
41 /**
42 * Create a new MotorControllerGroup with the provided MotorControllers.
43 *
44 * @param motorControllers The MotorControllers to add.
45 */
47 std::vector<std::reference_wrapper<MotorController>>&& motorControllers);
48
51
52 void Set(double speed) override;
53 void SetVoltage(units::volt_t output) override;
54 double Get() const override;
55 void SetInverted(bool isInverted) override;
56 bool GetInverted() const override;
57 void Disable() override;
58 void StopMotor() override;
59
60 void InitSendable(wpi::SendableBuilder& builder) override;
61
62 private:
63 bool m_isInverted = false;
64 std::vector<std::reference_wrapper<MotorController>> m_motorControllers;
65
66 void Initialize();
67};
68
69} // namespace frc
70
72
you may not use this file except in compliance with the License You may obtain a copy of the License at software distributed under the License is distributed on an AS IS WITHOUT WARRANTIES OR CONDITIONS OF ANY either express or implied See the License for the specific language governing permissions and limitations under the License LLVM Exceptions to the Apache License As an if
Definition: ThirdPartyNotices.txt:289
or
Definition: ThirdPartyNotices.txt:196
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Definition: ThirdPartyNotices.txt:92
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf of
Definition: ThirdPartyNotices.txt:140
High level class for interfacing with CAN devices conforming to the standard CAN spec.
Definition: CAN.h:31
Allows multiple MotorController objects to be linked together.
Definition: MotorControllerGroup.h:28
double Get() const override
Common interface for getting the current set speed of a motor controller.
void StopMotor() override
Common interface to stop the motor until Set is called again.
MotorControllerGroup & operator=(MotorControllerGroup &&)=default
void SetVoltage(units::volt_t output) override
Sets the voltage output of the MotorController.
void Set(double speed) override
Common interface for setting the speed of a motor controller.
bool GetInverted() const override
Common interface for returning the inversion state of a motor controller.
MotorControllerGroup(MotorControllerGroup &&)=default
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
MotorControllerGroup(std::vector< std::reference_wrapper< MotorController > > &&motorControllers)
Create a new MotorControllerGroup with the provided MotorControllers.
void SetInverted(bool isInverted) override
Common interface for inverting direction of a motor controller.
void Disable() override
Common interface for disabling a motor.
Interface for motor controlling devices.
Definition: MotorController.h:14
Common base class for all PWM Motor Controllers.
Definition: PWMMotorController.h:35
Helper class for building Sendable dashboard representations.
Definition: SendableBuilder.h:21
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:19
Interface for Sendable objects.
Definition: Sendable.h:16
#define WPI_IGNORE_DEPRECATED
Definition: deprecated.h:20
#define WPI_UNIGNORE_DEPRECATED
Definition: deprecated.h:31
Definition: AprilTagPoseEstimator.h:15