Skip to content
Snippets Groups Projects
VirtualRobotReaderExampleClient.h 2.9 KiB
Newer Older

/*
 * This file is part of ArmarX.
 *
 * 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/>.
 *
 * @author     Fabian Reister ( fabian dot reister at kit dot edu )
 * @date       2021
 * @copyright  http://www.gnu.org/licenses/gpl-2.0.txt
 *             GNU General Public License
 */

#pragma once


// ArmarX
#include <ArmarXCore/core/Component.h>
#include <ArmarXCore/interface/observers/ObserverInterface.h>
#include <ArmarXCore/util/tasks.h>
#include <ArmarXGui/libraries/ArmarXGuiComponentPlugins/LightweightRemoteGuiComponentPlugin.h>

// RobotAPI
#include <RobotAPI/interface/armem/server/MemoryInterface.h>
#include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
Rainer Kartmann's avatar
Rainer Kartmann committed
#include <RobotAPI/libraries/armem/client/plugins.h>
#include <RobotAPI/libraries/armem/core/wm/memory_definitions.h>

#include <RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.h>

namespace armarx::robot_state
{

    /**
     * @defgroup Component-ExampleClient ExampleClient
     * @ingroup RobotAPI-Components
     * A description of the component ExampleClient.
     *
     * @class ExampleClient
     * @ingroup Component-ExampleClient
     * @brief Brief description of class ExampleClient.
     *
     * Detailed description of class ExampleClient.
     */
    class VirtualRobotReaderExampleClient :
        virtual public armarx::Component,
        virtual public armarx::armem::client::ComponentPluginUser
    {
    public:
        VirtualRobotReaderExampleClient();

        /// @see armarx::ManagedIceObject::getDefaultName()
        std::string getDefaultName() const override;

    protected:

        armarx::PropertyDefinitionsPtr createPropertyDefinitions() override;

        void onInitComponent() override;
        void onConnectComponent() override;
        void onDisconnectComponent() override;
        void onExitComponent() override;

        void run();


    private:

        struct Properties
        {
            std::string robotName{"Armar6"};
            float updateFrequency{10.F};
        } p;

        armarx::PeriodicTask<VirtualRobotReaderExampleClient>::pointer_type task;

        armarx::DebugObserverInterfacePrx debugObserver;

        // std::unique_ptr<::armarx::armem::articulated_object::Writer> articulatedObjectWriter;

        armem::robot_state::VirtualRobotReader virtualRobotReader;

        std::shared_ptr<VirtualRobot::Robot> virtualRobot{nullptr};