Skip to content
Snippets Groups Projects
Commit 96f3432a authored by Fabian Tërnava's avatar Fabian Tërnava
Browse files

updated aronGenerator executable and tested automatic aron cmake generator macro

parent 7c6bd448
No related branches found
No related tags found
No related merge requests found
Showing
with 250 additions and 57 deletions
......@@ -27,12 +27,12 @@
# ArmarX.ArMemGlobalStorage.EnableProfiling = false
# ArmarX.ArMemGlobalStorage.LocalMemoryHostnames: The hostnames of the local memories
# ArmarX.ArMemGlobalStorage.LocalMemoryHostnames: The hostnames of the local memories, comma separated
# Attributes:
# - Default: Default value not mapped.
# - Default: ""
# - Case sensitivity: yes
# - Required: no
# ArmarX.ArMemGlobalStorage.LocalMemoryHostnames = Default value not mapped.
ArmarX.ArMemGlobalStorage.LocalMemoryHostnames = "i61nb072"
# ArmarX.ArMemGlobalStorage.MinimumLoggingLevel: Local logging level only for this component
......
armarx_component_set_name("AronArmemGeneratorApp")
set(COMPONENT_LIBS aron armem)
armarx_component_set_name("AronGeneratorApp")
set(COMPONENT_LIBS aron)
armarx_add_component_executable(main.cpp)
......@@ -29,7 +29,7 @@
#include <boost/algorithm/string.hpp>
// CXXOPTS
#include <RobotAPI/applications/AronArmemGenerator/cxxopts.hpp>
#include <RobotAPI/applications/AronGenerator/cxxopts.hpp>
// ArmarX Executable
//#include <ArmarXCore/core/application/Application.h>
......@@ -76,7 +76,18 @@ int main(int argc, char* argv[])
if (verbose)
{
std::cout << "Parse the XML file...";
std::cout << "Welcome to the AronGenerator!" << std::endl;
std::cout << "Received the following parameters:" << std::endl;
std::cout << "\tFile: " << filename << std::endl;
std::cout << "\tOutput: " << output << std::endl;
std::cout << std::endl;
}
std::cout << "Generating a new cpp file out of <" + filename + ">" << std::endl;
if (verbose)
{
std::cout << "Parsing the XML file...";
}
std::filesystem::path input_file(filename);
......@@ -85,7 +96,8 @@ int main(int argc, char* argv[])
std::cerr << "The file you passed has the wrong type." << std::endl;
}
std::string new_name_with_extension = input_file.filename().replace_extension(".h").string();
std::string new_name_with_extension = input_file.filename().replace_extension("").string();
new_name_with_extension += ".aron.generated.h";
reader.parseFile(input_file);
if (verbose)
......@@ -98,7 +110,7 @@ int main(int argc, char* argv[])
if (verbose)
{
std::cout << "Run the type class generator...";
std::cout << "Running the type class generator...";
}
writer.generateTypeClasses(reader.getGenerateTypes());
......@@ -176,6 +188,7 @@ int main(int argc, char* argv[])
}
ofs.close();
std::cout << "Finished generating <" + output_current_file + ">" << std::endl;
}
catch (const cxxopts::OptionException& e)
{
......
add_subdirectory(AronArmemGenerator)
add_subdirectory(AronGenerator)
add_subdirectory(WeissHapticUnit)
add_subdirectory(RobotControlUI)
add_subdirectory(RobotStateComponent)
......
......@@ -33,23 +33,23 @@ namespace armarx
{
armarx::PropertyDefinitionsPtr ArMemLocalStorage::createPropertyDefinitions()
{
PropertyDefinitionsPtr defs{new ComponentPropertyDefinitions{getConfigIdentifier()}};
PropertyDefinitionsPtr defs(new ComponentPropertyDefinitions(getConfigIdentifier(), false));
defs->optional(hostname_to_use, "MockedHostname", "Use a hostname mock. Leave empty to use the real one.");
defs->optional(maximum_segments, "MaximumNumberOfSegments", "Maximum number of segments (<0 means infinite)");
defs->optional(maximum_entries_per_segment, "MaximumEntriesPerSegment", "Maximum number of accepted datatypes per segment (<0 means infinite)");
defs->optional(maximum_entries_per_datatype, "MaximumEntriesPerDatatype", "Maximum number of accepted commits per datatype (<0 means infinite)");
return defs;
}
std::string ArMemLocalStorage::getDefaultName() const
{
std::string hostname = getMyHostname();
return GenerateLocalMemoryObjectNameFromHostname(hostname);
return GenerateLocalMemoryObjectNameFromHostname(hostname_to_use);
}
ArMemLocalStorage::ArMemLocalStorage() :
armarx::Component(),
armarx::armem::ArMemBase(),
hostname_to_use(getMyHostname()),
maximum_segments(-1),
maximum_entries_per_segment(-1),
maximum_entries_per_datatype(-1)
......@@ -144,8 +144,8 @@ namespace armarx
void ArMemLocalStorage::checkStorageIntegrity() const
{
if (indexed_storage.size() != timestamped_storage.size() ||
indexed_storage.size() != hashed_storage.size() ||
timestamped_storage.size() != hashed_storage.size())
indexed_storage.size() != hashed_storage.size() ||
timestamped_storage.size() != hashed_storage.size())
{
throw LocalException("The memory is in an invalid state. The storages have different sizes! Please Check!");
}
......@@ -164,27 +164,27 @@ namespace armarx
}
ArMemCommitPtr ArMemLocalStorage::getLatestCommitFromSegment(const std::string& segment, const Ice::Current &)
ArMemCommitPtr ArMemLocalStorage::getLatestCommitFromSegment(const std::string& segment, const Ice::Current&)
{
int index = indexed_storage[segment].size() -1;
if(index >= 0)
int index = indexed_storage[segment].size() - 1;
if (index >= 0)
{
return indexed_storage[segment][index];
}
return nullptr;
}
ArMemCommitPtr ArMemLocalStorage::getNextCommitFromSegmentForTimestamp(const std::string &, Ice::Long, const Ice::Current &)
ArMemCommitPtr ArMemLocalStorage::getNextCommitFromSegmentForTimestamp(const std::string&, Ice::Long, const Ice::Current&)
{
return nullptr;
}
TimestampedArMemCommitList ArMemLocalStorage::getAllCommitsBetweenTimestampsFromSegment(const std::string &, Ice::Long, Ice::Long, const Ice::Current &)
TimestampedArMemCommitList ArMemLocalStorage::getAllCommitsBetweenTimestampsFromSegment(const std::string&, Ice::Long, Ice::Long, const Ice::Current&)
{
return {};
}
TimestampedArMemCommitList ArMemLocalStorage::getAllCommitsFromSegment(const std::string &, const Ice::Current &)
TimestampedArMemCommitList ArMemLocalStorage::getAllCommitsFromSegment(const std::string&, const Ice::Current&)
{
return {};
}
......
......@@ -81,6 +81,8 @@ namespace armarx
std::map<std::string, TimestampedDataTypeStorage> timestamped_storage;
std::map<std::string, HashedDataTypeStorage> hashed_storage;
std::string hostname_to_use;
long maximum_segments;
long maximum_entries_per_segment;
long maximum_entries_per_datatype;
......
SET(TEST_NAME aronTest)
# Libs required for the tests
SET(LIBS ${LIBS} ArmarXCore aron)
SET(ARON_XML_FILES
xmls/HumanPose.xml
)
generateAronCppInterface()
armarx_add_test(aronTest aronTest.cpp "${LIBS}")
armarx_add_test(${TEST_NAME} aronTest.cpp "${LIBS}")
/*
* This file is part of ArmarX.
*
* Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
* Karlsruhe Institute of Technology (KIT), all rights reserved.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*************************************************************************
* WARNING: This file is autogenerated.
* Original file: /home/fabian/Software/ArmarX/RobotAPI/source/RobotAPI/libraries/aron/test/xmls/HumanPose.xml
* Timestamp of generation: Mon Aug 31 17:00:22 2020
* Please do not edit since your changes may be overwritten on the next generation
* If you have any questions please contact: Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
*************************************************************************
*/
#ifndef ARONTESTSEGMENT__NATURALIKRESULT__ARON_TYPE_DEFINITION_INCLUDE_GUARD
#define ARONTESTSEGMENT__NATURALIKRESULT__ARON_TYPE_DEFINITION_INCLUDE_GUARD
#include <string>
#include <vector>
#include <map>
#include <Eigen/Core>
#include <RobotAPI/interface/aron.h>
#include <RobotAPI/libraries/aron/codegenerator/AronCppClass.h>
#include <RobotAPI/libraries/aron/io/classWriters/AronDataNavigatorWriter/AronDataNavigatorWriter.h>
#include <RobotAPI/libraries/aron/io/classReaders/AronDataNavigatorReader/AronDataNavigatorReader.h>
namespace armarx
{
class NaturalIKResult
: virtual public armarx::aron::codegeneration::AronCppClass
{
public:
std::vector<float> jointValues;
bool reached;
public:
NaturalIKResult()
{
initialize();
reset();
}
public:
/**
* @brief operator==() - This method checks whether all values equal another instance.
* @param i - The other instance
* @return - true, if all members are the same, false otherwise
*/
bool operator==(const armarx::NaturalIKResult& i) const
{
if ( not (jointValues == i.jointValues))
return false;
if ( not (reached == i.reached))
return false;
return true;
}
/**
* @brief reset() - This method resets all member variables to default.
* @return - nothing
*/
virtual void reset() override
{
jointValues.clear();
reached = {};
}
/**
* @brief initialize() - This method initializeses special base-class members.
* @return - nothing
*/
virtual void initialize() override
{
// setup aronType
std::map<std::string, armarx::aron::AronAbstractType::PointerType> aronTypeRoot_objectiteratorcontainer;
armarx::aron::AronFloatType::PointerType aronTypeRoot_jointValues_listtype = armarx::aron::AronFloatType::PointerType(new armarx::aron::AronFloatType());
armarx::aron::AronListType::PointerType aronTypeRoot_jointValues = armarx::aron::AronListType::PointerType(new armarx::aron::AronListType(aronTypeRoot_jointValues_listtype));
aronTypeRoot_objectiteratorcontainer["jointValues"] = aronTypeRoot_jointValues;
armarx::aron::AronBoolType::PointerType aronTypeRoot_reached = armarx::aron::AronBoolType::PointerType(new armarx::aron::AronBoolType());
aronTypeRoot_objectiteratorcontainer["reached"] = aronTypeRoot_reached;
armarx::aron::AronObjectType::PointerType aronTypeRoot = armarx::aron::AronObjectType::PointerType(new armarx::aron::AronObjectType("armarx::NaturalIKResult", aronTypeRoot_objectiteratorcontainer));
aronType = aronTypeRoot;
}
/**
* @brief write() - This method returns a new type from the member data types using a writer implementation.
* @param w - The writer implementation
* @return - the result of the writer implementation
*/
virtual void write(armarx::aron::io::AronWriter& w) const override
{
w.writeStartDict();
w.writeKey("jointValues");
w.writeStartList();
for(unsigned int jointValues_listiterator = 0; jointValues_listiterator < jointValues.size(); ++jointValues_listiterator)
{
w.writeFloat(jointValues[jointValues_listiterator]);
}
w.writeEndList();
w.writeKey("reached");
w.writeBool(reached);
w.writeEndDict();
}
/**
* @brief read() - This method sets the struct members to new values given in a reader implementation.
* @param r - The reader implementation
* @return - nothing
*/
virtual void read(armarx::aron::io::AronReader& r) override
{
reset();
r.readStartDict();
r.readMember("jointValues");
r.readStartList();
while(!r.readEndList())
{
float jointValues_listiterator;
jointValues_listiterator = r.readFloat();
jointValues.push_back(jointValues_listiterator);
}
r.readMember("reached");
reached = r.readBool();
r.readEndDict();
}
/**
* @brief specializedWrite() - This method returns a new type from the member data types using a writer implementation.
* @return - the result of the writer implementation
*/
armarx::aron::AronDataPtr toAron() const
{
armarx::aron::io::AronDataNavigatorWriter writer;
this->write(writer);
return writer.getResult();
}
/**
* @brief specializedRead() - This method sets the struct members to new values given in a reader implementation.
* @return - nothing
*/
void fromAron(const armarx::aron::AronDataPtr& input)
{
armarx::aron::io::AronDataNavigatorReader reader(input);
this->read(reader);
}
}; // class NaturalIKResult
} // namespace armarx
#endif // ARONTESTSEGMENT__NATURALIKRESULT__ARON_TYPE_DEFINITION_INCLUDE_GUARD
......@@ -46,6 +46,8 @@
#include "generated/PrimitiveTest.h"
#include "generated/ObjectTest.h"
#include "aron/humanPose.generated.aron.h"
#include <Eigen/Core>
......
/*
* This file is part of ArmarX.
*
* Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
* Karlsruhe Institute of Technology (KIT), all rights reserved.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*************************************************************************
* WARNING: This file is autogenerated.
* Original file: /home/fabian/Software/ArmarX/RobotAPI/source/RobotAPI/libraries/aron/test/xmls/NaturalIK.xml
* Please do not edit since your changes may be overwritten on the next generation
* If you have any questions please contact: Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
*************************************************************************
*/
/*
* This file is part of ArmarX.
*
* Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
* Karlsruhe Institute of Technology (KIT), all rights reserved.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*************************************************************************
* WARNING: This file is autogenerated.
* Original file: /home/fabian/Software/ArmarX/RobotAPI/source/RobotAPI/libraries/aron/test/xmls/NaturalIK.xml
* Timestamp of generation: Mon Aug 31 14:07:08 2020
* Please do not edit since your changes may be overwritten on the next generation
* If you have any questions please contact: Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
*************************************************************************
*/
#ifndef ARONTESTSEGMENT__NATURALIKRESULT__ARON_TYPE_DEFINITION_INCLUDE_GUARD
......@@ -47,14 +48,14 @@ namespace armarx
public:
std::vector<float> jointValues;
bool reached;
public:
NaturalIKResult()
{
initialize();
reset();
}
public:
/**
* @brief operator==() - This method checks whether all values equal another instance.
......@@ -63,10 +64,14 @@ namespace armarx
*/
bool operator==(const armarx::NaturalIKResult& i) const
{
if ( not (jointValues == i.jointValues))
return false;
if ( not (reached == i.reached))
return false;
if (not(jointValues == i.jointValues))
{
return false;
}
if (not(reached == i.reached))
{
return false;
}
return true;
}
/**
......@@ -104,7 +109,7 @@ namespace armarx
w.writeStartDict();
w.writeKey("jointValues");
w.writeStartList();
for(unsigned int jointValues_listiterator = 0; jointValues_listiterator < jointValues.size(); ++jointValues_listiterator)
for (unsigned int jointValues_listiterator = 0; jointValues_listiterator < jointValues.size(); ++jointValues_listiterator)
{
w.writeFloat(jointValues[jointValues_listiterator]);
}
......@@ -121,11 +126,11 @@ namespace armarx
virtual void read(armarx::aron::io::AronReader& r) override
{
reset();
r.readStartDict();
r.readMember("jointValues");
r.readStartList();
while(!r.readEndList())
while (!r.readEndList())
{
float jointValues_listiterator;
jointValues_listiterator = r.readFloat();
......
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