Closed Carter90 closed 3 years ago
Nice streamlining @Carter90 !
You can also test this by running the docker container:
./build.sh
./runREPL.sh
then issuing the REPL command @Carter90 mentioned:
scout.searchRandomWalk.main()
I did get the following None-pointer-exception:
[WARN] [1620076926.664735, 363.025000]: I found a volatile! carbon_dioxide
[INFO] [1620076926.691521, 363.032000]: Wandering...
[WARN] [1620076932.423870, 368.400000]: Exiting
Traceback (most recent call last):
File "/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py", line 49, in random_walk
wander()
File "/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py", line 30, in wander
scoot.drive(random.gauss(4, 1), ignore=ignoring)
File "/SC2/src/scoot/src/Scoot.py", line 487, in drive
return self.__drive(req, **kwargs)
File "/SC2/src/scoot/src/Scoot.py", line 88, in wrapped_f
return func(*args, **kwargs)
File "/SC2/src/scoot/src/Scoot.py", line 467, in __drive
raise VolatileException(value)
Scoot.VolatileException: 2
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3441, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-dad883dc50b2>", line 1, in <module>
scout.searchRandomWalk.main()
File "/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py", line 85, in main
random_walk(num_moves=50)
File "/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py", line 67, in random_walk
sys.exit(0)
SystemExit: 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py", line 1101, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py", line 248, in wrapped
return f(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py", line 281, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "/usr/lib/python3.8/inspect.py", line 1503, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
AttributeError: 'tuple' object has no attribute 'tb_frame'
---------------------------------------------------------------------------
VolatileException Traceback (most recent call last)
/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py in random_walk(num_moves)
48 sys.exit(-1)
---> 49 wander()
50 except VolatileException:
/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py in wander()
29 rospy.loginfo("Wandering...")
---> 30 scoot.drive(random.gauss(4, 1), ignore=ignoring)
31 scoot.turn(random.gauss(-math.pi / 4, math.pi / 4), ignore=ignoring)
/SC2/src/scoot/src/Scoot.py in drive(self, distance, **kwargs)
486 )
--> 487 return self.__drive(req, **kwargs)
488
/SC2/src/scoot/src/Scoot.py in wrapped_f(*args, **kwargs)
87 with self.lock:
---> 88 return func(*args, **kwargs)
89
/SC2/src/scoot/src/Scoot.py in __drive(self, request, **kwargs)
466 self.control_data = data # behaviors would fetch
--> 467 raise VolatileException(value)
468 elif value == MoveResult.TIMEOUT:
VolatileException: 2
During handling of the above exception, another exception occurred:
SystemExit Traceback (most recent call last)
[... skipping hidden 1 frame]
/SC2/src/scoot/src/repl.py in <module>
----> 1 scout.searchRandomWalk.main()
/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py in main(task)
84
---> 85 random_walk(num_moves=50)
86 scoot.brake()
/SC2/src/scoot/src/behaviors/scout/searchRandomWalk.py in random_walk(num_moves)
66 rospy.logwarn('Exiting')
---> 67 sys.exit(0)
68
SystemExit: 0
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
[... skipping hidden 1 frame]
/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
2052 stb = ['An exception has occurred, use %tb to see '
2053 'the full traceback.\n']
-> 2054 stb.extend(self.InteractiveTB.get_exception_only(etype,
2055 value))
2056 else:
/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py in get_exception_only(self, etype, value)
752 value : exception value
753 """
--> 754 return ListTB.structured_traceback(self, etype, value)
755
756 def show_exception_only(self, etype, evalue):
/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, context)
627 chained_exceptions_tb_offset = 0
628 out_list = (
--> 629 self.structured_traceback(
630 etype, evalue, (etb, chained_exc_ids),
631 chained_exceptions_tb_offset, context)
/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1365 else:
1366 self.tb = tb
-> 1367 return FormattedTB.structured_traceback(
1368 self, etype, value, tb, tb_offset, number_of_lines_of_context)
1369
/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1265 if mode in self.verbose_modes:
1266 # Verbose modes need a full traceback
-> 1267 return VerboseTB.structured_traceback(
1268 self, etype, value, tb, tb_offset, number_of_lines_of_context
1269 )
/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
1122 """Return a nice text document describing the traceback."""
1123
-> 1124 formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
1125 tb_offset)
1126
/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py in format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)
1080
1081
-> 1082 last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
1083
1084 frames = self.format_records(records, last_unique, recursion_repeat)
/usr/local/lib/python3.8/dist-packages/IPython/core/ultratb.py in find_recursion(etype, value, records)
380 # first frame (from in to out) that looks different.
381 if not is_recursion_error(etype, value, records):
--> 382 return len(records), 0
383
384 # Select filename, lineno, func_name to track frames with
TypeError: object of type 'NoneType' has no len()
@johncarl81 funny enough that is a good thing that is how the behaviors talk to the main state machine(task) all the other errors are due to the ipython not knowing how to handle it but the repl should still work
Gotcha, so this is just the exception occurring when a volatile is detected, right?
Gotcha, so this is just the exception occurring when a volatile is detected, right?
Right we call exit 0 when a volatile is found that would normally be caught as an exit code by task but because we are running it from the repl the repl does not know how to handle an exit
run sim
other term
then in the repl run
When a volatile is found you should get a
SystemExit: 0
from the randomwalk right before it drives away a bit from the volatileYou can check that it reported the volatile's location by looking at this new parameter
Closes #195 #194