Skip to content

Commit

Permalink
Merge pull request #170 from cwruRobotics/valve-manip-reverse
Browse files Browse the repository at this point in the history
Valve manip reverse
  • Loading branch information
InvincibleRMC authored May 3, 2024
2 parents 7c90aca + 52a0a5e commit 64bb9d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/pi/manipulators/manipulators/valve_manipulator_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ def manip_callback(self, message: ValveManip) -> None:
if message.active:
if not self.curr_active:
self.curr_active = True
self.servo(1900)
self.servo(message.pwm)
else:
if self.curr_active:
self.curr_active = False
self.servo(1500)
self.servo(ValveManip.NEUTRAL_PWM)


def main() -> None:
Expand Down
7 changes: 6 additions & 1 deletion src/rov_msgs/msg/ValveManip.msg
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
bool active
bool active
uint16 pwm

uint16 MAX_PWM = 1900
uint16 NEUTRAL_PWM = 1500
uint16 MIN_PWM = 1100
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ def manip_callback(self, msg: Joy) -> None:

def valve_manip_callback(self, msg: Joy) -> None:
if msg.buttons[TRI_BUTTON] == 1:
self.valve_manip.publish(ValveManip(active=True))
self.valve_manip.publish(ValveManip(active=True, pwm=ValveManip.MAX_PWM))
elif msg.buttons[SQUARE_BUTTON] == 1:
self.valve_manip.publish(ValveManip(active=True, pwm=ValveManip.MIN_PWM))
else:
self.valve_manip.publish(ValveManip(active=False))

Expand Down

0 comments on commit 64bb9d2

Please sign in to comment.