OpenAg Wiki Archive
Archived Contents from the original OpenAg Wiki (snapshot on Apr 8, 2020)
The archived wiki only includes information up the v3.0 version of the PFC-EDU, and is here for preservation purposes. You can find resources about the latest version of the PFC v4.0 on the Personal Food Computer resources page.
ROS and openag_brain
- Audience: makers, developers
- Level: intermediate
openag_brain runs on ROS (Robot Operating System), an open source robotics system that is used in many commercial robots.
- The current version of openag_brain uses ROS Indigo.
- Detailed ROS documentation can be found on the ROS Wiki
Workspaces
ROS has a concept called workspaces (see
http://wiki.ros.org/catkin/Tutorials/using_a_workspace). Before
working with a ROS project, you have to activate its workspace. The
default OpenAg workspace is located in ~/catkin_ws/
. To activate it,
run:
source ~/catkin_ws/devel/setup.bash
(This also works within the openag_brain Docker container. See docker for more.)
Once you activate the workspace, you can interact with ROS.
Topics
Topics are the core concept of ROS. They’re named channels over which many different scripts and processes can communicate.
/openag_brain/ uses ROS topics to tie together sensors, actuators and controllers into closed feedback loops.
To list available ROS topics:
rostopic list
To log output from a ROS topic:
rostopic echo <topic name>
Raw Data CSV Output for Experiments
When running experiments, it can be convenient to log data from a topic and export it as a csv. An easy way to do this is with a rosbag subset. Creating a rosbag will typically log data from all the topics unless you specify a subset of topic(s). To create this subset log, make a new directory and start a rosbag subset when you want to start logging data.
mkdir ~/bagfiles
cd ~/bagfiles
rosbag record -O subset /topic
When the experiment ends and you want to stop logging data, simply exit with:
ctrl + c
The data in the rosbag subset does not default to a .csv format so you can quickly convert it with the following command.
rostopic echo -b subset.bag -p /topic