|
@@ -32,6 +32,7 @@
|
|
|
"from controllers.situtils import FPSTimes\n",
|
|
|
"from controllers.camera import WebcamStream\n",
|
|
|
"from controllers.video import VideoWriter\n",
|
|
|
+ "from controllers.microphones import MicrophoneController\n",
|
|
|
"from controllers.position import PositionTrackerSingle, PositionTrackerDouble\n",
|
|
|
"from controllers.sound import SoundController, ContinuousSoundStream\n",
|
|
|
"from controllers.serial import MCSArduino, FakeArduino, SpeakerMotor, CableMotor\n",
|
|
@@ -125,6 +126,7 @@
|
|
|
"# update paths (assuming this paths are relative to this notebook)\n",
|
|
|
"cfg['video']['file_path'] = os.path.join(save_to, cfg['video']['file_path'])\n",
|
|
|
"cfg['video']['csv_path'] = os.path.join(save_to, cfg['video']['csv_path'])\n",
|
|
|
+ "cfg['microphones']['file_path'] = os.path.join(save_to, cfg['microphones']['file_path'])\n",
|
|
|
"cfg['position']['file_path'] = os.path.join(save_to, cfg['position']['file_path'])\n",
|
|
|
"cfg['position']['contour_path'] = os.path.join(save_to, cfg['position']['contour_path'])\n",
|
|
|
"cfg['experiment']['file_path'] = os.path.join(save_to, cfg['experiment']['file_path'])\n",
|
|
@@ -263,6 +265,11 @@
|
|
|
"vw = VideoWriter(status, vs, cfg['video'])\n",
|
|
|
"vw.start()\n",
|
|
|
"\n",
|
|
|
+ "# init microphone controller, if required\n",
|
|
|
+ "if cfg['microphones']['record_audio']:\n",
|
|
|
+ " mc = mp.Process(target=MicrophoneController.run, args=(status,cfg[\"microphones\"]))\n",
|
|
|
+ " mc.start()\n",
|
|
|
+ "\n",
|
|
|
"# start position tracking\n",
|
|
|
"pt = PositionTrackerSingle(status, vs, cfg['position']) if cfg['position']['single_agent'] else PositionTrackerDouble(status, vs, cfg['position'])\n",
|
|
|
"pt.start()\n",
|
|
@@ -584,6 +591,10 @@
|
|
|
" for ctrl in [pt, vw, vs]:\n",
|
|
|
" ctrl.stop()\n",
|
|
|
"\n",
|
|
|
+ " # stop microphones recording process\n",
|
|
|
+ " if cfg['microphones']['record_audio']:\n",
|
|
|
+ " mc.join()\n",
|
|
|
+ "\n",
|
|
|
" if 'continuous' in cfg['sound']:\n",
|
|
|
" time.sleep(cfg['sound']['continuous']['end_sleep'])\n",
|
|
|
" cst.stop()"
|