TrajectoryExporter.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* ArmarX is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
7
*
8
* ArmarX is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* @package ArmarXGuiPlugins::RobotTrajectoryDesigner::ImportExport
17
* @author Liran Dattner
18
* @date 2018
19
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20
* GNU General Public License
21
*/
22
#include "
TrajectoryExporter.h
"
23
#include <
RobotAPI/libraries/core/Trajectory.h
>
24
#include <iostream>
25
#include <fstream>
26
#include <ArmarXCore/interface/observers/Serialization.h>
27
#include <ArmarXCore/interface/serialization/JSONSerialization.h>
28
#include <
ArmarXCore/util/json/JSONObject.h
>
29
#include <Ice/CommunicatorF.h>
30
31
//@Liran ich (Tim) habe es von DesignerTrajectory zu DesignerTrajectoryPtr geƤndert. Ich bekomme es so von dem Model
32
//fps habe ich wie besprochen entfernt
33
void
armarx::TrajectoryExporter::exportTrajectory
(std::vector<DesignerTrajectoryPtr> trajectories,
const
std::string file)
34
{
35
const
Ice::Current&
c
= Ice::emptyCurrent;
36
auto
communicator =
c
.adapter.get()->getCommunicator();
37
Ice::CommunicatorPtr
ic
=
Ice::CommunicatorPtr
(communicator);
38
JSONObject
jsonSerializer =
JSONObject
(
ic
);
39
//Serialize the trajectory using jsonSerializer
40
//trajectory->getFinalTrajectory()->serialize(&jsonSerializer);
41
//Output the serialized Trajectory as a string
42
const
std::string jsonString = jsonSerializer.
toString
();
43
44
//Stream the string to a file
45
std::ofstream output;
46
output.open(file);
47
output << jsonString;
48
output.close();
49
}
cyberglove_with_calib_22dof.ic
ic
Definition:
cyberglove_with_calib_22dof.py:22
JSONObject.h
armarx::JSONObject
The JSONObject class is used to represent and (de)serialize JSON objects.
Definition:
JSONObject.h:43
c
constexpr T c
Definition:
UnscentedKalmanFilterTest.cpp:43
TrajectoryExporter.h
armarx::JSONObject::toString
std::string toString(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition:
JSONObject.cpp:58
Ice::CommunicatorPtr
::IceInternal::Handle< ::Ice::Communicator > CommunicatorPtr
Definition:
IceManager.h:49
IceInternal::Handle< ::Ice::Communicator >
armarx::TrajectoryExporter::exportTrajectory
void exportTrajectory(std::vector< DesignerTrajectoryPtr > trajectories, const std::string file)
Exports a trajectory to the target file as a serialized instance of the Trajectory class.
Definition:
TrajectoryExporter.cpp:33
Trajectory.h
RobotComponents
gui-plugins
RobotTrajectoryDesignerGuiPlugin
ImportExport
TrajectoryExporter.cpp
Generated on Sat Oct 12 2024 09:14:13 for armarx_documentation by
1.8.17