Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] LAUNCH: add launch for second pneumatics board #428

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
<launch>
<node pkg="mil_pneumatic_actuator" type="pneumatic_actuator_node" name="actuator_driver" output="screen">
<param name="port" value="/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI02L380-if00-port0"/>
<param name="port" value="/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A403IMCP-if00-port0"/>
<rosparam param="actuators">
# ONLY BL has been verfied on navigator, others are not currently connected
BL_unlock: 1
BL_extend: 3
BL_retract: 2

# TODO: fix once it is all plugged in
#FL_unlock: 5
#FL_extend: 6
#FL_retract: 7
#FR_unlock: 8
#FR_extend: 9
#FR_retract: 10
#BR_unlock: 11
#BR_extend: 12
#BR_retract: 12

# TODO: valves for ball launcher
LAUNCHER_RELOAD:
type: set
ports:
open_port:
id: 4
default: False
close_port:
id: 5
default: False

LAUNCHER_FIRE:
type: pulse
pulse_time: 0.5
ports:
open_port:
id: 7
default: False
</rosparam>
</node>
<node pkg="mil_pneumatic_actuator" type="pneumatic_actuator_node" name="actuator_driver2" output="screen">
<param name="port" value="/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A403IMC9-if00-port0"/>
<rosparam param="actuators">
# ONLY BL has been verfied on navigator, others are not currently connected
BL_unlock: 1
Expand Down
30 changes: 18 additions & 12 deletions mission_control/navigator_missions/navigator_missions/navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def enu_odom_set(odom):

try:
cls._actuator_client = cls.nh.get_service_client('/actuator_driver/actuate', SetValve)
cls._actuator_client2 = cls.nh.get_service_client('/actuator_driver2/actuate', SetValve)
cls._database_query = cls.nh.get_service_client('/database/requests', ObjectDBQuery)
cls._camera_database_query = cls.nh.get_service_client(
'/camera_database/requests', navigator_srvs.CameraDBQuery)
Expand Down Expand Up @@ -202,41 +203,43 @@ def deploy_thruster(self, name):
'''
Execute sequence to deploy one thruster
'''
board = 2 if name in ['BL', 'BR'] else 1
extend = name + '_extend'
retract = name + '_retract'
unlock = name + '_unlock'
# Pull thruster up a bit to remove pressure from lock
yield self.set_valve(retract, True)
yield self.set_valve(retract, True, board=board)
yield self.nh.sleep(self._actuator_timing['deploy_loosen_time'])
# Stop pulling thruster up and unlock
yield self.set_valve(retract, False)
yield self.set_valve(unlock, True)
yield self.set_valve(retract, False, board=board)
yield self.set_valve(unlock, True, board=board)
# Beging extending piston to push thruster down
yield self.set_valve(extend, True)
yield self.set_valve(extend, True, board=board)
yield self.nh.sleep(self._actuator_timing['deploy_wait_time'])
# Lock and stop extending after waiting a time for lock to engage
yield self.set_valve(unlock, False)
yield self.set_valve(unlock, False, board=board)
yield self.nh.sleep(self._actuator_timing['deploy_lock_time'])
yield self.set_valve(extend, False)
yield self.set_valve(extend, False, board=board)

@util.cancellableInlineCallbacks
def retract_thruster(self, name):
'''
Execute sequence to retract one thruster
'''
board = 2 if name in ['BL', 'BR'] else 1
retract = name + '_retract'
unlock = name + '_unlock'
# Unlock and begin pulling thruster up
yield self.set_valve(unlock, True)
yield self.set_valve(retract, True)
yield self.set_valve(unlock, True, board=board)
yield self.set_valve(retract, True, board=board)
# Wait time for piston to fully retract
yield self.nh.sleep(self._actuator_timing['retract_wait_time'])
# Lock thruster in place
yield self.set_valve(unlock, False)
yield self.set_valve(unlock, False, board=board)
# Wait some time for lock to engage
yield self.nh.sleep(self._actuator_timing['retract_lock_time'])
# Stop pulling up
yield self.set_valve(retract, False)
yield self.set_valve(retract, False, board=board)

def deploy_thrusters(self):
'''
Expand Down Expand Up @@ -273,9 +276,12 @@ def fire_launcher(self):
yield self.nh.sleep(0.5)
self.launcher_state = "inactive"

def set_valve(self, name, state):
def set_valve(self, name, state, board=1):
req = SetValveRequest(actuator=name, opened=state)
return self._actuator_client(req)
if board == 2:
return self._actuator_client2(req)
else:
return self._actuator_client(req)

@util.cancellableInlineCallbacks
def get_sorted_objects(self, name, n=-1, throw=True, **kwargs):
Expand Down