File tree Expand file tree Collapse file tree
wpimath/src/main/java/org/wpilib/math/system/proto Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,8 +32,7 @@ public DCMotor unpack(ProtobufDCMotor msg) {
3232 msg .getStallTorque (),
3333 msg .getStallCurrent (),
3434 msg .getFreeCurrent (),
35- msg .getFreeSpeed (),
36- 1 );
35+ msg .getFreeSpeed ());
3736 }
3837
3938 @ Override
Original file line number Diff line number Diff line change 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+ package org .wpilib .math .system .proto ;
6+
7+ import org .wpilib .math .proto .ProtobufGearbox ;
8+ import org .wpilib .math .system .DCMotor ;
9+ import org .wpilib .math .system .Gearbox ;
10+ import org .wpilib .util .protobuf .Protobuf ;
11+ import us .hebi .quickbuf .Descriptors .Descriptor ;
12+
13+ public class GearboxProto implements Protobuf <Gearbox , ProtobufGearbox > {
14+ @ Override
15+ public Class <Gearbox > getTypeClass () {
16+ return Gearbox .class ;
17+ }
18+
19+ @ Override
20+ public Descriptor getDescriptor () {
21+ return ProtobufGearbox .getDescriptor ();
22+ }
23+
24+ @ Override
25+ public ProtobufGearbox createMessage () {
26+ return ProtobufGearbox .newInstance ();
27+ }
28+
29+ @ Override
30+ public Gearbox unpack (ProtobufGearbox msg ) {
31+ return new Gearbox (
32+ DCMotor .proto .unpack (msg .getMotor ()), msg .getNumMotors (), msg .getReduction ());
33+ }
34+
35+ @ Override
36+ public void pack (ProtobufGearbox msg , Gearbox value ) {
37+ DCMotor .proto .pack (msg .getMutableMotor (), value .motor );
38+ msg .setNumMotors (value .numMotors );
39+ msg .setReduction (value .reduction );
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments