Skip to content

Commit

Permalink
trying to make command_astrobee not as heavy
Browse files Browse the repository at this point in the history
  • Loading branch information
marinagmoreira committed Jul 3, 2024
1 parent fd529f3 commit 41696d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ bays_move:
berth2_g: ["-pos", "0.1 -0.3 -0.68", "-att", "3.14 1 0 0"]

maps:
gra: "/data/maps/granite.map"
gro: "/data/maps/iss.map"
gra: "/res/maps/granite.map"
gro: "/res/maps/iss.map"

exposure:
gra: 175
Expand Down
4 changes: 2 additions & 2 deletions astrobee/survey/survey_manager/data/iss_survey_static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ bays_pano:

maps:
jem: "/data/maps/20240320_lam.map"
nod2: "/data/maps/20240205_usl_abad.map"
usl: "/data/maps/20240205_usl_abad.map"
nod2: "/data/maps/20240531_isaac15_best_teblid.map"
usl: "/data/maps/20240531_ISAAC15_USL-ONLY_teblid.map"

exposure:
jem: 175
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def write_output_once(self, output):

self.sock_output_connected = True
except socket.timeout:
time.sleep(0.1) # Add a small sleep interval at the start of the loop
continue

try:
Expand All @@ -193,6 +194,7 @@ def thread_write_output(self, process):
output_total = ""
try:
while not self._stop_event.is_set() and process.poll() is None:
time.sleep(0.1) # Add a small sleep interval at the start of the loop
# Get output from process
# loginfo("waiting for output")
output = process.stdout.readline()
Expand Down Expand Up @@ -224,6 +226,7 @@ def thread_write_output(self, process):
output.encode("ascii", errors="replace")[:CHUNK_SIZE]
)
except socket.timeout:
time.sleep(0.1) # Add a small sleep interval
continue
except (socket.error, BrokenPipeError):
loginfo("writer can't send data. Receiver may have disconnected.")
Expand All @@ -238,15 +241,16 @@ def thread_write_output(self, process):

def read_input_once(self) -> str:
while not (self.sock_input_connected or self._stop_event.is_set()):
# loginfo("waiting for connection")
try:
self.sock_input_conn, addr = self.sock_input.accept()
self.sock_input_conn.settimeout(1)
self.sock_input_connected = True
break
except socket.timeout:
time.sleep(0.1) # Add a small sleep interval
continue
while not self._stop_event.is_set():
time.sleep(0.1) # Add a small sleep interval at the start of the loop
try:
request = self.sock_input_conn.recv(CHUNK_SIZE).decode(
"ascii", errors="replace"
Expand All @@ -258,6 +262,7 @@ def read_input_once(self) -> str:
break
loginfo("request")
except socket.timeout:
time.sleep(0.1) # Add a small sleep interval
continue
except ConnectionResetError:
# Connection was reset, set sock_input_connected to False
Expand All @@ -271,22 +276,29 @@ def thread_read_input(self, process):
try:
while not self._stop_event.is_set():
while not (self.sock_input_connected or self._stop_event.is_set()):
# loginfo("waiting for connection")
time.sleep(
0.1
) # Add a small sleep interval at the start of the loop
try:
self.sock_input_conn, addr = self.sock_input.accept()
self.sock_input_conn.settimeout(1)
self.sock_input_connected = True
break
except socket.timeout:
time.sleep(0.1) # Add a small sleep interval
continue

while not self._stop_event.is_set():
time.sleep(
0.1
) # Add a small sleep interval at the start of the loop
try:
request = self.sock_input_conn.recv(CHUNK_SIZE).decode(
"ascii", errors="replace"
)
break
except socket.timeout:
time.sleep(0.1) # Add a small sleep interval
continue
except ConnectionResetError:
# Connection was reset, set sock_input_connected to False
Expand Down

0 comments on commit 41696d6

Please sign in to comment.