Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Make ROS show sensor info

Make ROS show sensor info on the PFC2

Maybe take a look at this first: http://wiki.openag.media.mit.edu/openag_brain/ros

For this to work, you need to have ROS running in the background. I ran rosrun openag_brain main in an ssh window, then used another Terminal tab to log in to the Pi 3 again with ssh. I ran the commands below in the second ssh window.

Load the catkin workspace:

pi@raspberrypi:~ $ source ~/catkin_ws/devel/setup.bash

Check available ROS topics:

pi@raspberrypi:~ $ rostopic list
/actuators/air_flush_1/cmd
/actuators/chamber_fan_1/cmd
/actuators/chiller_compressor_1/cmd
/actuators/chiller_fan_1/cmd
/actuators/chiller_pump_1/cmd
/actuators/heater_core_1_1/cmd
/actuators/heater_core_2_1/cmd
/actuators/led_blue_1/cmd
/actuators/led_red_1/cmd
/actuators/led_white_1/cmd
/actuators/pump_1_nutrient_a_1/cmd
/actuators/pump_2_nutrient_b_1/cmd
/actuators/pump_3_ph_up_1/cmd
/actuators/pump_4_ph_down_1/cmd
/actuators/pump_5_water_1/cmd
/actuators/water_aeration_pump_1/cmd
/actuators/water_circulation_pump_1/cmd
/diagnostics
/environments/environment_1/aerial_image/raw
/environments/environment_1/air_carbon_dioxide/info
/environments/environment_1/air_carbon_dioxide/measured
/environments/environment_1/air_carbon_dioxide/raw
/environments/environment_1/air_humidity/info
/environments/environment_1/air_humidity/measured
/environments/environment_1/air_humidity/raw
/environments/environment_1/air_temperature/commanded
/environments/environment_1/air_temperature/desired
/environments/environment_1/air_temperature/info
/environments/environment_1/air_temperature/measured
/environments/environment_1/air_temperature/raw
/environments/environment_1/cmd/commanded
/environments/environment_1/frontal_image/raw
/environments/environment_1/light_illuminance/commanded
/environments/environment_1/light_illuminance/desired
/environments/environment_1/light_illuminance/measured
/environments/environment_1/light_illuminance/raw
/environments/environment_1/water_dissolved_oxygen/measured
/environments/environment_1/water_dissolved_oxygen/raw
/environments/environment_1/water_electrical_conductivity/info
/environments/environment_1/water_electrical_conductivity/measured
/environments/environment_1/water_electrical_conductivity/raw
/environments/environment_1/water_level_high/commanded
/environments/environment_1/water_level_high/info
/environments/environment_1/water_level_high/measured
/environments/environment_1/water_level_high/raw
/environments/environment_1/water_oxidation_reduction_potential/measured
/environments/environment_1/water_oxidation_reduction_potential/raw
/environments/environment_1/water_potential_hydrogen/commanded
/environments/environment_1/water_potential_hydrogen/desired
/environments/environment_1/water_potential_hydrogen/info
/environments/environment_1/water_potential_hydrogen/measured
/environments/environment_1/water_potential_hydrogen/raw
/environments/environment_1/water_temperature/info
/environments/environment_1/water_temperature/measured
/environments/environment_1/water_temperature/raw
/internal_diagnostics
/rosout
/rosout_agg
/sensors/am2315_1/air_humidity/info
/sensors/am2315_1/air_humidity/raw
/sensors/am2315_1/air_temperature/info
/sensors/am2315_1/air_temperature/raw
/sensors/atlas_ec_1/water_electrical_conductivity/info
/sensors/atlas_ec_1/water_electrical_conductivity/raw
/sensors/atlas_ph_1/water_potential_hydrogen/info
/sensors/atlas_ph_1/water_potential_hydrogen/raw
/sensors/ds18b20_1/temperature/info
/sensors/ds18b20_1/temperature/raw
/sensors/mhz16_1/air_carbon_dioxide/info
/sensors/mhz16_1/air_carbon_dioxide/raw
/sensors/water_level_sensor_high_1/is_on/info
/sensors/water_level_sensor_high_1/is_on/raw

