Need help setting up the development environment?


#1

Hey @spaghet, @wsnook

I’m setting up the dev environment on my Pi and I just completed the global install. I pulled down the docker containers and used that for couch (I’m lazy that way). Now I can’t find the setup.bash file to source the catkin workspace.
This http://wiki.openag.media.mit.edu/openag_brain/running_openag_brain is not correct as there is no ~/catkin_ws/devel folder instead there is a ~/catkin_ws/devel-isolated folder and no bash file inside.

Can you point me in the right direction?

Thanks!

J


#2

there’s no ~/catkin_ws/devel_isolated/setup.bash?


#3

@juhnke Sorry, I haven’t got a clue. I’m not actually running any of the ROS stuff any more–I’m just loosely following the progress from afar. When I was studying the PFC2 designs earlier this year, I paid most my attention to things connected with the Arduino firmware. I gave up on trying to do anything with ROS because it seemed like I’d have a much easier time just writing my own software from scratch.

As an aside, what’s the current state of your project? Maybe you posted something about that recently, but it’s hard to keep track of all that’s going on. I’m thinking maybe you said you built a PFC1, and now you’re trying to get software running?


#4

So much said in so few words. Haha.

After I read this I decided to wipe my card and start over. I ran the setup in the background and it appears to have not completed. So last night I ran it without disconnecting and guess what?

The file is there! I’m set up and using the couchdb that comes with that install vs the container.

There are a few instructions I would add to the setup.

  1. Initialize workspace - source ~/catkin_ws/devel_isolated/setup.bash

  2. Initialize the DB with - openag db init

  3. Import fixtures with - openag db load_fixture <YOUR DEFAULT.JSON>

Thanks for the poke!

J


V2 Food Computer Kit Build
#5

Hiya @wsnook, I am a part-time Imagineering teacher at a middle school and we’ve built two PFC1 units. Instead of wrestling with the deprecated “Gro” software, we decided to dig into the Openag_Brain. So in my free hours (I also have a full time job) I’m hacking together a PFC1 configuration. I’ve got the files in a repo here including a new config file for the UI that allows actuation of the PFC1 hardware.

So far we’ve needed to make two hardware changes that are pretty simple. The first is pulling the DHT22 from the A0 port on Grove Shield and dropping it into D2. The second is what you and I are talking about on another thread. It’s changing the GC0011 S5 connector from pins 12,11 to instead use the Mega Serial1 that is coded into the GC0012 firmware.

I think the brain redesign was smart (although complex) as pub/sub design is much more flexible given the wide range of Food Computers that will exist in the future. If you want to try to use it again, I have my hardware up and sensing (2 sensors so far) / actuating (all actuators work) and would be happy to share notes.

Cheers,

J


#6

I think there isn’t any use for fixtures anymore. We now ROS param files under openag_brain/launch/personal_food_computer_v[12].yaml

The install failing midway is probably because you haven’t expanded your swapspace, and it passes the second time because make is an incremental build. It caught me off guard as well…

Which documents are you looking through currently? Is it the ones on the wiki under http://wiki.openag.media.mit.edu/openag_brain/installing/installing_globally?


#7

Interesting @spaghet! So I’ve created a pfc1_default.json file that I use to populate CouchDB. I have not converted it to yaml yet. Are you saying we no longer need to load the db? My plan with setting up the dev environment was to dig into the var yaml file that is not available on the docker image to set up the pub/sub relationships between sensors and actuators and PID.

Right now my method has been:

  1. Build and startup openag_brain on PI/SD card (using docker until now)

  2. Populate CouchDB

  3. Flash Arduino from CouchDB

  4. Restart container using modified Launch yaml files (docker container calls V2 but I just modified that to be some V1 stuff)

  5. Test using Openag_UI/CLI

My launch yamls don’t perfectly match the DB. Is that important?
Why do I need to fill the DB AND use the YAML files?
Can the yaml files be used to populate the DB?

Yes, I am using those instructions. The next-steps link at the bottom takes you to starting the openag_brain without configuring the DB. The DB won’t isn’t accessible until you type the db init command.

Thanks!

J


#8

I’ve been working on a totally new software stack of my own, https://github.com/wsnook/farm, and I’ll probably continue putting most of my attention in that direction. But, I am curious about ways to steer what I’m doing toward easy adaptation to PFC1 or PFC2 hardware. It’s good to know what hardware people have.


#9

Oh cool! I will definitely check it out! Let me know if you want to test it on PFC1 hardware.


#10

@spaghet I’m on to the next issue I need help with.

I’ve copied my yaml files into the openag_brain launch folder and I run rosrun openag_brain main personal_food_computer_v1.launch and I get the following errors. The personal_food_computer_v2.launch file works, however.

