Hi, I am trying to build some autonomous behaviour into the MangOH using Octave edge actions. As a basic starter I thought to set an observation on the imu/gyro and route to the edge action. Since I don’t need to send this to the cloud I thought to do it fairly rapidly - every 5 sec.
In the edge action I am taking the RMS of the gyro values and using a large value to indicate ‘movement’ at which point I turn on the LED. If there is no movement I turn the LED off again.
This works well and is quite exciting to shake the device and watch the LED come on and shortly after it is left immobile the LED goes off.
However the problem comes after a long period - overnight? The device stops responding to shakes and no matter how much it moves, the LED does not come on. After a reboot it starts working again.
So my question is, how to debug this, is there any way to view queues within the edge action processing or determine if something is stuck?
FYI: this is the edge action code
function(event) {
// check the IMU gyroscope to see if we have moved around
var rms = Math.sqrt(Math.pow(event.value.x, 2)+Math.pow(event.value.y, 2)+Math.pow(event.value.z, 2))
// value > 1 means we have moved significantly
if (rms > 1) {
// moved
return {"dh://leds/mono/enable": [true]}
} else {
// not moving
return {"dh://leds/mono/enable": [false]}
}
}
Hi,
Without device traces it is hard to determine the problem root cause.
Could you please ssh the device when it stops responding and attach here the output of the logread
command ?
Thank you.
Nicolas
Nicolas,
thanks for the suggestion - I disconnected the device from the mains PSU and connected to the laptop to be able to get logs, however the logs available seem to relate to the time from the connection to the laptop. Do you have any suggestions to power the device overnight, connect to it to view logs without losing power? If I leave the device connected to the laptop inactive, it will sleep and power will be lost.
-Camilo
Hi Camilo,
It is recommended to power the device with a USB Power Supply, and not your laptop, that in some cases cannot provide enough current to make the device properly behave.
Then you can use the other USB port to get the logs.
You can find more details in the User Guide, in
3: Hardware Setup and Features > 3.1 Power Supply Sources
and
3: Hardware Setup and Features > 3.5 Control Connections
Thanks
Nicolas
Thanks again for the help, I managed to get a console on the aux port whilst powering from the mains supply on the other port. For a while I was able to log in but eventually the console does not respond (I can see the device in Windows but there is no data transfer, as if the UART is stalled). Eventually I changed my code and with a different approach it no longer locks up - so I wasn’t able to find the root cause.