Echo some random topics (I didn't have any sensors connected when I did this):

pi@raspberrypi:~ $ rostopic echo /sensors/am2315_1/air_humidity/info
accuracy: 2.0
repeatability: 0.1
---
^Cpi@raspberrypi:~ $ rostopic echo /sensors/am2315_1/air_humidity/raw
^Cpi@raspberrypi:~ $ rostopic echo /sensors/atlas_ec_1/water_electrical_conductivity/info
accuracy: 0.0
repeatability: 0.0
---
^Cpi@raspberrypi:~ $ rostopic echo /sensors/atlas_ec_1/water_electrical_conductivity/raw
^Cpi@raspberrypi:~ $ rostopic echo /sensors/water_level_sensor_high_1/is_on/info
accuracy: 0.0
repeatability: 0.0
---
^Cpi@raspberrypi:~ $ rostopic echo /sensors/water_level_sensor_high_1/is_on/raw
data: True
---
data: True
---
data: True
---
^Cpi@raspberrypi:~ $ rostopic echo /internal_diagnostics
header: 
  seq: 237
  stamp: 
    secs: 0
    nsecs:         0
  frame_id: ''
status: 
  - 
    level: 0
    name: chiller_fan_1
    code: 0
  - 
    level: 0
    name: led_blue_1
    code: 0
  - 
    level: 0
    name: heater_core_1_1
    code: 0
  - 
    level: 2
    name: ds18b20_1
    code: 2
  - 
    level: 0
    name: water_aeration_pump_1
    code: 0
  - 
    level: 0
    name: led_red_1
    code: 0
  - 
    level: 0
    name: heater_core_2_1
    code: 0
  - 
    level: 2
    name: atlas_ph_1
    code: 1
  - 
    level: 0
    name: pump_1_nutrient_a_1
    code: 0
  - 
    level: 2
    name: mhz16_1
    code: 3
  - 
    level: 2
    name: am2315_1
    code: 1
  - 
    level: 0
    name: water_circulation_pump_1
    code: 0
  - 
    level: 0
    name: water_level_sensor_high_1
    code: 0
  - 
    level: 0
    name: chiller_pump_1
    code: 0
  - 
    level: 0
    name: pump_3_ph_up_1
    code: 0
  - 
    level: 0
    name: pump_5_water_1
    code: 0
  - 
    level: 0
    name: pump_2_nutrient_b_1
    code: 0
  - 
    level: 0
    name: led_white_1
    code: 0
  - 
    level: 0
    name: chiller_compressor_1
    code: 0
  - 
    level: 2
    name: atlas_ec_1
    code: 1
  - 
    level: 0
    name: air_flush_1
    code: 0
  - 
    level: 0
    name: chamber_fan_1
    code: 0
  - 
    level: 0
    name: pump_4_ph_down_1
    code: 0
---
header: 
  seq: 238
  stamp: 
    secs: 0
    nsecs:         0
  frame_id: ''
status: 
  - 
    level: 0
    name: chiller_fan_1
    code: 0
  - 
    level: 0
    name: led_blue_1
    code: 0
  - 
    level: 0
    name: heater_core_1_1
    code: 0
  - 
    level: 2
    name: ds18b20_1
    code: 2
  - 
    level: 0
    name: water_aeration_pump_1
    code: 0
  - 
    level: 0
    name: led_red_1
    code: 0
  - 
    level: 0
    name: heater_core_2_1
    code: 0
  - 
    level: 2
    name: atlas_ph_1
    code: 1
  - 
    level: 0
    name: pump_1_nutrient_a_1
    code: 0
  - 
    level: 2
    name: mhz16_1
    code: 3
  - 
    level: 2
    name: am2315_1
    code: 1
  - 
    level: 0
    name: water_circulation_pump_1
    code: 0
  - 
    level: 0
    name: water_level_sensor_high_1
    code: 0
  - 
    level: 0
    name: chiller_pump_1
    code: 0
  - 
    level: 0
    name: pump_3_ph_up_1
    code: 0
  - 
    level: 0
    name: pump_5_water_1
    code: 0
  - 
    level: 0
    name: pump_2_nutrient_b_1
    code: 0
  - 
    level: 0
    name: led_white_1
    code: 0
  - 
    level: 0
    name: chiller_compressor_1
    code: 0
  - 
    level: 2
    name: atlas_ec_1
    code: 1
  - 
    level: 0
    name: air_flush_1
    code: 0
  - 
    level: 0
    name: chamber_fan_1
    code: 0
  - 
    level: 0
    name: pump_4_ph_down_1
    code: 0
---
^Cpi@raspberrypi:~ $ rostopic echo /environments/environment_1/water_level_high/info
accuracy: 0.0
repeatability: 0.0
---
^Cpi@raspberrypi:~ $ rostopic echo /environments/environment_1/water_level_high/measured
data: 1.0
---
data: 1.0
---
data: 1.0
---
data: 1.0
---
^C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment