watson-intu / self

Intu is a Cognitive Embodiment Middleware for AI on the edge.
Other
28 stars 27 forks source link

Camera fails to connect #18

Closed gradybooch closed 6 years ago

gradybooch commented 6 years ago

Running Intu on a Mac; I recall this working in a previous release, but for some reason my camera is no longer connecting (and there are three cameras on this mac). monitor

takaomoriyama commented 6 years ago

Grady,

I have no problem in using Intu on my Mac running macOS Sierra (v10.12.5). Can you show me the result of the command "grep -i camera SelfInstance.log" ? In my case,

$ cd <self-build-dir>/bin/mac
$ grep -i camera SelfInstance.log
[07/31/17 17:00:53.951][STAT][SensorManager] Added sensor Camera, Id: 0531a074-4620-edf8-9224-04fc56987442
[07/31/17 17:00:53.951][STAT][SensorManager] Added sensor DepthCamera, Id: b1020d32-7225-4d04-4f22-3dd123bceaae
[07/31/17 17:00:54.731][STAT][OpenCVCamera] Camera has started
[07/31/17 17:00:57.803][STAT][TopicManager] Added remote subscriber to topic sensor-Camera
[07/31/17 17:00:57.965][STAT][TopicManager] Added remote subscriber to topic sensor-%7B%7B%20cameraName%20%7D%7D
[07/31/17 17:00:57.965][WARN][TopicManager] Topic sensor-%7B%7B%20cameraName%20%7D%7D not found.

I've also noticed that the behavoir of Intu dashboard depends on what web browser you are using.

Web browser Video Spectrum graph Conversation log
Safari OK OK OK
Firefox NG NG OK
Google Chrome OK OK NG

If you want to switch you web browser in run time, the following patch might be helpful.

diff --git a/platform/mac/services/MacBrowser.cpp b/platform/mac/services/MacBrowser.cpp
index 0736504..32c6172 100644
--- a/platform/mac/services/MacBrowser.cpp
+++ b/platform/mac/services/MacBrowser.cpp
@@ -52,6 +52,11 @@ bool MacBrowser::Stop()
 void MacBrowser::ShowURL(const Url::SP & a_spUrlAgent, UrlCallback a_Callback)
 {
     Log::Debug("MacBrowser", "Opening the following URL: %s", a_spUrlAgent->GetURL().c_str());
-    std::string command = "open " + a_spUrlAgent->GetURL();
+   std::string command;
+   const char *pBROWSER = getenv( "INTU_WEB_BROWSER" );
+   if ( pBROWSER != NULL )
+       command = StringUtil::Format( "open -a \"%s\" %s", pBROWSER, a_spUrlAgent->GetURL().c_str() );
+   else
+       command = "open " + a_spUrlAgent->GetURL();
     system(command.c_str());
 }

Then you can start Intu with specified web browser as follows,

$ INTU_WEB_BROWSER="Safari" ./run_self.sh
$ INTU_WEB_BROWSER="Firefox" ./run_self.sh
$ INTU_WEB_BROWSER="Google Chrome" ./run_self.sh
gradybooch commented 6 years ago

woohoo! just brought in the latest commits, and my camera now displays!