Initializing the database
Applying CouchDB configuration  [####################################]  100%
Creating databases  [####################################]  100%
Pushing design documents
Spawning software modules
[personal_food_computer_v1.launch] is neither a launch file in package [openag_brain] nor is [openag_brain] a launch file name
The traceback for the exception was written to the log file
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/opt/ros/indigo/lib/openag_brain/main", line 22, in kill_children
    modules.terminate()
  File "/usr/lib/python2.7/subprocess.py", line 1559, in terminate
    self.send_signal(signal.SIGTERM)
  File "/usr/lib/python2.7/subprocess.py", line 1554, in send_signal
    os.kill(self.pid, sig)
OSError: [Errno 3] No such process
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/opt/ros/indigo/lib/openag_brain/main", line 22, in kill_children
    modules.terminate()
  File "/usr/lib/python2.7/subprocess.py", line 1559, in terminate
    self.send_signal(signal.SIGTERM)
  File "/usr/lib/python2.7/subprocess.py", line 1554, in send_signal
    os.kill(self.pid, sig)
OSError: [Errno 3] No such process```

 Any clue what this means? I'm pretty sure my files are formatted identically to the V2 files with the exception that I removed some things that aren't in the PFC1 hardware. 

Thanks,

J

#11

Possibly referencing the openag_brain/launch in /opt/ros/indigo/share.

If you make changes, I guess try running sudo ~/catkin_ws/src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo -j2

I’m personally still getting used to the new build stuff so @gordonb might have a better way to do it.


V2 Food Computer Kit Build
#12

WoohoO! That did it. It’s running now. I need to plug the RPI into my PFC1 (it was a different unit) and see what we get.

I’ll report back. Thank you!!

J


#13

Ok, so I’ve got it running like a champ minus one thing. I can’t seem to get the firmware to compile and upload. It says it’s uploading but I am still getting the following error message:

pi@openagdev:~ $ rosrun openag_brain main --screen personal_food_computer_v1.launch
Initializing the database
Applying CouchDB configuration  [####################################]  100%
Creating databases  [####################################]  100%
Pushing design documents
Spawning software modules
... logging to /home/pi/.ros/log/b5d19f34-36bc-11e7-9e9d-b827eb13f57f/roslaunch-openagdev-5223.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://openagdev:36555/

SUMMARY
========

PARAMETERS
 * /arduino_handler/serial_port: /dev/ttyACM0
 * /categories: ['sensors', 'actu...
 * /environments/environment_1/aerial_image/autofocus: False
 * /environments/environment_1/aerial_image/brightness: 32
 * /environments/environment_1/aerial_image/camera_frame_id: head_camera
 * /environments/environment_1/aerial_image/camera_info_url: 
 * /environments/environment_1/aerial_image/camera_name": head_camera
 * /environments/environment_1/aerial_image/contrast: 32
 * /environments/environment_1/aerial_image/focus: 51
 * /environments/environment_1/aerial_image/framerate: 1
 * /environments/environment_1/aerial_image/image_height: 480
 * /environments/environment_1/aerial_image/image_width: 640
 * /environments/environment_1/aerial_image/io_method: mmap
 * /environments/environment_1/aerial_image/pixel_format: yuyv
 * /environments/environment_1/aerial_image/saturation: 32
 * /environments/environment_1/aerial_image/sharpness: 22
 * /environments/environment_1/aerial_image/video_device: /dev/video0
 * /environments/environment_1/air_flush_on_controller_1/variable: air_flush_on
 * /environments/environment_1/air_temperature_controller_1/Kd: 0.0
 * /environments/environment_1/air_temperature_controller_1/Ki: 0.0
 * /environments/environment_1/air_temperature_controller_1/Kp: 1.0
 * /environments/environment_1/air_temperature_controller_1/deadband_width: 0.5
 * /environments/environment_1/air_temperature_controller_1/lower_limit: -1.0
 * /environments/environment_1/air_temperature_controller_1/upper_limit: 1.0
 * /environments/environment_1/air_temperature_controller_1/variable: air_temperature
 * /environments/environment_1/air_temperature_controller_1/windup_limit: 1000.0
 * /environments/environment_1/image_persistence_1/min_update_interval: 3600
 * /environments/environment_1/light_controller/variable: light_intensity
 * /environments/environment_1/sensor_persistence_1/max_update_interval: 600
 * /environments/environment_1/sensor_persistence_1/min_update_interval: 5
 * /environments/environment_1/video_writer_1/timelapse_scaling_factor: 86400
 * /firmware_module: [{'environment': ...
 * /firmware_module_type: [{'description': ...
 * /rosdistro: indigo
 * /rosversion: 1.11.21
 * /var_types/camera_variables/aerial_image/description: Image from above ...
 * /var_types/camera_variables/aerial_image/name: aerial_image
 * /var_types/camera_variables/aerial_image/units: png
 * /var_types/camera_variables/frontal_image/description: Image from in fro...
 * /var_types/camera_variables/frontal_image/name: frontal_image
 * /var_types/camera_variables/frontal_image/units: png
 * /var_types/environment_variables/air_carbon_dioxide/description: The amount of Car...
 * /var_types/environment_variables/air_carbon_dioxide/name: air_carbon_dioxide
 * /var_types/environment_variables/air_carbon_dioxide/type: std_msgs/Float64
 * /var_types/environment_variables/air_carbon_dioxide/units: ppm
 * /var_types/environment_variables/air_flush_on/description: Turn on air flush...
 * /var_types/environment_variables/air_flush_on/name: air_flush_on
 * /var_types/environment_variables/air_flush_on/type: std_msgs/Boolean
 * /var_types/environment_variables/air_humidity/description: A measure of the ...
 * /var_types/environment_variables/air_humidity/name: air_humidity
 * /var_types/environment_variables/air_humidity/type: std_msgs/Float64
 * /var_types/environment_variables/air_humidity/units: percent relative
 * /var_types/environment_variables/air_temperature/description: Temperature of th...
 * /var_types/environment_variables/air_temperature/name: air_temperature
 * /var_types/environment_variables/air_temperature/type: std_msgs/Float64
 * /var_types/environment_variables/air_temperature/units: degrees C
 * /var_types/environment_variables/light_illuminance/description: The intensity of ...
 * /var_types/environment_variables/light_illuminance/name: light_illuminance
 * /var_types/environment_variables/light_illuminance/type: std_msgs/Float64
 * /var_types/environment_variables/light_illuminance/units: lux
 * /var_types/environment_variables/light_intensity/description: The intensity set...
 * /var_types/environment_variables/light_intensity/name: light_intensity
 * /var_types/environment_variables/light_intensity/type: std_msgs/Float64
 * /var_types/environment_variables/light_intensity/units: percent relative
 * /var_types/environment_variables/water_dissolved_oxygen/description: A measure of the ...
 * /var_types/environment_variables/water_dissolved_oxygen/name: water_dissolved_o...
 * /var_types/environment_variables/water_dissolved_oxygen/type: std_msgs/Float64
 * /var_types/environment_variables/water_dissolved_oxygen/units: mg/L
 * /var_types/environment_variables/water_electrical_conductivity/description: Electrical conduc...
 * /var_types/environment_variables/water_electrical_conductivity/name: water_electrical_...
 * /var_types/environment_variables/water_electrical_conductivity/type: std_msgs/Float64
 * /var_types/environment_variables/water_electrical_conductivity/units: uS/cm
 * /var_types/environment_variables/water_oxidation_reduction_potential/description: Oxidation-reducti...
 * /var_types/environment_variables/water_oxidation_reduction_potential/name: water_oxidation_r...
 * /var_types/environment_variables/water_oxidation_reduction_potential/type: std_msgs/Float64
 * /var_types/environment_variables/water_oxidation_reduction_potential/units: mV
 * /var_types/environment_variables/water_potential_hydrogen/description: Potential Hydroge...
 * /var_types/environment_variables/water_potential_hydrogen/name: water_potential_h...
 * /var_types/environment_variables/water_potential_hydrogen/type: std_msgs/Float64
 * /var_types/environment_variables/water_potential_hydrogen/units: pH
 * /var_types/environment_variables/water_temperature/description: Temperature of th...
 * /var_types/environment_variables/water_temperature/name: water_temperature
 * /var_types/environment_variables/water_temperature/type: std_msgs/Float64
 * /var_types/environment_variables/water_temperature/units: degrees C
 * /var_types/recipe_variables/recipe_end/description: Represents the en...
 * /var_types/recipe_variables/recipe_end/name: recipe_end
 * /var_types/recipe_variables/recipe_start/description: Represents the st...
 * /var_types/recipe_variables/recipe_start/name: recipe_start
 * /var_types/user_variables/marker/description: Marks some user-d...
 * /var_types/user_variables/marker/name: marker

NODES
  /
    api (openag_brain/api.py)
    arduino_handler (openag_brain/handle_arduino.py)
    expand_diagnostics (openag_brain/expand_diagnostics.py)
    sensor_info_publisher (openag_brain/sensor_info_publisher.py)
    topic_connector (openag_brain/topic_connector.py)
  /environments/environment_1/
    aerial_image (usb_cam/usb_cam_node)
    air_flush_on_controller_1 (openag_brain/direct_controller.py)
    air_temperature_controller_1 (openag_brain/pid.py)
    image_persistence_1 (openag_brain/image_persistence.py)
    light_controller (openag_brain/direct_controller.py)
    recipe_handler_1 (openag_brain/recipe_handler.py)
    sensor_persistence_1 (openag_brain/sensor_persistence.py)
    topic_filter_1 (openag_brain/topic_filter.py)
    video_writer_1 (openag_brain/video_writer.py)

auto-starting new master
process[master]: started with pid [5234]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to b5d19f34-36bc-11e7-9e9d-b827eb13f57f
process[rosout-1]: started with pid [5247]
started core service [/rosout]
process[environments/environment_1/topic_filter_1-2]: started with pid [5264]
process[environments/environment_1/air_temperature_controller_1-3]: started with pid [5265]
process[environments/environment_1/recipe_handler_1-4]: started with pid [5266]
process[environments/environment_1/video_writer_1-5]: started with pid [5267]
process[environments/environment_1/image_persistence_1-6]: started with pid [5268]
process[environments/environment_1/light_controller-7]: started with pid [5269]
process[environments/environment_1/air_flush_on_controller_1-8]: started with pid [5270]
process[environments/environment_1/sensor_persistence_1-9]: started with pid [5271]
process[environments/environment_1/aerial_image-10]: started with pid [5274]
process[expand_diagnostics-11]: started with pid [5277]
process[arduino_handler-12]: started with pid [5278]
process[api-13]: started with pid [5282]
process[topic_connector-14]: started with pid [5292]
process[sensor_info_publisher-15]: started with pid [5297]
[INFO] [WallTime: 1494556982.017760] Filtering topic water_oxidation_reduction_potential/raw to topic water_oxidation_reduction_potential/measured
[INFO] [WallTime: 1494556982.092894] Forwarding topic air_flush_on/raw to topic air_flush_on/measured
[INFO] [WallTime: 1494556982.166423] Filtering topic water_electrical_conductivity/raw to topic water_electrical_conductivity/measured
[INFO] [WallTime: 1494556982.239175] Filtering topic water_potential_hydrogen/raw to topic water_potential_hydrogen/measured
[INFO] [WallTime: 1494556982.300065] Filtering topic light_illuminance/raw to topic light_illuminance/measured
[INFO] [WallTime: 1494556982.355893] Filtering topic water_dissolved_oxygen/raw to topic water_dissolved_oxygen/measured
[INFO] [WallTime: 1494556982.422419] Filtering topic light_intensity/raw to topic light_intensity/measured
[INFO] [WallTime: 1494556982.474593] Filtering topic air_temperature/raw to topic air_temperature/measured
[INFO] [WallTime: 1494556982.543816] Filtering topic air_humidity/raw to topic air_humidity/measured
[INFO] [WallTime: 1494556982.632112] Filtering topic air_carbon_dioxide/raw to topic air_carbon_dioxide/measured
[INFO] [WallTime: 1494556982.739343] Filtering topic water_temperature/raw to topic water_temperature/measured
[ INFO] [1494556983.303000381]: using default calibration URL
[ INFO] [1494556983.303727559]: camera calibration URL: file:///home/pi/.ros/camera_info/head_camera.yaml
[ INFO] [1494556983.304288125]: Unable to open camera calibration file [/home/pi/.ros/camera_info/head_camera.yaml]
[ WARN] [1494556983.304552809]: Camera calibration file /home/pi/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1494556983.304783223]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 1 FPS
[INFO] [WallTime: 1494556983.871609] Starting to read from Arduino
[INFO] [WallTime: 1494556984.284626] Connecting topic /environments/environment_1/air_humidity/commanded to topic /actuators/humidifier_1/cmd
[INFO] [WallTime: 1494556984.322202] Connecting topic /environments/environment_1/air_temperature/commanded to topic /actuators/heater_core_1_1/cmd
[INFO] [WallTime: 1494556984.378867] Connecting topic /environments/environment_1/cmd/commanded to topic /actuators/water_circulation_pump_1/cmd
[INFO] [WallTime: 1494556984.448596] Connecting topic /sensors/gc0012_1/air_carbon_dioxide/raw to topic /environments/environment_1/air_carbon_dioxide/raw
[INFO] [WallTime: 1494556984.527222] Connecting topic /sensors/gc0012_1/air_carbon_dioxide/info to topic /environments/environment_1/air_carbon_dioxide/info
[INFO] [WallTime: 1494556984.606042] Connecting topic /sensors/dht22_1/air_humidity/raw to topic /environments/environment_1/air_humidity/raw
[INFO] [WallTime: 1494556984.674845] Connecting topic /sensors/dht22_1/air_humidity/info to topic /environments/environment_1/air_humidity/info
[INFO] [WallTime: 1494556984.718073] Connecting topic /sensors/dht22_1/air_temperature/raw to topic /environments/environment_1/air_temperature/raw
[INFO] [WallTime: 1494556984.775775] Connecting topic /sensors/dht22_1/air_temperature/info to topic /environments/environment_1/air_temperature/info
[ WARN] [1494556984.805581025]: unknown control 'focus_auto'

[INFO] [WallTime: 1494556984.819838] API now listening on http://0.0.0.0:5000
[ WARN] [1494556984.831999706]: unknown control 'focus_absolute'

[INFO] [WallTime: 1494556984.851168] Connecting topic /environments/environment_1/air_flush_on/commanded to topic /actuators/air_flush_1/cmd
[INFO] [WallTime: 1494556984.858821] Posting image
[INFO] [WallTime: 1494556984.912158] Connecting topic /environments/environment_1/cmd/commanded to topic /actuators/chamber_fan_1/cmd
[INFO] [WallTime: 1494556984.930822] Connecting topic /environments/environment_1/light_intensity/commanded to topic /actuators/grow_lights_1/cmd
[INFO] [WallTime: 1494556985.575167] ROS Serial Python Node
[INFO] [WallTime: 1494556985.595229] Connecting to /dev/ttyACM0 at 57600 baud
[ERROR] [WallTime: 1494557002.707561] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
[ERROR] [WallTime: 1494557017.710385] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
[ERROR] [WallTime: 1494557032.712859] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
[ERROR] [WallTime: 1494557047.716181] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
[ERROR] [WallTime: 1494557062.719705] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

^^^ Note the groovy error is here. I know I can fix that on the docker container by running rosrun openag_brain flash. That command doesn’t work in this environment.

I think I got flashing correctly. I run it from my home directory. Here’s that log:

pi@openagdev:~ $ openag firmware run -f ~/catkin_ws/src/openag_brain/launch/personal_food_computer_v1.yaml -t upload
Downloading "openag_firmware_module"
Cloning into '/home/pi/lib/openag_firmware_module'...
remote: Counting objects: 43, done.
remote: Total 43 (delta 0), reused 0 (delta 0), pack-reused 43
Unpacking objects: 100% (43/43), done.
Checking connectivity... done.
Downloading "openag_dht22"
Cloning into '/home/pi/lib/openag_dht22'...
remote: Counting objects: 38, done.
remote: Total 38 (delta 0), reused 0 (delta 0), pack-reused 38
Unpacking objects: 100% (38/38), done.
Checking connectivity... done.
Downloading "openag_gc0012"
Cloning into '/home/pi/lib/openag_gc0012'...
remote: Counting objects: 86, done.
remote: Total 86 (delta 0), reused 0 (delta 0), pack-reused 86
Unpacking objects: 100% (86/86), done.
Checking connectivity... done.
Downloading "rosserial_arduino_libs"
Cloning into '/home/pi/lib/rosserial_arduino_libs'...
remote: Counting objects: 313, done.
remote: Total 313 (delta 0), reused 0 (delta 0), pack-reused 313
Receiving objects: 100% (313/313), 134.99 KiB | 0 bytes/s, done.
Resolving deltas: 100% (198/198), done.
Checking connectivity... done.
Downloading "openag_air_flush"
Cloning into '/home/pi/lib/openag_air_flush'...
remote: Counting objects: 83, done.
remote: Total 83 (delta 0), reused 0 (delta 0), pack-reused 83
Unpacking objects: 100% (83/83), done.
Checking connectivity... done.
Downloading "openag_binary_actuator"
Cloning into '/home/pi/lib/openag_binary_actuator'...
remote: Counting objects: 70, done.
remote: Total 70 (delta 0), reused 0 (delta 0), pack-reused 70
Unpacking objects: 100% (70/70), done.
Checking connectivity... done.
[Thu May 11 21:25:55 2017] Processing megaatmega2560 (platform: atmelavr, board: megaatmega2560, framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PackageManager: Installing framework-arduinoavr @ ~1.10618.1
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
PackageManager: Installing tool-avrdude @ ~1.60300.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%
CorePackageManager: Installing tool-scons @ ~3.20501.2
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%
tool-scons @ 3.20501.2 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
Converting src.ino
Collected 33 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <openag_dht22>
|   |-- <openag_module>
|   |-- <rosserial_arduino>
|-- <openag_gc0012>
|   |-- <rosserial_arduino>
|   |-- <openag_module>
|-- <openag_binary_actuator>
|   |-- <rosserial_arduino>
|   |-- <openag_module>
|-- <openag_air_flush>
|   |-- <rosserial_arduino>
|   |-- <openag_module>
Compiling .pioenvs/megaatmega2560/src/src.ino.o
Archiving .pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
Indexing .pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
Compiling .pioenvs/megaatmega2560/FrameworkArduino/CDC.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial0.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial1.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial2.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial3.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/IPAddress.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/PluggableUSB.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/Print.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/Stream.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/Tone.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/USBCore.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WInterrupts.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WMath.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WString.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/_wiring_pulse.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/abi.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/hooks.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/main.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/new.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_analog.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_digital.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_pulse.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_shift.o
Archiving .pioenvs/megaatmega2560/lib/libopenag_firmware_module.a
Compiling .pioenvs/megaatmega2560/lib/rosserial_arduino_libs/duration.o
Indexing .pioenvs/megaatmega2560/lib/libopenag_firmware_module.a
Compiling .pioenvs/megaatmega2560/lib/rosserial_arduino_libs/time.o
Archiving .pioenvs/megaatmega2560/libFrameworkArduino.a
Compiling .pioenvs/megaatmega2560/lib/openag_dht22/openag_dht22.o
Indexing .pioenvs/megaatmega2560/libFrameworkArduino.a
Compiling .pioenvs/megaatmega2560/lib/openag_gc0012/openag_gc0012.o
Archiving .pioenvs/megaatmega2560/lib/librosserial_arduino_libs.a
Compiling .pioenvs/megaatmega2560/lib/openag_binary_actuator/openag_binary_actuator.o
Indexing .pioenvs/megaatmega2560/lib/librosserial_arduino_libs.a
Compiling .pioenvs/megaatmega2560/lib/openag_air_flush/openag_air_flush.o
Archiving .pioenvs/megaatmega2560/lib/libopenag_dht22.a
Archiving .pioenvs/megaatmega2560/lib/libopenag_gc0012.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_dht22.a
lib/openag_binary_actuator/openag_binary_actuator.cpp: In member function 'virtual void BinaryActuator::update()':
lib/openag_binary_actuator/openag_binary_actuator.cpp:25:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((curr_time - _last_cmd) > _shutoff_ms) {
^
Indexing .pioenvs/megaatmega2560/lib/libopenag_gc0012.a
Archiving .pioenvs/megaatmega2560/lib/libopenag_binary_actuator.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_binary_actuator.a
Archiving .pioenvs/megaatmega2560/lib/libopenag_air_flush.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_air_flush.a
Linking .pioenvs/megaatmega2560/firmware.elf
Checking program size
text	   data	    bss	    dec	    hex	filename
8464	    182	    687	   9333	   2475	.pioenvs/megaatmega2560/firmware.elf
Building .pioenvs/megaatmega2560/firmware.hex
Looking for upload port...

Warning! Please install `99-platformio-udev.rules` and check that your board's PID and VID are listed in the rules.
https://raw.githubusercontent.com/platformio/platformio/develop/scripts/99-platformio-udev.rules
Auto-detected: /dev/ttyACM0
Uploading .pioenvs/megaatmega2560/firmware.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file ".pioenvs/megaatmega2560/firmware.hex"
avrdude: writing flash (8646 bytes):

Writing | ################################################## | 100% 1.52s

avrdude: 8646 bytes of flash written
avrdude: verifying flash memory against .pioenvs/megaatmega2560/firmware.hex:
avrdude: load data flash data from input file .pioenvs/megaatmega2560/firmware.hex:
avrdude: input file .pioenvs/megaatmega2560/firmware.hex contains 8646 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.11s

avrdude: verifying ...
avrdude: 8646 bytes of flash verified

avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF)

avrdude done.  Thank you.

========================================================================== [SUCCESS] Took 60.19 seconds ==========================================================================

So that seems successful. What am I missing?

Thanks!

J


#14

Maybe try rosrun openag_brain firmware -t upload -p ros launch/personal_food_computer_v1.yaml?

I don’t know if this will make a difference but it would be worth a shot


#15

Thanks @spaghet. No joy.

pi@openagdev:~/catkin_ws $ rosrun openag_brain firmware -t upload /home/pi/catkin_ws/src/openag_brain/launch/personal_food_computer_v1.yaml -p ros
[Fri May 12 18:53:23 2017] Processing megaatmega2560 (platform: atmelavr, board: megaatmega2560, framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Converting src.ino
Collected 49 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <openag_gc0012>
|   |-- <rosserial_arduino>
|   |-- <openag_atlas_ec>
|   |   |-- <rosserial_arduino>
|-- <openag_air_flush>
|   |-- <rosserial_arduino>
|   |-- <openag_atlas_ec>
|   |   |-- <rosserial_arduino>
|-- <openag_dht22>
|   |-- <openag_module>
|   |-- <rosserial_arduino>
|   |-- <openag_atlas_ec>
|   |   |-- <rosserial_arduino>
|-- <rosserial_arduino>
|-- <openag_binary_actuator>
|   |-- <rosserial_arduino>
|   |-- <openag_atlas_ec>
|   |   |-- <rosserial_arduino>
Compiling .pioenvs/megaatmega2560/src/src.ino.o
In file included from lib/rosserial_arduino_libs/ros.h:38:0,
from /home/pi/catkin_ws/src/openag_brain/firmware/src/src.ino:7:
lib/rosserial_arduino_libs/ros/node_handle.h: In instantiation of 'int ros::NodeHandle_<Hardware, MAX_SUBSCRIBERS, MAX_PUBLISHERS, INPUT_SIZE, OUTPUT_SIZE>::publish(int, const ros::Msg*) [with Hardware = ArduinoHardware; int MAX_SUBSCRIBERS = 25; int MAX_PUBLISHERS = 25; int INPUT_SIZE = 512; int OUTPUT_SIZE = 512]':
lib/rosserial_arduino_libs/ros/node_handle.h:297:39:   required from 'void ros::NodeHandle_<Hardware, MAX_SUBSCRIBERS, MAX_PUBLISHERS, INPUT_SIZE, OUTPUT_SIZE>::requestSyncTime() [with Hardware = ArduinoHardware; int MAX_SUBSCRIBERS = 25; int MAX_PUBLISHERS = 25; int INPUT_SIZE = 512; int OUTPUT_SIZE = 512]'
lib/rosserial_arduino_libs/ros/node_handle.h:227:35:   required from 'int ros::NodeHandle_<Hardware, MAX_SUBSCRIBERS, MAX_PUBLISHERS, INPUT_SIZE, OUTPUT_SIZE>::spinOnce() [with Hardware = ArduinoHardware; int MAX_SUBSCRIBERS = 25; int MAX_PUBLISHERS = 25; int INPUT_SIZE = 512; int OUTPUT_SIZE = 512]'
/home/pi/catkin_ws/src/openag_brain/firmware/src/src.ino:87:15:   required from here
lib/rosserial_arduino_libs/ros/node_handle.h:441:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i =5; i<l+7; i++)
^
Archiving .pioenvs/megaatmega2560/lib/librosserial_arduino_libs.a
Compiling .pioenvs/megaatmega2560/lib/openag_atlas_ec/openag_atlas_ec.o
Indexing .pioenvs/megaatmega2560/lib/librosserial_arduino_libs.a
Compiling .pioenvs/megaatmega2560/lib/openag_gc0012/openag_gc0012.o
In file included from lib/openag_atlas_ec/openag_atlas_ec.cpp:5:0:
lib/openag_atlas_ec/openag_atlas_ec.h:10:18: fatal error: Wire.h: No such file or directory
#include <Wire.h>
^
compilation terminated.
Archiving .pioenvs/megaatmega2560/lib/libopenag_air_flush.a
*** [.pioenvs/megaatmega2560/lib/openag_atlas_ec/openag_atlas_ec.o] Error 1
Indexing .pioenvs/megaatmega2560/lib/libopenag_air_flush.a
========================== [ERROR] Took 4.52 seconds ==========================

I don’t get why I’m seeing atlas errors as those sensors are not in my build anywhere including my CouchDB.

src.ino looks good. No atlas there. It might help if I understand from which folder I am supposed to initialize pio and run these commands.

pi@openagdev:~/catkin_ws/src/openag_brain/firmware/src $ cat src.ino 
#include <openag_binary_actuator.h>
#include <openag_dht22.h>
#include <openag_brain/DiagnosticStatus.h>
#include <openag_gc0012.h>
#include <openag_brain/DiagnosticArray.h>
#include <openag_air_flush.h>
#include <ros.h>

uint32_t last_status_read = 0;
bool should_read_statuses() {
  uint32_t curr_time = millis();
  bool res = (curr_time - last_status_read) > 5000;
  if (res) {
    last_status_read = curr_time;
  }
  return res;
}
BinaryActuator humidifier_1(9, true, 10000);
BinaryActuator heater_core_1_1(6, true, 10000);
BinaryActuator water_circulation_pump_1(7, true, 10000);
Gc0012 gc0012_1(1);
std_msgs::Float32 gc0012_1_air_carbon_dioxide_msg;
Dht22 dht22_1(2);
std_msgs::Float32 dht22_1_air_humidity_msg;
std_msgs::Float32 dht22_1_air_temperature_msg;
AirFlush air_flush_1(14, true);
BinaryActuator chamber_fan_1(14, true, 10000);
BinaryActuator grow_lights_1(8, true, 10000);
ros::NodeHandle nh;
openag_brain::DiagnosticArray status_array;
ros::Publisher pub_diagnostics("/internal_diagnostics", &status_array);
void humidifier_1_cmd_callback(const std_msgs::Bool &msg) {
  humidifier_1.set_cmd(msg);
}
ros::Subscriber<std_msgs::Bool> sub_humidifier_1_cmd("/actuators/humidifier_1/cmd", humidifier_1_cmd_callback);
void heater_core_1_1_cmd_callback(const std_msgs::Bool &msg) {
  heater_core_1_1.set_cmd(msg);
}
ros::Subscriber<std_msgs::Bool> sub_heater_core_1_1_cmd("/actuators/heater_core_1_1/cmd", heater_core_1_1_cmd_callback);
void water_circulation_pump_1_cmd_callback(const std_msgs::Bool &msg) {
  water_circulation_pump_1.set_cmd(msg);
}
ros::Subscriber<std_msgs::Bool> sub_water_circulation_pump_1_cmd("/actuators/water_circulation_pump_1/cmd", water_circulation_pump_1_cmd_callback);
ros::Publisher pub_gc0012_1_air_carbon_dioxide("/sensors/gc0012_1/air_carbon_dioxide/raw", &gc0012_1_air_carbon_dioxide_msg);
ros::Publisher pub_dht22_1_air_humidity("/sensors/dht22_1/air_humidity/raw", &dht22_1_air_humidity_msg);
ros::Publisher pub_dht22_1_air_temperature("/sensors/dht22_1/air_temperature/raw", &dht22_1_air_temperature_msg);
void air_flush_1_cmd_callback(const std_msgs::Float32 &msg) {
  air_flush_1.set_cmd(msg);
}
ros::Subscriber<std_msgs::Float32> sub_air_flush_1_cmd("/actuators/air_flush_1/cmd", air_flush_1_cmd_callback);
void chamber_fan_1_cmd_callback(const std_msgs::Bool &msg) {
  chamber_fan_1.set_cmd(msg);
}
ros::Subscriber<std_msgs::Bool> sub_chamber_fan_1_cmd("/actuators/chamber_fan_1/cmd", chamber_fan_1_cmd_callback);
void grow_lights_1_cmd_callback(const std_msgs::Bool &msg) {
  grow_lights_1.set_cmd(msg);
}
ros::Subscriber<std_msgs::Bool> sub_grow_lights_1_cmd("/actuators/grow_lights_1/cmd", grow_lights_1_cmd_callback);

void setup() {
  // Setup all plugins
  Serial.begin(57600);
  nh.initNode();
  nh.advertise(pub_diagnostics);
  // Setup all modules
  humidifier_1.begin();
  nh.subscribe(sub_humidifier_1_cmd);
  heater_core_1_1.begin();
  nh.subscribe(sub_heater_core_1_1_cmd);
  water_circulation_pump_1.begin();
  nh.subscribe(sub_water_circulation_pump_1_cmd);
  gc0012_1.begin();
  nh.advertise(pub_gc0012_1_air_carbon_dioxide);
  dht22_1.begin();
  nh.advertise(pub_dht22_1_air_humidity);
  nh.advertise(pub_dht22_1_air_temperature);
  air_flush_1.begin();
  nh.subscribe(sub_air_flush_1_cmd);
  chamber_fan_1.begin();
  nh.subscribe(sub_chamber_fan_1_cmd);
  grow_lights_1.begin();
  nh.subscribe(sub_grow_lights_1_cmd);
}

void loop() {
  // Update all plugins
  nh.spinOnce();
  // Update all modules
  humidifier_1.update();
  nh.spinOnce();
  heater_core_1_1.update();
  nh.spinOnce();
  water_circulation_pump_1.update();
  nh.spinOnce();
  gc0012_1.update();
  nh.spinOnce();
  if (gc0012_1.get_air_carbon_dioxide(gc0012_1_air_carbon_dioxide_msg)) {
    pub_gc0012_1_air_carbon_dioxide.publish(&gc0012_1_air_carbon_dioxide_msg);
  }
  dht22_1.update();
  nh.spinOnce();
  if (dht22_1.get_air_humidity(dht22_1_air_humidity_msg)) {
    pub_dht22_1_air_humidity.publish(&dht22_1_air_humidity_msg);
  }
  if (dht22_1.get_air_temperature(dht22_1_air_temperature_msg)) {
    pub_dht22_1_air_temperature.publish(&dht22_1_air_temperature_msg);
  }
  air_flush_1.update();
  nh.spinOnce();
  chamber_fan_1.update();
  nh.spinOnce();
  grow_lights_1.update();
  nh.spinOnce();
  // Read statuses of all modules
  if (should_read_statuses()) {
    openag_brain::DiagnosticStatus statuses[8];
    status_array.status_length = 8;
    openag_brain::DiagnosticStatus humidifier_1_status;
    humidifier_1_status.level = humidifier_1.status_level;
    humidifier_1_status.name = "humidifier_1";
    humidifier_1_status.code = humidifier_1.status_code;
    statuses[0] = humidifier_1_status;
    openag_brain::DiagnosticStatus heater_core_1_1_status;
    heater_core_1_1_status.level = heater_core_1_1.status_level;
    heater_core_1_1_status.name = "heater_core_1_1";
    heater_core_1_1_status.code = heater_core_1_1.status_code;
    statuses[1] = heater_core_1_1_status;
    openag_brain::DiagnosticStatus water_circulation_pump_1_status;
    water_circulation_pump_1_status.level = water_circulation_pump_1.status_level;
    water_circulation_pump_1_status.name = "water_circulation_pump_1";
    water_circulation_pump_1_status.code = water_circulation_pump_1.status_code;
    statuses[2] = water_circulation_pump_1_status;
    openag_brain::DiagnosticStatus gc0012_1_status;
    gc0012_1_status.level = gc0012_1.status_level;
    gc0012_1_status.name = "gc0012_1";
    gc0012_1_status.code = gc0012_1.status_code;
    statuses[3] = gc0012_1_status;
    openag_brain::DiagnosticStatus dht22_1_status;
    dht22_1_status.level = dht22_1.status_level;
    dht22_1_status.name = "dht22_1";
    dht22_1_status.code = dht22_1.status_code;
    statuses[4] = dht22_1_status;
    openag_brain::DiagnosticStatus air_flush_1_status;
    air_flush_1_status.level = air_flush_1.status_level;
    air_flush_1_status.name = "air_flush_1";
    air_flush_1_status.code = air_flush_1.status_code;
    statuses[5] = air_flush_1_status;
    openag_brain::DiagnosticStatus chamber_fan_1_status;
    chamber_fan_1_status.level = chamber_fan_1.status_level;
    chamber_fan_1_status.name = "chamber_fan_1";
    chamber_fan_1_status.code = chamber_fan_1.status_code;
    statuses[6] = chamber_fan_1_status;
    openag_brain::DiagnosticStatus grow_lights_1_status;
    grow_lights_1_status.level = grow_lights_1.status_level;
    grow_lights_1_status.name = "grow_lights_1";
    grow_lights_1_status.code = grow_lights_1.status_code;
    statuses[7] = grow_lights_1_status;
    status_array.status = statuses;
    pub_diagnostics.publish(&status_array);
  }
}

Thoughts?

I may flash the arduino with my docker unit. It works and then bring it over to this one.


#16

Ok! So great news!

I went into the firmware/lib folder and deleted all of the sensors that weren’t PFC1 BOM. I then went into the /launch folder and deleted the V2 yaml, launch files and cloned in my libs.

Then I ran sudo ~/catkin_ws/src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo -j2 and successfully rebuilt the workspace.

I’ll skip that log. It’s super long.

Then I ran:

pi@openagdev:~/catkin_ws $ rosrun openag_brain firmware -t upload /home/pi/catkin_ws/src/openag_brain/launch/personal_food_computer_v1.yaml -p ros
[Fri May 12 19:11:51 2017] Processing megaatmega2560 (platform: atmelavr, board: megaatmega2560, framework: arduino)
-----------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Converting src.ino
Collected 39 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <openag_air_flush>
|   |-- <rosserial_arduino>
|   |-- <openag_module>
|-- <openag_dht22>
|   |-- <openag_module>
|   |-- <rosserial_arduino>
|-- <openag_gc0012>
|   |-- <rosserial_arduino>
|   |-- <openag_module>
|-- <openag_binary_actuator>
|   |-- <rosserial_arduino>
|   |-- <openag_module>
|-- <rosserial_arduino>
Compiling .pioenvs/megaatmega2560/src/src.ino.o
Archiving .pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
Compiling .pioenvs/megaatmega2560/FrameworkArduino/CDC.o
Indexing .pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial0.o
In file included from lib/rosserial_arduino_libs/ros.h:38:0,
from /home/pi/catkin_ws/src/openag_brain/firmware/src/src.ino:7:
lib/rosserial_arduino_libs/ros/node_handle.h: In instantiation of 'int ros::NodeHandle_<Hardware, MAX_SUBSCRIBERS, MAX_PUBLISHERS, INPUT_SIZE, OUTPUT_SIZE>::publish(int, const ros::Msg*) [with Hardware = ArduinoHardware; int MAX_SUBSCRIBERS = 25; int MAX_PUBLISHERS = 25; int INPUT_SIZE = 512; int OUTPUT_SIZE = 512]':
lib/rosserial_arduino_libs/ros/node_handle.h:297:39:   required from 'void ros::NodeHandle_<Hardware, MAX_SUBSCRIBERS, MAX_PUBLISHERS, INPUT_SIZE, OUTPUT_SIZE>::requestSyncTime() [with Hardware = ArduinoHardware; int MAX_SUBSCRIBERS = 25; int MAX_PUBLISHERS = 25; int INPUT_SIZE = 512; int OUTPUT_SIZE = 512]'
lib/rosserial_arduino_libs/ros/node_handle.h:227:35:   required from 'int ros::NodeHandle_<Hardware, MAX_SUBSCRIBERS, MAX_PUBLISHERS, INPUT_SIZE, OUTPUT_SIZE>::spinOnce() [with Hardware = ArduinoHardware; int MAX_SUBSCRIBERS = 25; int MAX_PUBLISHERS = 25; int INPUT_SIZE = 512; int OUTPUT_SIZE = 512]'
/home/pi/catkin_ws/src/openag_brain/firmware/src/src.ino:87:15:   required from here
lib/rosserial_arduino_libs/ros/node_handle.h:441:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i =5; i<l+7; i++)
^
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial1.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial2.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial3.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/IPAddress.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/PluggableUSB.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/Print.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/Stream.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/Tone.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/USBCore.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WInterrupts.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WMath.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WString.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/_wiring_pulse.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/abi.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/hooks.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/main.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/new.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_analog.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_digital.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_pulse.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring_shift.o
Compiling .pioenvs/megaatmega2560/lib/rosserial_arduino_libs/duration.o
Compiling .pioenvs/megaatmega2560/lib/rosserial_arduino_libs/time.o
Archiving .pioenvs/megaatmega2560/lib/libopenag_firmware_module.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_firmware_module.a
Archiving .pioenvs/megaatmega2560/libFrameworkArduino.a
Compiling .pioenvs/megaatmega2560/lib/openag_air_flush/openag_air_flush.o
Indexing .pioenvs/megaatmega2560/libFrameworkArduino.a
Archiving .pioenvs/megaatmega2560/lib/librosserial_arduino_libs.a
Compiling .pioenvs/megaatmega2560/lib/openag_dht22/openag_dht22.o
Indexing .pioenvs/megaatmega2560/lib/librosserial_arduino_libs.a
Compiling .pioenvs/megaatmega2560/lib/openag_gc0012/openag_gc0012.o
Compiling .pioenvs/megaatmega2560/lib/openag_binary_actuator/openag_binary_actuator.o
lib/openag_binary_actuator/openag_binary_actuator.cpp: In member function 'virtual void BinaryActuator::update()':
lib/openag_binary_actuator/openag_binary_actuator.cpp:25:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((curr_time - _last_cmd) > _shutoff_ms) {
^
Archiving .pioenvs/megaatmega2560/lib/libopenag_air_flush.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_air_flush.a
Archiving .pioenvs/megaatmega2560/lib/libopenag_binary_actuator.a
Archiving .pioenvs/megaatmega2560/lib/libopenag_dht22.a
Archiving .pioenvs/megaatmega2560/lib/libopenag_gc0012.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_binary_actuator.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_dht22.a
Indexing .pioenvs/megaatmega2560/lib/libopenag_gc0012.a
Linking .pioenvs/megaatmega2560/firmware.elf
Checking program size
text	   data	    bss	    dec	    hex	filename
17262	   1270	   2181	  20713	   50e9	.pioenvs/megaatmega2560/firmware.elf
Building .pioenvs/megaatmega2560/firmware.hex
Looking for upload port...

Warning! Please install `99-platformio-udev.rules` and check that your board's PID and VID are listed in the rules.
https://raw.githubusercontent.com/platformio/platformio/develop/scripts/99-platformio-udev.rules
Auto-detected: /dev/ttyACM0
Uploading .pioenvs/megaatmega2560/firmware.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file ".pioenvs/megaatmega2560/firmware.hex"
avrdude: writing flash (18532 bytes):

Writing | ################################################## | 100% 3.27s

avrdude: 18532 bytes of flash written
avrdude: verifying flash memory against .pioenvs/megaatmega2560/firmware.hex:
avrdude: load data flash data from input file .pioenvs/megaatmega2560/firmware.hex:
avrdude: input file .pioenvs/megaatmega2560/firmware.hex contains 18532 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.39s

avrdude: verifying ...
avrdude: 18532 bytes of flash verified

avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF)

avrdude done.  Thank you.

============================= [SUCCESS] Took 19.09 seconds =============================

And then…

pi@openagdev:~/catkin_ws $ rosrun openag_brain main --screen personal_food_computer_v1.launch
Initializing the database
Applying CouchDB configuration  [####################################]  100%
Creating databases  [####################################]  100%
Pushing design documents
Spawning software modules
... logging to /home/pi/.ros/log/f7ca59b2-3770-11e7-83b1-b827eb13f57f/roslaunch-openagdev-23935.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://openagdev:42455/

SUMMARY
========

PARAMETERS
 * /arduino_handler/serial_port: /dev/ttyACM0
 * /categories: ['sensors', 'actu...
 * /environments/environment_1/aerial_image/autofocus: False
 * /environments/environment_1/aerial_image/brightness: 32
 * /environments/environment_1/aerial_image/camera_frame_id: head_camera
 * /environments/environment_1/aerial_image/camera_info_url: 
 * /environments/environment_1/aerial_image/camera_name": head_camera
 * /environments/environment_1/aerial_image/contrast: 32
 * /environments/environment_1/aerial_image/focus: 51
 * /environments/environment_1/aerial_image/framerate: 1
 * /environments/environment_1/aerial_image/image_height: 480
 * /environments/environment_1/aerial_image/image_width: 640
 * /environments/environment_1/aerial_image/io_method: mmap
 * /environments/environment_1/aerial_image/pixel_format: yuyv
 * /environments/environment_1/aerial_image/saturation: 32
 * /environments/environment_1/aerial_image/sharpness: 22
 * /environments/environment_1/aerial_image/video_device: /dev/video0
 * /environments/environment_1/air_flush_on_controller_1/variable: air_flush_on
 * /environments/environment_1/air_temperature_controller_1/Kd: 0.0
 * /environments/environment_1/air_temperature_controller_1/Ki: 0.0
 * /environments/environment_1/air_temperature_controller_1/Kp: 1.0
 * /environments/environment_1/air_temperature_controller_1/deadband_width: 0.5
 * /environments/environment_1/air_temperature_controller_1/lower_limit: -1.0
 * /environments/environment_1/air_temperature_controller_1/upper_limit: 1.0
 * /environments/environment_1/air_temperature_controller_1/variable: air_temperature
 * /environments/environment_1/air_temperature_controller_1/windup_limit: 1000.0
 * /environments/environment_1/image_persistence_1/min_update_interval: 3600
 * /environments/environment_1/light_controller/variable: light_intensity
 * /environments/environment_1/sensor_persistence_1/max_update_interval: 600
 * /environments/environment_1/sensor_persistence_1/min_update_interval: 5
 * /environments/environment_1/video_writer_1/timelapse_scaling_factor: 86400
 * /firmware_module: [{'environment': ...
 * /firmware_module_type: [{'description': ...
 * /rosdistro: indigo
 * /rosversion: 1.11.21
 * /var_types/camera_variables/aerial_image/description: Image from above ...
 * /var_types/camera_variables/aerial_image/name: aerial_image
 * /var_types/camera_variables/aerial_image/units: png
 * /var_types/camera_variables/frontal_image/description: Image from in fro...
 * /var_types/camera_variables/frontal_image/name: frontal_image
 * /var_types/camera_variables/frontal_image/units: png
 * /var_types/environment_variables/air_carbon_dioxide/description: The amount of Car...
 * /var_types/environment_variables/air_carbon_dioxide/name: air_carbon_dioxide
 * /var_types/environment_variables/air_carbon_dioxide/type: std_msgs/Float64
 * /var_types/environment_variables/air_carbon_dioxide/units: ppm
 * /var_types/environment_variables/air_flush_on/description: Turn on air flush...
 * /var_types/environment_variables/air_flush_on/name: air_flush_on
 * /var_types/environment_variables/air_flush_on/type: std_msgs/Boolean
 * /var_types/environment_variables/air_humidity/description: A measure of the ...
 * /var_types/environment_variables/air_humidity/name: air_humidity
 * /var_types/environment_variables/air_humidity/type: std_msgs/Float64
 * /var_types/environment_variables/air_humidity/units: percent relative
 * /var_types/environment_variables/air_temperature/description: Temperature of th...
 * /var_types/environment_variables/air_temperature/name: air_temperature
 * /var_types/environment_variables/air_temperature/type: std_msgs/Float64
 * /var_types/environment_variables/air_temperature/units: degrees C
 * /var_types/environment_variables/light_illuminance/description: The intensity of ...
 * /var_types/environment_variables/light_illuminance/name: light_illuminance
 * /var_types/environment_variables/light_illuminance/type: std_msgs/Float64
 * /var_types/environment_variables/light_illuminance/units: lux
 * /var_types/environment_variables/light_intensity/description: The intensity set...
 * /var_types/environment_variables/light_intensity/name: light_intensity
 * /var_types/environment_variables/light_intensity/type: std_msgs/Float64
 * /var_types/environment_variables/light_intensity/units: percent relative
 * /var_types/environment_variables/water_dissolved_oxygen/description: A measure of the ...
 * /var_types/environment_variables/water_dissolved_oxygen/name: water_dissolved_o...
 * /var_types/environment_variables/water_dissolved_oxygen/type: std_msgs/Float64
 * /var_types/environment_variables/water_dissolved_oxygen/units: mg/L
 * /var_types/environment_variables/water_electrical_conductivity/description: Electrical conduc...
 * /var_types/environment_variables/water_electrical_conductivity/name: water_electrical_...
 * /var_types/environment_variables/water_electrical_conductivity/type: std_msgs/Float64
 * /var_types/environment_variables/water_electrical_conductivity/units: uS/cm
 * /var_types/environment_variables/water_oxidation_reduction_potential/description: Oxidation-reducti...
 * /var_types/environment_variables/water_oxidation_reduction_potential/name: water_oxidation_r...
 * /var_types/environment_variables/water_oxidation_reduction_potential/type: std_msgs/Float64
 * /var_types/environment_variables/water_oxidation_reduction_potential/units: mV
 * /var_types/environment_variables/water_potential_hydrogen/description: Potential Hydroge...
 * /var_types/environment_variables/water_potential_hydrogen/name: water_potential_h...
 * /var_types/environment_variables/water_potential_hydrogen/type: std_msgs/Float64
 * /var_types/environment_variables/water_potential_hydrogen/units: pH
 * /var_types/environment_variables/water_temperature/description: Temperature of th...
 * /var_types/environment_variables/water_temperature/name: water_temperature
 * /var_types/environment_variables/water_temperature/type: std_msgs/Float64
 * /var_types/environment_variables/water_temperature/units: degrees C
 * /var_types/recipe_variables/recipe_end/description: Represents the en...
 * /var_types/recipe_variables/recipe_end/name: recipe_end
 * /var_types/recipe_variables/recipe_start/description: Represents the st...
 * /var_types/recipe_variables/recipe_start/name: recipe_start
 * /var_types/user_variables/marker/description: Marks some user-d...
 * /var_types/user_variables/marker/name: marker

NODES
  /
    api (openag_brain/api.py)
    arduino_handler (openag_brain/handle_arduino.py)
    expand_diagnostics (openag_brain/expand_diagnostics.py)
    sensor_info_publisher (openag_brain/sensor_info_publisher.py)
    topic_connector (openag_brain/topic_connector.py)
  /environments/environment_1/
    aerial_image (usb_cam/usb_cam_node)
    air_flush_on_controller_1 (openag_brain/direct_controller.py)
    air_temperature_controller_1 (openag_brain/pid.py)
    image_persistence_1 (openag_brain/image_persistence.py)
    light_controller (openag_brain/direct_controller.py)
    recipe_handler_1 (openag_brain/recipe_handler.py)
    sensor_persistence_1 (openag_brain/sensor_persistence.py)
    topic_filter_1 (openag_brain/topic_filter.py)
    video_writer_1 (openag_brain/video_writer.py)

auto-starting new master
process[master]: started with pid [23946]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to f7ca59b2-3770-11e7-83b1-b827eb13f57f
process[rosout-1]: started with pid [23959]
started core service [/rosout]
process[environments/environment_1/topic_filter_1-2]: started with pid [23976]
process[environments/environment_1/air_temperature_controller_1-3]: started with pid [23977]
process[environments/environment_1/recipe_handler_1-4]: started with pid [23978]
process[environments/environment_1/video_writer_1-5]: started with pid [23979]
process[environments/environment_1/image_persistence_1-6]: started with pid [23980]
process[environments/environment_1/light_controller-7]: started with pid [23981]
process[environments/environment_1/air_flush_on_controller_1-8]: started with pid [23982]
process[environments/environment_1/sensor_persistence_1-9]: started with pid [23983]
process[environments/environment_1/aerial_image-10]: started with pid [23984]
process[expand_diagnostics-11]: started with pid [23985]
process[arduino_handler-12]: started with pid [23988]
process[api-13]: started with pid [23989]
process[topic_connector-14]: started with pid [24001]
process[sensor_info_publisher-15]: started with pid [24005]
[INFO] [WallTime: 1494634402.349209] Filtering topic water_oxidation_reduction_potential/raw to topic water_oxidation_reduction_potential/measured
[INFO] [WallTime: 1494634402.411199] Forwarding topic air_flush_on/raw to topic air_flush_on/measured
[INFO] [WallTime: 1494634402.481630] Filtering topic water_electrical_conductivity/raw to topic water_electrical_conductivity/measured
[INFO] [WallTime: 1494634402.537404] Filtering topic water_potential_hydrogen/raw to topic water_potential_hydrogen/measured
[INFO] [WallTime: 1494634402.647255] Filtering topic light_illuminance/raw to topic light_illuminance/measured
[INFO] [WallTime: 1494634402.718444] Filtering topic water_dissolved_oxygen/raw to topic water_dissolved_oxygen/measured
[INFO] [WallTime: 1494634402.797710] Filtering topic light_intensity/raw to topic light_intensity/measured
[INFO] [WallTime: 1494634402.859980] Filtering topic air_temperature/raw to topic air_temperature/measured
[INFO] [WallTime: 1494634402.972201] Filtering topic air_humidity/raw to topic air_humidity/measured
[INFO] [WallTime: 1494634403.069838] Filtering topic air_carbon_dioxide/raw to topic air_carbon_dioxide/measured
[INFO] [WallTime: 1494634403.171866] Filtering topic water_temperature/raw to topic water_temperature/measured
[ INFO] [1494634403.360836344]: using default calibration URL
[ INFO] [1494634403.362233410]: camera calibration URL: file:///home/pi/.ros/camera_info/head_camera.yaml
[ INFO] [1494634403.363292460]: Unable to open camera calibration file [/home/pi/.ros/camera_info/head_camera.yaml]
[ WARN] [1494634403.364524372]: Camera calibration file /home/pi/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1494634403.365574150]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 1 FPS
[INFO] [WallTime: 1494634403.939411] Starting to read from Arduino
[INFO] [WallTime: 1494634404.374485] Connecting topic /environments/environment_1/air_humidity/commanded to topic /actuators/humidifier_1/cmd
[INFO] [WallTime: 1494634404.451012] Connecting topic /environments/environment_1/air_temperature/commanded to topic /actuators/heater_core_1_1/cmd
[INFO] [WallTime: 1494634404.503079] Connecting topic /environments/environment_1/cmd/commanded to topic /actuators/water_circulation_pump_1/cmd
[INFO] [WallTime: 1494634404.573602] Connecting topic /sensors/gc0012_1/air_carbon_dioxide/raw to topic /environments/environment_1/air_carbon_dioxide/raw
[INFO] [WallTime: 1494634404.632525] Connecting topic /sensors/gc0012_1/air_carbon_dioxide/info to topic /environments/environment_1/air_carbon_dioxide/info
[INFO] [WallTime: 1494634404.703621] Connecting topic /sensors/dht22_1/air_humidity/raw to topic /environments/environment_1/air_humidity/raw
[INFO] [WallTime: 1494634404.805890] Connecting topic /sensors/dht22_1/air_humidity/info to topic /environments/environment_1/air_humidity/info
[INFO] [WallTime: 1494634404.838402] API now listening on http://0.0.0.0:5000
[ WARN] [1494634404.840619356]: unknown control 'focus_auto'

[ WARN] [1494634404.867156947]: unknown control 'focus_absolute'

[INFO] [WallTime: 1494634404.873437] Connecting topic /sensors/dht22_1/air_temperature/raw to topic /environments/environment_1/air_temperature/raw
[INFO] [WallTime: 1494634404.898329] Posting image
[INFO] [WallTime: 1494634404.973809] Connecting topic /sensors/dht22_1/air_temperature/info to topic /environments/environment_1/air_temperature/info
[INFO] [WallTime: 1494634405.009081] Connecting topic /environments/environment_1/air_flush_on/commanded to topic /actuators/air_flush_1/cmd
[INFO] [WallTime: 1494634405.050401] Connecting topic /environments/environment_1/cmd/commanded to topic /actuators/chamber_fan_1/cmd
[INFO] [WallTime: 1494634405.077400] Connecting topic /environments/environment_1/light_intensity/commanded to topic /actuators/grow_lights_1/cmd
[INFO] [WallTime: 1494634405.580802] ROS Serial Python Node
[INFO] [WallTime: 1494634405.600035] Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [WallTime: 1494634410.200349] Note: publish buffer size is 512 bytes
[INFO] [WallTime: 1494634410.202406] Setup publisher on /internal_diagnostics [openag_brain/DiagnosticArray]
[INFO] [WallTime: 1494634410.217577] Setup publisher on /sensors/gc0012_1/air_carbon_dioxide/raw [std_msgs/Float32]
[INFO] [WallTime: 1494634410.227407] Setup publisher on /sensors/dht22_1/air_humidity/raw [std_msgs/Float32]
[INFO] [WallTime: 1494634410.237055] Setup publisher on /sensors/dht22_1/air_temperature/raw [std_msgs/Float32]
[INFO] [WallTime: 1494634410.251183] Note: subscribe buffer size is 512 bytes
[INFO] [WallTime: 1494634410.252756] Setup subscriber on /actuators/humidifier_1/cmd [std_msgs/Bool]
[INFO] [WallTime: 1494634410.268341] Setup subscriber on /actuators/heater_core_1_1/cmd [std_msgs/Bool]
[INFO] [WallTime: 1494634410.292547] Setup subscriber on /actuators/water_circulation_pump_1/cmd [std_msgs/Bool]
[INFO] [WallTime: 1494634410.341487] Setup subscriber on /actuators/air_flush_1/cmd [std_msgs/Float32]
[INFO] [WallTime: 1494634410.367579] Setup subscriber on /actuators/chamber_fan_1/cmd [std_msgs/Bool]
[INFO] [WallTime: 1494634410.384931] Setup subscriber on /actuators/grow_lights_1/cmd [std_msgs/Bool]

Boom! No error messages! I’m up!

This does expose some issues with the multiple hardware configuration plan. It seems the libs and launch files cannot co-exist at this time so we’ll need separate docker containers for each hardware container. I’ll throw @gordonb into this so he’s in the loop.

I’ll start testing on Sunday. I’m pretty excited to get this actively modulating the temp and humidity!


#17

@juhnke wait… in what way can they not co-exist? Firmware should only be generated for the libs described in the yaml file. Do you have a hypothesis for what’s going on here?


#18

Hi @gordonb The errors I was running into here (these are quotes from messages above with log files):

were resolved when I deleted unused V2 libs (specifically atlas sensors) and the V2 launch files and recompiled using the commands here:

It will require more testing but I suspect that having 2 sets of launch files and libs somehow confuses ROS/Catkin. I’ll stop at the store and grab a few SD cards and see if I can’t replicate the issue today.

Cheers,

J


Brain_box build for Research
#19

OH SNAP!!! It runs like a champ when I start it from the command line. It doesn’t work as well as a service yet. When I type sudo service openag_brain start it starts with the default V2 fixtures.

I found this:

pi@openagdev:~/catkin_ws/src/openag_brain/scripts $ cat openag_brain_run_service 
#!/bin/bash
# This script is used in a developer environment to configure a
# Linux system service. The script is copied to /opt and is launched
# by a service (openag_brain.service).
# This is all handled by the `install_dev` script.
source /opt/ros/indigo/setup.bash
rosrun openag_brain main personal_food_computer_v2.launch

I’ll change that and recompile and see if I can get this to behave.

Back soon!


#20

That didn’t get the service to work and I don’t care right now. I’m using rosrun openag_brain main --screen personal_food_computer_v1.launch & to toss the brain into a background process and am focusing on getting a recipe started.

I’ll come back to the service.

Also, I’m keeping a detailed install log so I can replicate the process. I’ll post that when I get it all working.