gilestrolab / ethoscope

a platform from monitoring animal behaviour in real time from a raspberry pi
http://lab.gilest.ro/ethoscope/
GNU General Public License v3.0
17 stars 25 forks source link

Problem updating Ethoscope to master branch #164

Closed pgorelik closed 2 years ago

pgorelik commented 2 years ago

Hello,

Whenever I try to update the Ethoscope to the latest master branch, the device_server stops and the device goes offline. I then have to manually change the branch back to dev from within the device to get it to work. When trying to run the latest master branch, I get the following status:

[alarm@ETHOSCOPE013 ethoscope-device]$ systemctl status ethoscope_device
* ethoscope_device.service - Ethoscope device server
     Loaded: loaded (/usr/lib/systemd/system/ethoscope_device.service; enabled; vendor preset: disabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-10-06 19:43:55 UTC; 1s ago
    Process: 3061 ExecStart=/usr/bin/python3 /opt/ethoscope-device/src/scripts/device_server.py -D (code=exited, status=1/FAILURE)
   Main PID: 3061 (code=exited, status=1/FAILURE)

My node is an old i5 PC and the Ethoscope runs on a rPi 3B+. After I burn a new SD card using the ISO and set it up, the status looks like in the picture below. However, as soon as I try to update the device to the most recent master branch, the device goes offline, and I get the error shown above.

image

If I update the device but stay on the dev branch, I get an error when I try to run the OptomotorSleepDepriver interactor. image

Sorry there has been an error: Traceback (most recent call last): File "/opt/ethoscope-device/src/ethoscope/web_utils/control_thread.py", line 485, in run self._start_tracking(cam, result_writer, rois, TrackerClass, tracker_kwargs, hardware_connection, StimulatorClass, stimulator_kwargs) File "/opt/ethoscope-device/src/ethoscope/web_utils/control_thread.py", line 342, in _start_tracking self._monit.run(result_writer, self._drawer) File "/opt/ethoscope-device/src/ethoscope/core/monitor.py", line 139, in run raise e File "/opt/ethoscope-device/src/ethoscope/core/monitor.py", line 117, in run data_rows = track_u.track(t, frame) File "/opt/ethoscope-device/src/ethoscope/core/tracking_unit.py", line 96, in track interact, result = self._stimulator.apply() File "/opt/ethoscope-device/src/ethoscope/stimulators/stimulators.py", line 56, in apply interact, result = self._decide() File "/opt/ethoscope-device/src/ethoscope/stimulators/sleep_depriver_stimulators.py", line 232, in _decide out, dic = super(OptomotorSleepDepriver, self)._decide() File "/opt/ethoscope-device/src/ethoscope/stimulators/sleep_depriver_stimulators.py", line 135, in _decide if random.uniform(0,1) <= self._p: TypeError: '<=' not supported between instances of 'float' and 'str' 

So, neither the master branch nor the dev branch is workable for me right now. Do you have any advice on what might be wrong?

Thanks, Pavel

ggilestro commented 2 years ago

Hi Pavel,

Please use the dev branch for now. Dev is the one that is currently maintained and Master is rather old. I will migrate current dev to master later this year.

The issue you reported regarding dev was an unrelated bug and should be fixed now. Make SURE that both your node and the ethoscopes are using the same branch (dev).

pgorelik commented 2 years ago

Hi Giorgio,

Thanks for the help. Unfortunately, there's still a problem. I have both the node and the ethoscope on the most recent dev branch, but I still get an error that seems related to the one I posted earlier.

image

Sorry there has been an error: Traceback (most recent call last): File "/opt/ethoscope-device/src/ethoscope/web_utils/control_thread.py", line 485, in run self._start_tracking(cam, result_writer, rois, TrackerClass, tracker_kwargs, hardware_connection, StimulatorClass, stimulator_kwargs) File "/opt/ethoscope-device/src/ethoscope/web_utils/control_thread.py", line 328, in _start_tracking stimulators = [StimulatorClass(hardware_connection, **stimulator_kwargs) for _ in rois] File "/opt/ethoscope-device/src/ethoscope/web_utils/control_thread.py", line 328, in <listcomp> stimulators = [StimulatorClass(hardware_connection, **stimulator_kwargs) for _ in rois] File "/opt/ethoscope-device/src/ethoscope/stimulators/sleep_depriver_stimulators.py", line 220, in __init__ super(OptomotorSleepDepriver, self).__init__(hardware_connection, velocity_correction_coef, min_inactive_time, date_range) File "/opt/ethoscope-device/src/ethoscope/stimulators/sleep_depriver_stimulators.py", line 112, in __init__ self._p = float(stimulus_probability) ValueError: could not convert string to float: ''

I can run the default stimulator without any problems though. Any additional advice?

Thanks, Pavel

pepelisu commented 2 years ago

Are you by any change leaving the option "stimulus probability" empty? it should be a number from 0 to 1

pgorelik commented 2 years ago

Hi,

I was attempting to use the 'OptoMotorSleepDepriver' interactor, which does not have a stimulus probability field. I see that 'SleepDepStimulator' has this option -- is this the interactor I should be using for sleep deprivation? Has 'OptoMotorSleepDepriver' been depricated? With 'SleepDepStimulator' my motors do not turn; however, this could be because I am still using old Arduino code. I will check that next.