Skip to content

Commit b589621

Browse files
committed
Update climber nt
1 parent adf0036 commit b589621

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

subsystem/climber.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ def init(self) -> None:
2626
self.climber_motor.init()
2727
self.zero()
2828

29+
self.table = ntcore.NetworkTableInstance.getDefault().getTable("climber")
30+
self.pos_pub = self.table.getDoubleTopic("climber_motor_revolutions").publish()
31+
self.moving_pub = self.table.getBooleanTopic("climber_moving").publish()
32+
self.zero_pub = self.table.getBooleanTopic("climber_zeroed").publish()
33+
self.current_pub = self.table.getBooleanTopic("climber_motor_current").publish()
34+
2935
def zero(self) -> None:
3036
self.climber_motor.set_sensor_position(0)
3137
self.zeroed = True
@@ -39,12 +45,10 @@ def get_motor_revolutions(self) -> float:
3945
return self.climber_motor.get_sensor_position()
4046

4147
def update_table(self) -> None:
42-
table = ntcore.NetworkTableInstance.getDefault().getTable("climber")
43-
44-
table.putNumber("climber_motor_revolutions", self.climber_motor.get_sensor_position())
45-
table.putBoolean("climber_moving", self.moving)
46-
table.putBoolean("climber_zeroed", self.zeroed)
47-
table.putNumber("climber_motor_current", self.climber_motor.get_motor_current())
48+
self.pos_pub.set(self.climber_motor.get_sensor_position())
49+
self.moving_pub.set(self.moving)
50+
self.zero_pub.set(self.zeroed)
51+
self.current_pub.set(self.climber_motor.get_motor_current())
4852

4953
def periodic(self) -> None:
5054
if config.NT_CLIMBER:

0 commit comments

Comments
 (0)