Skip to content
Snippets Groups Projects
Commit 5d2d2f30 authored by ARMAR-7a User's avatar ARMAR-7a User
Browse files

changes from A7 pc1

parent 24955941
No related branches found
No related tags found
No related merge requests found
Pipeline #16089 passed
Showing
with 174 additions and 70 deletions
...@@ -54,8 +54,8 @@ namespace armarx ...@@ -54,8 +54,8 @@ namespace armarx
} }
bool bool
RobotNameService::registerRobot(const robot_name_service::dto::Robot& robot, RobotNameService::registerRobotInfo(const robot_name_service::dto::RobotInfo& robot,
const Ice::Current& current) const Ice::Current& current)
{ {
std::scoped_lock l(robotsMutex); std::scoped_lock l(robotsMutex);
ARMARX_INFO << "Register a new robot with name '" << robot.name << "' in RNS"; ARMARX_INFO << "Register a new robot with name '" << robot.name << "' in RNS";
...@@ -72,7 +72,7 @@ namespace armarx ...@@ -72,7 +72,7 @@ namespace armarx
} }
void void
RobotNameService::unregisterRobot(const std::string& name, const Ice::Current& current) RobotNameService::unregisterRobotInfo(const std::string& name, const Ice::Current& current)
{ {
std::scoped_lock l(robotsMutex); std::scoped_lock l(robotsMutex);
...@@ -82,8 +82,8 @@ namespace armarx ...@@ -82,8 +82,8 @@ namespace armarx
} }
} }
IceUtil::Optional<robot_name_service::dto::Robot> IceUtil::Optional<robot_name_service::dto::RobotInfo>
RobotNameService::getRobot(const std::string& name, const Ice::Current& current) RobotNameService::getRobotInfo(const std::string& name, const Ice::Current& current)
{ {
std::scoped_lock l(robotsMutex); std::scoped_lock l(robotsMutex);
......
...@@ -87,14 +87,14 @@ namespace armarx ...@@ -87,14 +87,14 @@ namespace armarx
// RobotNameServiceInterface interface // RobotNameServiceInterface interface
public: public:
bool registerRobot(const robot_name_service::dto::Robot& robot, bool registerRobotInfo(const robot_name_service::dto::RobotInfo& robot,
const Ice::Current& current) override; const Ice::Current& current) override;
void unregisterRobot(const std::string& name, const Ice::Current& current) override; void unregisterRobotInfo(const std::string& name, const Ice::Current& current) override;
IceUtil::Optional<robot_name_service::dto::Robot> IceUtil::Optional<robot_name_service::dto::RobotInfo>
getRobot(const std::string& name, const Ice::Current& current) override; getRobotInfo(const std::string& name, const Ice::Current& current) override;
private: private:
mutable std::mutex robotsMutex; mutable std::mutex robotsMutex;
std::map<std::string, robot_name_service::core::Robot> robots; std::map<std::string, robot_name_service::core::RobotInfo> robots;
}; };
} // namespace armarx } // namespace armarx
...@@ -27,10 +27,12 @@ ...@@ -27,10 +27,12 @@
#include <RobotAPI/interface/armem/mns.ice> #include <RobotAPI/interface/armem/mns.ice>
#include <RobotAPI/interface/skills/SkillManagerInterface.ice> #include <RobotAPI/interface/skills/SkillManagerInterface.ice>
#include <RobotAPI/interface/units/ForceTorqueUnit.ice>
#include <RobotAPI/interface/units/HandUnitInterface.ice> #include <RobotAPI/interface/units/HandUnitInterface.ice>
#include <RobotAPI/interface/units/KinematicUnitInterface.ice> #include <RobotAPI/interface/units/KinematicUnitInterface.ice>
#include <RobotAPI/interface/units/LocalizationUnitInterface.ice> #include <RobotAPI/interface/units/LocalizationUnitInterface.ice>
#include <RobotAPI/interface/units/PlatformUnitInterface.ice> #include <RobotAPI/interface/units/PlatformUnitInterface.ice>
#include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.ice>
module armarx module armarx
{ {
...@@ -39,24 +41,38 @@ module armarx ...@@ -39,24 +41,38 @@ module armarx
module dto module dto
{ {
struct Hand module location
{
enum Side
{
LEFT,
RIGHT,
UNKNOWN
};
};
struct TCPInfo
{ {
string name; string name;
string ft_name; string ft_name;
location::Side side;
HandUnitInterface* handUnitInterface; HandUnitInterface* handUnitInterface;
}; };
dictionary<string, Hand> Hands; // maps tcp name to tcp
dictionary<string, TCPInfo> TCPInfos;
struct Arm struct ArmInfo
{ {
string kinematicChainName; string kinematicChainName;
Hand hand; location::Side side;
TCPInfo tcpInfo;
}; };
dictionary<string, Arm> Arms; // maps kinematic chain name to arm
dictionary<string, ArmInfo> ArmInfos;
struct Robot struct RobotInfo
{ {
string name; string name;
armarx::data::PackagePath xmlPackagePath; armarx::data::PackagePath xmlPackagePath;
...@@ -66,12 +82,10 @@ module armarx ...@@ -66,12 +82,10 @@ module armarx
armarx::skills::manager::dti::SkillManagerInterface* skillManager; armarx::skills::manager::dti::SkillManagerInterface* skillManager;
// kinematic stuff. MAY BE EMPTY // kinematic stuff. MAY BE EMPTY
Arms arms; ArmInfos armInfos;
// units. MAY BE NULL // RobotUnit
armarx::KinematicUnitInterface* kinematicUnitInterface; armarx::RobotUnitInterface* robotUnit;
armarx::PlatformUnitInterface* platformUnitInterface;
armarx::LocalizationUnitInterface* localizationUnitInterface;
// TODO: Feel free to extend! // TODO: Feel free to extend!
}; };
...@@ -81,9 +95,9 @@ module armarx ...@@ -81,9 +95,9 @@ module armarx
{ {
interface RobotNameServiceInterface interface RobotNameServiceInterface
{ {
bool registerRobot(dto::Robot robot); bool registerRobotInfo(dto::RobotInfo robot);
void unregisterRobot(string name); void unregisterRobotInfo(string name);
optional(1) dto::Robot getRobot(string name); optional(1) dto::RobotInfo getRobotInfo(string name);
}; };
}; };
}; };
......
<!--This class contains the data structure for ObjectPose -->
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<AronTypeDefinition> <AronTypeDefinition>
<AronIncludes> <AronIncludes>
......
...@@ -19,6 +19,8 @@ namespace armarx::plugins ...@@ -19,6 +19,8 @@ namespace armarx::plugins
{ {
using namespace armarx::robot_name_service::client::constants; using namespace armarx::robot_name_service::client::constants;
ARMARX_INFO << "Got as config: " << properties.configJson;
nlohmann::json config = nlohmann::json::parse(properties.configJson); nlohmann::json config = nlohmann::json::parse(properties.configJson);
if (config.contains(CONFIG_ROBOT_NAME)) if (config.contains(CONFIG_ROBOT_NAME))
...@@ -53,7 +55,7 @@ namespace armarx::plugins ...@@ -53,7 +55,7 @@ namespace armarx::plugins
{ {
for (const auto& [k, config_arm] : config[CONFIG_ARMS].items()) for (const auto& [k, config_arm] : config[CONFIG_ARMS].items())
{ {
auto& arm = robot.arms[k]; auto& arm = robot.armInfos[k];
if (config_arm.contains(CONFIG_ARM_KINEMATIC_CHAIN_NAME)) if (config_arm.contains(CONFIG_ARM_KINEMATIC_CHAIN_NAME))
{ {
...@@ -109,7 +111,7 @@ namespace armarx::plugins ...@@ -109,7 +111,7 @@ namespace armarx::plugins
{ {
for (const auto& [k, config_arm] : config[CONFIG_ARMS].items()) for (const auto& [k, config_arm] : config[CONFIG_ARMS].items())
{ {
auto& arm = robot.arms[k]; auto& arm = robot.armInfos[k];
if (config_arm.contains(CONFIG_ARM_HAND)) if (config_arm.contains(CONFIG_ARM_HAND))
{ {
...@@ -126,7 +128,7 @@ namespace armarx::plugins ...@@ -126,7 +128,7 @@ namespace armarx::plugins
} }
// finally commit robot // finally commit robot
properties.rns->registerRobot(robot.toIce()); properties.rns->registerRobotInfo(robot.toIce());
} }
void void
...@@ -139,7 +141,7 @@ namespace armarx::plugins ...@@ -139,7 +141,7 @@ namespace armarx::plugins
void void
RobotNameServiceComponentPlugin::preOnDisconnectComponent() RobotNameServiceComponentPlugin::preOnDisconnectComponent()
{ {
properties.rns->unregisterRobot(robot.name); properties.rns->unregisterRobotInfo(robot.name);
} }
} // namespace armarx::plugins } // namespace armarx::plugins
...@@ -60,7 +60,7 @@ namespace armarx::plugins ...@@ -60,7 +60,7 @@ namespace armarx::plugins
armarx::robot_name_service::dti::RobotNameServiceInterfacePrx rns; armarx::robot_name_service::dti::RobotNameServiceInterfacePrx rns;
} properties; } properties;
armarx::robot_name_service::core::Robot robot; armarx::robot_name_service::core::RobotInfo robot;
friend class armarx::RobotNameServiceComponentPluginUser; friend class armarx::RobotNameServiceComponentPluginUser;
}; };
......
...@@ -17,8 +17,18 @@ armarx_add_library( ...@@ -17,8 +17,18 @@ armarx_add_library(
SOURCES SOURCES
Robot.cpp Robot.cpp
aron_conversions.cpp
HEADERS HEADERS
Robot.h Robot.h
aron_conversions.h
)
armarx_enable_aron_file_generation_for_target(
TARGET_NAME
"${LIB_NAME}"
ARON_FILES
aron/Robot.xml
) )
add_library(RobotAPI::robot_name_service_core ALIAS robot_name_service_core) add_library(RobotAPI::robot_name_service_core ALIAS robot_name_service_core)
...@@ -4,17 +4,17 @@ namespace armarx::robot_name_service::core ...@@ -4,17 +4,17 @@ namespace armarx::robot_name_service::core
{ {
void void
Hand::fromIce(const dto::Hand& r) TCPInfo::fromIce(const dto::TCPInfo& r)
{ {
name = r.name; name = r.name;
ft_name = r.ft_name; ft_name = r.ft_name;
handUnitInterface = r.handUnitInterface; handUnitInterface = r.handUnitInterface;
} }
dto::Hand dto::TCPInfo
Hand::toIce() const TCPInfo::toIce() const
{ {
dto::Hand r; dto::TCPInfo r;
r.name = name; r.name = name;
r.ft_name = ft_name; r.ft_name = ft_name;
r.handUnitInterface = handUnitInterface; r.handUnitInterface = handUnitInterface;
...@@ -22,57 +22,53 @@ namespace armarx::robot_name_service::core ...@@ -22,57 +22,53 @@ namespace armarx::robot_name_service::core
} }
void void
Arm::fromIce(const dto::Arm& r) ArmInfo::fromIce(const dto::ArmInfo& r)
{ {
kinematicChainName = r.kinematicChainName; kinematicChainName = r.kinematicChainName;
hand.fromIce(r.hand); hand.fromIce(r.tcpInfo);
} }
dto::Arm dto::ArmInfo
Arm::toIce() const ArmInfo::toIce() const
{ {
dto::Arm r; dto::ArmInfo r;
r.kinematicChainName = kinematicChainName; r.kinematicChainName = kinematicChainName;
r.hand = hand.toIce(); r.tcpInfo = hand.toIce();
return r; return r;
} }
void void
Robot::fromIce(const dto::Robot& r) RobotInfo::fromIce(const dto::RobotInfo& r)
{ {
name = r.name; name = r.name;
xmlPackagePath = r.xmlPackagePath; xmlPackagePath = r.xmlPackagePath;
memoryNameSystem = armarx::armem::client::MemoryNameSystem(r.memoryNameSystem); memoryNameSystem = armarx::armem::client::MemoryNameSystem(r.memoryNameSystem);
skillManager = r.skillManager; skillManager = r.skillManager;
arms.clear(); armInfos.clear();
for (const auto& [k, a] : r.arms) for (const auto& [k, a] : r.armInfos)
{ {
arms[k].fromIce(a); armInfos[k].fromIce(a);
} }
kinematicUnitInterface = r.kinematicUnitInterface; robotUnit = r.robotUnit;
platformUnitInterface = r.platformUnitInterface;
localizationUnitInterface = r.localizationUnitInterface;
} }
dto::Robot dto::RobotInfo
Robot::toIce() const RobotInfo::toIce() const
{ {
dto::Robot r; dto::RobotInfo r;
r.name = name; r.name = name;
r.xmlPackagePath = xmlPackagePath; r.xmlPackagePath = xmlPackagePath;
r.memoryNameSystem = memoryNameSystem.getMemoryNameSystem(); r.memoryNameSystem = memoryNameSystem.getMemoryNameSystem();
r.skillManager = skillManager; r.skillManager = skillManager;
for (const auto& [k, a] : arms) for (const auto& [k, a] : armInfos)
{ {
r.arms[k] = a.toIce(); r.armInfos[k] = a.toIce();
} }
r.kinematicUnitInterface = kinematicUnitInterface; r.robotUnit = robotUnit;
r.platformUnitInterface = platformUnitInterface;
r.localizationUnitInterface = localizationUnitInterface;
return r; return r;
} }
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
namespace armarx::robot_name_service::core namespace armarx::robot_name_service::core
{ {
class Hand class TCPInfo
{ {
public: public:
void fromIce(const armarx::robot_name_service::dto::Hand& r); void fromIce(const armarx::robot_name_service::dto::TCPInfo& r);
armarx::robot_name_service::dto::Hand toIce() const; armarx::robot_name_service::dto::TCPInfo toIce() const;
public: public:
std::string name; std::string name;
...@@ -22,22 +22,22 @@ namespace armarx::robot_name_service::core ...@@ -22,22 +22,22 @@ namespace armarx::robot_name_service::core
armarx::HandUnitInterfacePrx handUnitInterface; armarx::HandUnitInterfacePrx handUnitInterface;
}; };
class Arm class ArmInfo
{ {
public: public:
void fromIce(const armarx::robot_name_service::dto::Arm& r); void fromIce(const armarx::robot_name_service::dto::ArmInfo& r);
armarx::robot_name_service::dto::Arm toIce() const; armarx::robot_name_service::dto::ArmInfo toIce() const;
public: public:
std::string kinematicChainName; std::string kinematicChainName;
Hand hand; TCPInfo hand;
}; };
class Robot class RobotInfo
{ {
public: public:
void fromIce(const armarx::robot_name_service::dto::Robot& r); void fromIce(const armarx::robot_name_service::dto::RobotInfo& r);
armarx::robot_name_service::dto::Robot toIce() const; armarx::robot_name_service::dto::RobotInfo toIce() const;
public: public:
// header // header
...@@ -49,11 +49,9 @@ namespace armarx::robot_name_service::core ...@@ -49,11 +49,9 @@ namespace armarx::robot_name_service::core
armarx::skills::manager::dti::SkillManagerInterfacePrx skillManager; armarx::skills::manager::dti::SkillManagerInterfacePrx skillManager;
// kinematic stuff // kinematic stuff
std::map<std::string, Arm> arms; std::map<std::string, ArmInfo> armInfos;
// units // units
armarx::KinematicUnitInterfacePrx kinematicUnitInterface; armarx::RobotUnitInterfacePrx robotUnit;
armarx::PlatformUnitInterfacePrx platformUnitInterface;
armarx::LocalizationUnitInterfacePrx localizationUnitInterface;
}; };
} // namespace armarx::robot_name_service::core } // namespace armarx::robot_name_service::core
<?xml version="1.0" encoding="UTF-8" ?>
<AronTypeDefinition>
<GenerateTypes>
<Object name='armarx::robot_name_service::arondto::TCPInfo'>
<ObjectChild key='name'>
<string />
</ObjectChild>
</Object>
<Object name='armarx::robot_name_service::arondto::TCPInfo'>
<ObjectChild key='name'>
<string />
</ObjectChild>
<ObjectChild key='ft_name'>
<string />
</ObjectChild>
</Object>
<Object name='armarx::robot_name_service::arondto::ArmInfo'>
<ObjectChild key='kinematicChainName'>
<string />
</ObjectChild>
</Object>
<Object name='armarx::robot_name_service::arondto::RobotInfo'>
<ObjectChild key='name'>
<string />
</ObjectChild>
</Object>
</GenerateTypes>
</AronTypeDefinition>
#include "aron_conversions.h"
namespace armarx::robot_name_service::core
{
} // namespace armarx::robot_name_service::core
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <RobotAPI/interface/robot_name_service/RobotNameServiceInterface.h>
#include <RobotAPI/libraries/armem/client/MemoryNameSystem.h>
namespace armarx::robot_name_service::core
{
} // namespace armarx::robot_name_service::core
...@@ -18,8 +18,10 @@ armarx_add_library( ...@@ -18,8 +18,10 @@ armarx_add_library(
SOURCES SOURCES
plugins.cpp plugins.cpp
segments/RobotSegment.cpp
HEADERS HEADERS
plugins.h plugins.h
segments/RobotSegment.h
) )
add_library(RobotAPI::robot_name_service_server ALIAS robot_name_service_server) add_library(RobotAPI::robot_name_service_server ALIAS robot_name_service_server)
#include "RobotSegment.h"
namespace armarx::robot_name_service::server::segment
{
} // namespace armarx::robot_name_service::server::segment
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <RobotAPI/libraries/armem/client/MemoryNameSystem.h>
#include <RobotAPI/libraries/armem/server/segment/SpecializedCoreSegment.h>
namespace armarx::robot_name_service::server::segment
{
class RobotInfoCoreSegment : public armarx::armem::server::segment::SpecializedCoreSegment
{
public:
};
} // namespace armarx::robot_name_service::server::segment
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