Robowflex  v0.1
Making MoveIt Easy
tapedeck.cpp
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
3 #include <boost/date_time.hpp>
4 
7 
9 
10 using namespace robowflex;
11 
12 /* \file tapedeck.cpp
13  * An example script that shows how to use MoveGroupHelper. Here, a callback is
14  * installed so that every motion plan issued to MoveGroup is saved to disk as a
15  * YAML file. This is useful for collecting and replaying motion planning
16  * requests that are done over the course of an experiment.
17  */
18 
19 // Output a captured action to a YAML file.
21 {
22  ros::Time time = ros::Time::now();
23 
24  // Save the requests to a folder in the home directory.
25  const std::string filename = "~/robowflex_tapedeck/" + to_iso_string(time.toBoost()) + ".yml";
26  action.toYAMLFile(filename);
27 
28  RBX_INFO("Wrote YAML for Request ID `%s` to file `%s`", action.id, filename);
29 }
30 
31 int main(int argc, char **argv)
32 {
33  // Startup ROS
34  ROS ros(argc, argv);
35 
36  // Create helper
38 
39  // Setup callback function
41 
42  // Wait until killed
43  ros.wait();
44 }
RAII-pattern for starting up ROS.
Definition: util.h:52
void wait() const
Waits for the process to be killed via some means (normally Ctrl-C)
Definition: util.cpp:96
A helper class that allows for pulling and pushing of scenes, robots, and trajectories to move group.
Definition: services.h:27
void setResultCallback(const ResultCallback &callback)
Sets a callback function that is called whenever a motion plan request is serviced by move group.
Definition: services.cpp:107
#define RBX_INFO(fmt,...)
Output a info logging message.
Definition: log.h:118
Main namespace. Contains all library classes and functions.
Definition: scene.cpp:25
A container struct for all relevant information about a motion planning request to move group.
Definition: services.h:33
bool toYAMLFile(const std::string &filename)
Save a recorded action to a YAML file.
Definition: services.cpp:46
int main(int argc, char **argv)
Definition: tapedeck.cpp:31
void callback(movegroup::MoveGroupHelper::Action &action)
Definition: tapedeck.cpp:20