Commit 46b195a9 authored by muelmarc's avatar muelmarc
Browse files

rosbag recording to file

parent 2fe0ab3f
......@@ -14,6 +14,7 @@ find_package(catkin REQUIRED COMPONENTS
std_msgs
genmsg
rosbag
roslib
)
......@@ -170,7 +171,7 @@ generate_messages(
catkin_package(
INCLUDE_DIRS include ${MY_LIB_PATH_INC} # GUI -- include headers from GUI in package
LIBRARIES
CATKIN_DEPENDS roscpp rospy std_msgs rosbag
CATKIN_DEPENDS roscpp rospy std_msgs rosbag roslib
DEPENDS
)
......
......@@ -25,10 +25,7 @@
<node pkg="rqt_plot" name="commandplotter" type="rqt_plot" args="/PPSClient/ControlCommand/roll /PPSClient/ControlCommand/pitch /PPSClient/ControlCommand/yaw" />
<node pkg="rosbag" type="record" name="testbag" />
<!-- When we have a GUI, this has to be adapted and included -->
<!-- When we have a GUI, this has to be adapted and included -->
<node pkg="d_fall_pps" name="my_GUI" output="screen" type="my_GUI">
<!-- <rosparam command="load" file="$(find d_fall_pps)/launch/ControlParams.yaml" /> -->
</node>
......
......@@ -45,10 +45,12 @@
<build_depend>std_msgs</build_depend>
<build_depend>genmsg</build_depend>
<build_depend>rosbag</build_depend>
<build_depend>roslib</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>rosbag</run_depend>
<run_depend>roslib</run_depend>
<!-- The export tag contains other, unspecified, tags -->
......
......@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <rosbag/bag.h>
#include <std_msgs/String.h>
#include <ros/package.h>
#include "d_fall_pps/Controller.h"
#include "d_fall_pps/CentralManager.h"
......@@ -26,6 +27,7 @@
#include "d_fall_pps/ControlCommand.h"
#include "d_fall_pps/CrazyflieContext.h"
#include "std_msgs/Int32.h"
#include "std_msgs/UInt32.h"
#include "d_fall_pps/ControlCommand.h"
......@@ -133,21 +135,29 @@ void viconCallback(const ViconData& data) {
else{
safetyDelay=20;
}
controlCommandPublisher.publish(controllerCall.response.controlOutput);
*/
std_msgs::String str;
str.data = std::string("foo");
/*
float32 roll
float32 pitch
float32 yaw
uint16 motorCmd1
uint16 motorCmd2
uint16 motorCmd3
uint16 motorCmd4
*/
std_msgs::UInt32 i;
i.data = controllerCall.response.controlOutput.roll;
std_msgs::Int32 i;
i.data = 42;
bag.write("testfoo: ", ros::Time::now(), str);
bag.write("test42: ", ros::Time::now(), i);
*/
bag.write("test: ", ros::Time::now(), controllerCall.response.controlOutput);
controlCommandPublisher.publish(controllerCall.response.controlOutput);
} else{ //crazyflie disabled
} else { //crazyflie disabled
ControlCommand zeroOutput = ControlCommand(); //everything set to zero
zeroOutput.onboardControllerType = 2; //set to motor_mode
controlCommandPublisher.publish(zeroOutput);
......@@ -255,9 +265,14 @@ int main(int argc, char* argv[]){
usingSafeController = true;
loadSafeController();
bag.open("testbag.bag", rosbag::bagmode::Write);
std::string package_path;
package_path = ros::package::getPath("d_fall_pps") + "/";
ROS_INFO_STREAM(package_path);
std::string testbag_file = package_path + "datarecord.bag";
bag.open(testbag_file, rosbag::bagmode::Write);
//bag.close();
ros::spin();
return 0;
//ros::shutdown();
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment