Openag-ui web app build diary


#43

@adrianlu sometimes the Pi will jump on to a different WiFi network from you computer. That could do it.


#44

My pi’s IP address is an IP address of inner network, for example 192.168.133.160. Does it matter?


#45

That should be ok, no problem at all (at least, in my case) :slight_smile:


#46

Does it matter that the IP address of my Pi changes ? Since the first time I input my Pi name and IP address, the website don’t ask me the IP address anymore when I visit the Ui again. I worry that the web cannot find my new IP of Pi.
Another question: we visit http://openaginitiative.github.io/openag_ui/ to monitor our own food computer. what is the machanism behind? Could we run a webservice on our own Pi and visit the Pi directly locally?
My internet connection is not stable and often suspend.


#47

@flyshuttle yes, that is probably the issue. At the moment, the UI assumes a static IP, which isn’t ideal (the eventual goal is actually to bundle it with the PI). I’m working on a branch that allows you to clear the IP and set a new one.

Your best bet in the meantime would probably be to configure a static IP.


#48

I configured a static IP for my Pi already. Now I still couldn’t see any data through UI “http://openaginitiative.github.io/openag_ui/”. It seems that the sensors and actuators don’t work as before as food computer 1.0. and I guess the Arduino didn’t get the new code.

Should I load code of microcontroller to arduino by myself even though I installed the docker in my Pi? How could I do this and where could I find the microcontroller code for food computer 2.0?


#49

@flyshuttle hi! You’ll need to create a firmware fixture for the sensors and actuators you have in your bot. The fixture directory has some examples https://github.com/OpenAgInitiative/openag_brain/tree/master/fixtures.

We’re still working on a few things (like liquid level sensor) but the personal_food_computer_v2.json fixture should give you an idea of how a fixture for your bot would look https://github.com/OpenAgInitiative/openag_brain/tree/master/fixtures.

Here are some helpful wiki pages on this topic:

Basically, the Arduino system is made up of little C++ modules based on https://github.com/OpenAgInitiative/openag_firmware_module. These get cloned via Git and and flashed to the Arduino via a codegen module.


#50

Hm, I’m using the Pi 2 right now connected via ethernet. Check this out:

Should I be connecting via the same port that I am ssh’ing?


#51

Hi @gordonb

Do I also need to create a firmware module type for each actuator???


#52

Okay, I was able to add air temperature and air humidity.
Having a little of a struggle to add light intensity.


#53

Should I download personal_food_computer_v2.json using wget, and then modify the file and then run the command : rosrun openag_brain main -F ~/personal_food_computer_v2.json ?


#54

@adrianlu you could also try downloading the static files (dist.zip) https://github.com/OpenAgInitiative/openag_ui/releases/tag/0.0.1. I’ve occasionally run into cross-origin restrictions with some IP address setups. Running the files locally should fix that, if it is the case.

The other thing to try is to see if you can load 10.0.0.58:5984 in a browser.


#55

Thanks for the reply @gordonb . It turns out I was only running the light sensor module I’ve been testing instead of running the openag_brain via:

source ~/catkin_ws/devel/setup.bash rosrun openag_brain main

:pensive:

Heh. So, now I get a success message on the login screen saying I am connected to the Food Computer but I can’t seem to move to the next page (i.e., the “Save” button remains greyed out).

I tried this through the static files and get the same result. Here’s what loads at :5984

{"couchdb":"Welcome","uuid":"a2e7fb3434e422341150013207e54ba4","version":"1.6.0","vendor":{"version":"8.3","name":"Debian"}}

Thoughts?


#56

I think I fixed that once rebooting the OS.

Also, rosrun openag_brain main is (please correct me if I’m wrong) the same than rosrun openag_brain main -f default. This will load the default fixture, which defines a set of firmware modules (in the database called firmware_module_type) but does not load any firmware module. The ones currently load into the Arduino are in the firmware_module database.

Check for example the personal_food_computer_v2.json which you should have in /home/USER/catkin_ws/src/openag_brain/fixtures. This fixture has a populated firmware_module database, although it has not a firmware_module_type.
I cannot replicate it right now, but I think that you could make it work by first loading the default one and then loading one that defines some firmware_module too.

Or maybe load both at the same time.

Or maybe the best option is to create your own fixture that has both the firmware_module` and thefirmware_module_type`` database. I managed to to this for testing one sensor and viewing the output in the UI. My steps:

  1. Copied the default fixture
  2. Erased all the firmware_module_type, but kept the software_module and software_module_type
  3. Created a new firmware_module_type database only with my sensor
  4. Created a new firmware_module database with my sensor

More information here in the wiki.


#57

Hi Adrianlu, If you click, underneath the URL, on the green, ’ Success! connected to Food Computer ’ , the UI will be displayed. At least that is how It works for me. Don’t know the reasons for this just thought it was my setup, however if it works for you then I guess there is a bug in the display part of the UI.


#58

@JohnB, Thanks for the tip. That didn’t work for me unfortunately :confused:


#59

I saw that the UI code uses the 5984 port(CouchDB) for the heartbeat, but that doesn’t mean the openag_brain is running(5000 port exposed through IP:5984/_openag) so that part raises a 404 and you can’t go forward.

I had to run a couple init commands to get it running


#60

When you ran, rosrun openasg_brain main, did the login screen display without you doing anything else ?
Are you using a Docker brain or a locally installed brain ?

On my setup, (using a local install of openag_brain ), I get sync error messages and have to open a second terminal into which I type, platformio serialports monitor, I get a few other error messages about the port not listening but the sensors begin sending data.

Then I open a browser window and point it to the hosted UI, or as I have a local copy of the UI, I drag the index.html file into an open browser window to start the UI.

On my setup the screen you posted only appears the first time I start an openasg_brain. I have built several from scratch and each one behaves the same when first started.


#61

@spaghet good catch. We should have a smarter heartbeat endpoint that checks if everything is up.


#62

Hi Gordon,

Have just tried the openag_ui-0.0.1-demo.1, install from the zip file. The install ran OK,
The first time user setup, still gave a greyed out ’ Save ’ button after entering the name and url.
I tried selecting the words, ’ Success Connected to food computer ’ as I have done previously to get the UI running but this time, the UI didn’t start straight away. The ’ Save ’ button turned blue and the UI started when I selected it.

Output after clicking on Success Connected to food computer and before clicking on Save button:

status 304 not modified http://192.168.1.251:5984/environment/_local/bg_OHyj.7JGuOlSLA4ZLmA==?
status 304 not modified http://192.168.1.251:5984/environment/_local/0YQEeUjtsMJ0FV0Fb3qBGA==?

After selecting save the status messages from firefox developer are all 200 OK or 201 Created except for a sequence the same as the one below.

I have yet to connect the actuators to my arduino so can’t feedback on the latest direct control part of the Ui other than that the graphics display changes state when buttons are selected.

Would like to try the Phase_Recipe format but at the moment I am getting an error message from the UI when trying to start the simple recipe.
Firefox developer network display shows the recipe stop, then start, both with an error 400 Bad Request and then start with no status message just a blue spot.
When I refresh the message dissappears, and output from, developer, gives these messages;

status 304 not modified http://192.168.1.251:5984/environment/_local/bg_OHyj.7JGuOlSLA4ZLmA==?
status 304 not modified http://192.168.1.251:5984/environment/_local/0YQEeUjtsMJ0FV0Fb3qBGA==?
status 304 not modified http://192.168.1.251:5984/recipes/_local/WOWxi_9..1DodKAQ70wC.g==?
status 304 not modified http://192.168.1.251:5984/recipes/_local/Su3pFgefZqyabRtKjvJqFg==?

Output from the terminal from which I started the openag_brain main script shows the recipe running ?

127.0.0.1 - - [2016-12-16 14:31:06] “POST /api/0.0.1/service/environment_1/stop_recipe HTTP/1.1” 400 183 0.068082
127.0.0.1 - - [2016-12-16 14:31:07] “POST /api/0.0.1/service/environment_1/start_recipe HTTP/1.1” 400 204 0.081108

Not sure if this is specific to my setup or of more general relevance other than that Adrianlu and Aguadopd appear to have something similar happening with their setups ??

Any pointers as to how this part of the system works would be much appreciated.

john