Help needed with Loading the default fixture


#9

I did! I recorded my steps here: http://wiki.openag.media.mit.edu/openag_brain/installing/installing_with_docker

Do I need to configure/edit the fixture.yaml file? Where is that?


#10

Hey I was able to follow your steps and seem to be in a working state with the software one issue I encountered was after running this:

pi@raspberrypi:~/openag_brain_docker_rpi $ docker-compose up -d

The error message I saw was this:

ERROR: for brain  Cannot start service brain: linux runtime spec devices: error gathering device information while adding custom device "/dev/ttyACM0": lstat /dev/ttyACM0: no such file or directory

ERROR: Encountered errors while bringing up the project.

To Fix this I edited the line in the file docker-compose.yml

That had /dev/ttyACM0 and changed it to /dev/ttyUSB0 which is what was showing up when I plugged in the arduino.

After re-running pi@raspberrypi:~/openag_brain_docker_rpi $ docker-compose up -d There were no errors.

My Current Concern is connecting to the UI. I’ve tried connecting both when inside docker (After typing this docker exec -it openagbraindockerrpi_brain_1 bash) as well as when not in docker.

When I type in the name and Ip address it says its connected, but nothing happens. When I inspect elements and go to console in google chrome I see this output:

main.js:29337 Uncaught (in promise) TypeError: Cannot read property 'value' of undefined
at Object.readValue (main.js:29337)
at setOptions (main.js:29751)
at update (main.js:29727)
at main.js:28328
at update (main.js:33825)
at batch (main.js:29412)
at restoredEnvironmentsOk (main.js:33996)
at update (main.js:33828)
at main.js:28328
at Object.update (main.js:27526)

#11

which UI are you using? The http://openaginitiative.github.io/openag_ui/ is old and deprecated.

You have to build the UI on the RPi.

https://gist.github.com/Spaghet/6e22529721398d06593748bd74d50c2c


#12

Thanks! That worked perfectly.

Now I just have to get the sensors working which I believe @juhnke is having an issue with.

When I got to http://raspberrypi.local:5984/_utils/

This is what I see:

When comparing to another post from @wsnook depreciated software guide I saw he has this:

Basically mine is missing the firmware_modle_type and some other stuff. I definitely have the am2315 plugged in the arduino at the very least so that should be appearing if everything else is running correctly.

@juhnke I just want to see if this is a similar issue you are having. I will definately look into it and see if I can figure something out if you haven’t already. Thanks for contributing to the Wiki btw.


#13

Hi @Alex4EVR! Thanks for the Kudos! I’m glad to help and will be doing more once we get the firmware thing resolved.

Here’s my _utils view.

I bumped my firmware version once so that’s a little different. As you suspected, we both have no documents in firmware_module_type, software_module, and software_module_type. How do we get those in there?

I need to inventory my sensors too. Which sensor is the am2315?

Cheers!


#14

@spaghet That UI install is a great GIST! Can you add it to the wiki? I can link to the Gist if that is better. Thanks for sharing it!!!

Here’s what mine says.

Does the Dashboard supposed to have my camera view (my cam is not working)?


The ‘ WILDCARD ‘ Gro-Bot Organeec 1
#15

Oh SNAP! I started a recipe from here and my air temp works! It’s in celcius, but it’s working!


#16

@juhnke Thats actually really cool that you have that recipe. I put it in and got the same output as you. The 24 is hardcoded so it makes sense, and the other sensors still aren’t showing up.

The AM2315 is THIS sensor.

So it seems that we are in the same place. I’m also having issues with the camera and getting things to be connected and recognized. I will look a bit more into this and if I figure anything out, will let you know.


#17

@Alex4EVR yep! After waving a hairdryer at my air temp sensor for too long I came to the same conclusion. I found another post where @JohnB had success getting PFC1 sensors (some of them) up in November. I’ve been reviewing the fixture pages on the wiki trying to piece together a step-by-step plan to get one sensor and one actuator up.

The camera is a lost cause with docker for now. Docker by design isn’t exposed to the entire host OS/hardware including the camera port. There’s a post that someone is working on it, but I think the only way to get the camera to work is to run native on the Pi instead of a docker container. For fun you can install FSWebCam on the Pi and take pictures. Mine works great.

I look forward to hearing what you find!


#18

@Alex4EVR I made a little bit more progress this evening.

Log into the openag_brain docker image and run this command:

openag db load_fixture ~/catkin_ws/src/openag_brain/fixtures/default.json

Now look at my db!

The default fixtures file comes with the following sensors from the PFC1 rig.

  • dht22 - air temp / humidity
  • gc0011 - co2
  • ds18b20 - water temp

Then I added a firmware_module by copying the following into the firmware_module collection.

     {
        "id": "dht221",
        "type": "dht22",
        "environment": "environment_1",
        "arguments": [
            0
        ],
        "outputs": {
            "air_temperature": {
                "variable": "air_temperature"
            }
        },
        "air_humidity": {
            "variable": "air_humidity"
        }
    }

My DHT22 sensor is on analog pins 0 and 1 <-- goes into arguments

I then reran the flash command.

rosrun openag_brain flash

After the obligatory remove and replug of the USB cord. It appears to have cloned the DHT22 repo during that flash.

I am not, however seeing data appear. I’m missing one step. Maybe more, but I’m close!

I’ll try again this weekend. Man, I CAN TASTE IT!

Night!


#19

I took a look at the log files and I’m getting this error message. The sensor is plugged into Analog 0 on the Grove board. I think I’m going to try a digital port.

[ERROR] [WallTime: 1492226166.956629] bad callback: <bound method DiagnosticsExpander.callback of <__main__.DiagnosticsExpander instance at 0x7633a6e8>>
Traceback (most recent call last):
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 720, in _invoke_callback
    cb(msg)
  File "/home/pi/catkin_ws/src/openag_brain/src/openag_brain/software_modules/expand_diagnostics.py", line 50, in callback
    status.message = self.status_codes_by_module[_status.name].get(
KeyError: '_5db9279fe44463a5c77d402fbc0037e3'

#20

@Alex4EVR I couldn’t sleep with this not working. So…

I GOT IT TO WORK!!!

My problem was my DHT22 was connected to an analog port 0 and the firmware module couldn’t take “A0” as a pin. So I moved it to D2 and changed the DB to this:

{
   "_id": "dht22_1",
   "type": "dht22",
   "environment": "environment_1",
   "arguments": [
       2
   ],
   "outputs": {
       "air_temperature": {
           "variable": "air_temperature"
       }
   },
   "air_humidity": {
       "variable": "air_humidity"
   }
}

and a flash and docker-compose restart later I get this!!!

pi@fe84a8283527:~$ rostopic echo /sensors/_5db9279fe44463a5c77d402fbc0037e3/air_humidity/raw
data: 53.5
---
data: 53.5
---
data: 53.4000015259
---
data: 53.4000015259
---
data: 53.4000015259
---
data: 53.4000015259
---
data: 53.4000015259
---
data: 53.4000015259
---
data: 53.4000015259
---
data: 53.5
---
pi@fe84a8283527:~$ rostopic echo /sensors/_5db9279fe44463a5c77d402fbc0037e3/air_temperature/raw
data: 23.6000003815
---
data: 23.6000003815
---
data: 23.6000003815
---
data: 23.6000003815
---
data: 23.6000003815

The data is not showing up in the UI yet, but I’ll figure that out later. I suspect it has to do with the _id value being a unique hash and not the required string.


#21

I’d guess that the sensors aren’t being linked to the environments/environment_1/air_temperature/measured topic for whatever reason and that is what’s causing the UI to not display the temperature.

Or, if your api node is dead (test this by going to IP:5984/_openag/api/0.0.1/topic) that should also not work.
There are other things that come to mind but it’s awesome that you’re getting everything working!


#22

Hi @juhnke! so glad you made some progress with your computer. I just came to pick up where we left off and I’m still having trouble.

I’ve been using the wiki you wrote and its very helpful.

I also followed this instruction:

openag db load_fixture ~/catkin_ws/src/openag_brain/fixtures/default.json

and got a similar output as you did, except the firmware_module had only 1 document instead of 2. I assumed that is where you added your firmware module:

     {
    "id": "dht221",
    "type": "dht22",
    "environment": "environment_1",
    "arguments": [
        2
    ],
    "outputs": {
        "air_temperature": {
            "variable": "air_temperature"
        }
    },
    "air_humidity": {
        "variable": "air_humidity"
    }
}

I wanted to do the exact same thing just to see if I could get what you got for this. So below are some photos detailing what I have done:

I took off the signal board arduino shield to ensure that wasn’t causing any issues. I just plugged in a DHT22 into the 5V, Gnd, and PWM2 pin

I’m just putting these to make sure that I’m doing the same thing you did.

After that I followed all of the rest of the steps. I didn’t see the error that you got when using the analog pin, even though I did give it a try. Also the “KeyError” you got is interesting because that is the key that you use for your “_id” I’m assuming.

Ok so after i flashed and restarted and everything I went to the rostopic list, but didn’t see the new sensor which you can see in the photo attached

So this is pretty much where I’m stuck, I couldn’t rostopic echo the dht22 because I couldn’t find it and when I tried stuff it said that the topic hasn’t been published.

Would you have any idea where to go from here? I really want to get my PFC up and running :slight_smile:


#23

Hi @Alex4EVR,

It’s a little tough to give advice since it’s a complex setup and the software is still changing day to day, but I can at least tell you what I did to get everything running – this worked as of about 2 weeks ago.

  • On the Pi, clone openag_brain_install_rpi. I felt like the Docker piece just added another layer of complexity which I’d rather skip at this point.
  • In that repo, run ./install.sh
  • Setup ros env with source catkin_ws/devel/setup.sh
  • Flash the Arduino with openag firmware flash -p ros -t upload -f ~/catkin_ws/src/openag_brain/launch/personal_food_computer_v2.yaml
  • Run the brain with rosrun openag_brain main personal_food_computer_v2.launch
  • In another terminal, confirm that everything’s loaded with rostopic list, and check that the sensors are returning data with something like rostopic echo /sensors/am2315_1/air_temperature/raw

In your case, feels like you should focus first on just getting the sensor code for your DHT22 running and publishing data to a topic. I’d look at a few things:

  • Confirm that the launch file you’re editing is actually getting used. Comment out one of the sensors, re-flash, re-run, and make sure that sensor goes away.
  • Add your sensor to the launch file, and confirm that it’s actually getting picked up. When you Flash the arduino, do you see it actually cloning the DHT22 repo? Do you see the repo in ./lib?

Once you actually see a topic showing up, then you can worry about having valid data (are you using the right pin, do you have a pullup resistor) and passing it through to Couch and the UI – but I’d focus first on just getting the Arudino talking to the sensor and passing data back to ROS.


#24

it looks like he’s using the personal_food_computer_v2.yaml/.launch file since there are other sensors like am2315 running on ROS.

If you want to run other sensors(e.g. DHT11),
you need to write a launchfile and param file(yaml) for your hardware config if you aren’t using the same things.

openag firmware flash -p ros -t upload -f ~/catkin_ws/src/openag_brain/${your param file}.yaml instead of personal_food_computer_v2

also, rosrun openag_brain main ${your lauchfile}.launch


#25

Thank you so much @dlerman!!!

I got the AM2315 to output the air temperature and I breathed on it so it would change and it did so its totally working!!!

The DHT22 was because @juhnke got that to work so I was trying to copy him and also take the Arduino shield out of the equation, but now that’s working I’m going to try and get more functionality out of the machine and grow some freaking plants! :seedling::seedling::seedling::seedling:


#26

Glad to hear it! Now onto the actuators! :slight_smile:


#27

That is correct. I had already added it.

One of two things: 1) You hadn’t restarted the container after you flashed the arduino or 2) there is a bug in the arduino code and it’s preventing the publishing of topics. The best way to fix this is to remove all firmware_modules except that funky starter entry and the dht22. I see that you got it working a little later on so I’ll move on.

I have a working directory of all of the sensors / fixtures I’ve gotten working on or am working on here.

I have included rostopic actuator commands as well as the configuration files needed. The documentation is poor as I’m working on getting the gc0011 code to work right now but I have almost all actuators running now.

I’ve also included my launch and yaml files. I typically copy them into the launch folder and then rename them to the default_v2 names so the container boots to them.

@dlerman Great tips. I’ll incorporate them into the wiki!

Love this!!

Cheers,

J


#28

Hi, please help!, I was following your steps up to the flash. When running rosrun openag_brain flash, it asks me for the username:

Parsing firmware module "dht22_1" from server
Downloading "openag_firmware_module"
Cloning into '/tmp/tmpA4sdCa/lib/openag_firmware_module'...
Username for 'https://github.com':