Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Python peripherals #278

Merged
merged 36 commits into from
Jun 26, 2017
Merged

Python peripherals #278

merged 36 commits into from
Jun 26, 2017

Conversation

jakerye
Copy link
Contributor

@jakerye jakerye commented Jun 14, 2017

Summary

This change introduces a way to interface with sensors and actuators directly from the pi. The goal of this is create the option to run the brain without the use of an arduino.

Motivation

Before the bespoke serial messaging protocol, the communication between the raspi and arduino was unreliable. This was a parallel development effort to create a stable system as fast as possible. It was also required for integrating the brain box code into the main software stack. Furthermore, running all code on a single board simplifies the system.

Details

New nodes are added and named with a functional prefix. E.g. sensor_am2315 or actuator_relay. Nodes manage rostopics and event loops. The nodes call a helper module for each device (e.g. am2315 or relay) found in the peripheral directory. It is here where all the code for actually interfacing with the device sits.

This PR interfaces with the following:

  • Sensors

    • am2315 temp & humid sensor
    • ds18b20 water temp sensor
    • mhz16 co2 sensor
    • atlas ph sensor
    • atlas ec sensor
  • Actuators:

    • hid 16 channel relay (driven via usb)
    • individual relay (driven via gpio)
  • UI:

    • touchscreen (official raspberry pi 7") that simple displays the sensor values

Drawbacks

Running timing sensitive code will not be possible from this approach.

Alternatives

  • Bespoke serial protocol w/arduino
  • Beaglebone where timing sensitive code runs on one of the x2 programable real time units (PRUs)

@sp4ghet sp4ghet requested a review from rbaynes June 14, 2017 21:09
@CarrierDirectJoe
Copy link

So this is going to pull out support for PFC1? I'm finding myself stuck trying to figure out where I'm going to take the legacy hardware. There are a number of design flaws including weak sensors in PFC1 but the cost to retrofit it to be entirely a PFC2 ecosystem I might as well just toss them and build PFC2s. At least the PFC1's have working lights tho. :-)

@sp4ghet
Copy link
Collaborator

sp4ghet commented Jun 14, 2017

We're kind of exploring a couple different configurations to see which method of implementation will provide the most value for us in regards to hardware. Either way, we will probably be heading in a way where anyone with different hardware needs to write a way to interface that with ROS.

The contract will be publishing and subscribing to environmental variable topics defined under the launch/personal_food_computer_var_types.yaml and everything else aside from that will be considered free reign.
The way I would do this for PFC1 hardware would probably be to write a node that handles the arduino (similar to nodes/arduino_handler.py under the bespoke_serial branch) and an accompanying Arduino sketch. (The analogy for this would be hardware manufacturers writing firmware and a driver for their hardware).

gordonbrander and others added 25 commits June 21, 2017 15:04
and only publish when we have data
rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie

# Source ROS environment
source /opt/ros/indigo/setup.bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct path? You sure it shouldn't be source ~/catkin_ws/devel/setup.bash ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this install script it's the correct one, but it no longer works with this install script so I will rewrite accordingly

rbaynes
rbaynes previously approved these changes Jun 22, 2017
Copy link
Contributor

@rbaynes rbaynes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'll leave it up to @spaghet to merge this if it is ready.

rbaynes
rbaynes previously approved these changes Jun 23, 2017
Copy link
Contributor

@rbaynes rbaynes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si, es bueno.

@edcafenet
Copy link
Collaborator

edcafenet commented Jun 23, 2017 via email

Copy link
Contributor

@rbaynes rbaynes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT

@sp4ghet sp4ghet merged commit 7518fd1 into develop Jun 26, 2017
@sp4ghet sp4ghet deleted the python_peripherals branch June 26, 2017 22:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants