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
24
#include <fstream>
25
#include <iostream>
26
27
#include <Ice/CommunicatorF.h>
28
29
#include <ArmarXCore/interface/observers/Serialization.h>
30
#include <ArmarXCore/interface/serialization/JSONSerialization.h>
31
#include <
ArmarXCore/util/json/JSONObject.h
>
32
33
#include <
RobotAPI/libraries/core/Trajectory.h
>
34
35
//@Liran ich (Tim) habe es von DesignerTrajectory zu DesignerTrajectoryPtr geƤndert. Ich bekomme es so von dem Model
36
//fps habe ich wie besprochen entfernt
37
void
38
armarx::TrajectoryExporter::exportTrajectory
(std::vector<DesignerTrajectoryPtr> trajectories,
39
const
std::string file)
40
{
41
const
Ice::Current&
c
= Ice::emptyCurrent;
42
auto
communicator =
c
.adapter.get()->getCommunicator();
43
Ice::CommunicatorPtr
ic
=
Ice::CommunicatorPtr
(communicator);
44
JSONObject
jsonSerializer =
JSONObject
(
ic
);
45
//Serialize the trajectory using jsonSerializer
46
//trajectory->getFinalTrajectory()->serialize(&jsonSerializer);
47
//Output the serialized Trajectory as a string
48
const
std::string jsonString = jsonSerializer.
toString
();
49
50
//Stream the string to a file
51
std::ofstream output;
52
output.open(file);
53
output << jsonString;
54
output.close();
55
}
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:46
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:48
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:38
Trajectory.h
RobotComponents
gui-plugins
RobotTrajectoryDesignerGuiPlugin
ImportExport
TrajectoryExporter.cpp
Generated on Sat Mar 29 2025 09:17:33 for armarx_documentation by
1.8.17