Skip to content
Snippets Groups Projects
Commit 3c30381d authored by https://roangel@gitlab.ethz.ch's avatar https://roangel@gitlab.ethz.ch
Browse files

my hands are typing words

parent ff054b34
No related branches found
No related tags found
No related merge requests found
//for field command in CMCommand
#define CMD_SAVE 1
#define CMD_RELOAD 2
//for field mode in CMUpdate
#define ENTRY_INSERT_OR_UPDATE 1
#define ENTRY_REMOVE 2
......@@ -16,6 +16,8 @@
#include <stdlib.h>
#include "ros/ros.h"
#include <ros/package.h>
#include "rosbag/bag.h"
#include "d_fall_pps/CentralManager.h"
#include "d_fall_pps/CrazyflieContext.h"
#include "d_fall_pps/CrazyflieDB.h"
......@@ -32,6 +34,17 @@ using namespace std;
CrazyflieDB crazyflieDB;
void saveCrazyflieDB() {
string packagePath = ros::package::getPath("d_fall_pps") + "/";
string dbFile = packagePath + "crazyflie.db";
bag.open(dbFile, rosbag::bagmode::Write);
bag.write("crazyflie_db", ros::Time::now(), crazyflieDB);
}
void loadCrazyflieDB() {
}
bool cmRead(CMRead::Request &request, CMRead::Response &response) {
response.crazyflieDB = crazyflieDB;
return true;
......@@ -99,12 +112,12 @@ bool cmUpdate(CMUpdate::Request &request, CMUpdate::Response &response) {
bool cmCommand(CMCommand::Request &request, CMCommand::Response &response) {
switch(request.command) {
case CMD_SAVE: {
//writeCrazyflieDB(crazyflieDB);
saveCrazyflieDB();
return true;
}
case CMD_RELOAD: {
//crazyflieDB = readCrazyflieDB();
loadCrazyflieDB();
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment