YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
SimulatedWorld_nws_yarp.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026-2026 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef YARP_DEV_SIMULATEDWORDNWSYARP_H
7#define YARP_DEV_SIMULATEDWORDNWSYARP_H
8
9#include <vector>
10#include <iostream>
11#include <string>
12#include <sstream>
13#include <cmath>
14
15#include <yarp/os/Network.h>
16#include <yarp/os/Port.h>
17
18#include <yarp/sig/Vector.h>
19#include <yarp/sig/Pose6D.h>
20#include <yarp/sig/ColorRGB.h>
21
23#include <yarp/dev/PolyDriver.h>
26#include <yarp/dev/api.h>
27
28#include "ISimulatedWorldMsgs.h"
29
31
32// rpc commands
34{
35private:
36 std::mutex m_mutex;
37 yarp::dev::ISimulatedWorld* m_iSim{nullptr};
38
39public:
40 yarp::dev::ReturnValue makeSphere(const std::string& id_name, const double radius, const yarp::sig::Pose6D& pose, const yarp::sig::ColorRGB& color, const std::string& frame_name, const bool gravity_enable, const bool collision_enable) override;
41 yarp::dev::ReturnValue makeBox(const std::string& id_name, const double width, const double height, const double thickness, const yarp::sig::Pose6D& pose, const yarp::sig::ColorRGB& color, const std::string& frame_name, const bool gravity_enable, const bool collision_enable) override;
42 yarp::dev::ReturnValue makeCylinder(const std::string& id_name, const double radius, const double length, const yarp::sig::Pose6D& pose, const yarp::sig::ColorRGB& color, const std::string& frame_name, const bool gravity_enable, const bool collision_enable) override;
43 yarp::dev::ReturnValue makeFrame(const std::string& id_name, const double size, const yarp::sig::Pose6D& pose, const yarp::sig::ColorRGB& color, const std::string& frame_name, const bool gravity_enable, const bool collision_enable) override;
44 yarp::dev::ReturnValue makeModel(const std::string& id_name, const std::string& filename, const yarp::sig::Pose6D& pose, const std::string& frame_name, const bool gravity_enable, const bool collision_enable) override;
45 yarp::dev::ReturnValue makeActor(const std::string& id_name, const std::string& skin_filename, const std::string& actor_filename, const yarp::sig::Pose6D& pose) override;
46 yarp::dev::ReturnValue changeColor(const std::string& id, const yarp::sig::ColorRGB& color) override;
47 yarp::dev::ReturnValue setPose(const std::string& id, const yarp::sig::Pose6D& pose, const std::string& frame_name = "") override;
48 yarp::dev::ReturnValue enableGravity(const std::string& id, const bool enable) override;
49 yarp::dev::ReturnValue enableCollision(const std::string& id, const bool enable) override;
50 getPoseReturnValue getPose(const std::string& id, const std::string& frame_name) override;
51 yarp::dev::ReturnValue deleteObject(const std::string& id) override;
53 getListReturnValue getList() override;
54 yarp::dev::ReturnValue attach(const std::string& id, const std::string& link_name) override;
55 yarp::dev::ReturnValue detach(const std::string& id) override;
56 yarp::dev::ReturnValue rename(const std::string& old_name, const std::string& new_name) override;
57
60
61public:
62 std::mutex* getMutex() { return &m_mutex; }
63};
64
65
78{
79public:
82
83 bool open(yarp::os::Searchable &params) override;
84 bool close() override;
85
86private:
87 yarp::dev::ISimulatedWorld* m_Isim_p = nullptr;
88 std::unique_ptr<ISimulatedWorldMsgsImpl> m_msgsImpl;
89
90 //ports stuff
91 std::string m_rpcPortName;
92 yarp::os::Port m_rpcPort;
93
94 //public methods
95 bool read(yarp::os::ConnectionReader& connection) override;
96
97private:
98 //private methods
99 bool attach(yarp::dev::PolyDriver* driver) override;
100 bool detach() override;
101};
102
103#endif // YARP_DEV_SIMULATEDWORDNWSYARP_H
contains the definition of a Vector type
yarp::dev::ReturnValue enableCollision(const std::string &id, const bool enable) override
yarp::dev::ReturnValue makeBox(const std::string &id_name, const double width, const double height, const double thickness, const yarp::sig::Pose6D &pose, const yarp::sig::ColorRGB &color, const std::string &frame_name, const bool gravity_enable, const bool collision_enable) override
getPoseReturnValue getPose(const std::string &id, const std::string &frame_name) override
yarp::dev::ReturnValue makeSphere(const std::string &id_name, const double radius, const yarp::sig::Pose6D &pose, const yarp::sig::ColorRGB &color, const std::string &frame_name, const bool gravity_enable, const bool collision_enable) override
yarp::dev::ReturnValue rename(const std::string &old_name, const std::string &new_name) override
yarp::dev::ReturnValue makeModel(const std::string &id_name, const std::string &filename, const yarp::sig::Pose6D &pose, const std::string &frame_name, const bool gravity_enable, const bool collision_enable) override
yarp::dev::ReturnValue deleteObject(const std::string &id) override
yarp::dev::ReturnValue detach(const std::string &id) override
yarp::dev::ReturnValue setPose(const std::string &id, const yarp::sig::Pose6D &pose, const std::string &frame_name="") override
yarp::dev::ReturnValue changeColor(const std::string &id, const yarp::sig::ColorRGB &color) override
yarp::dev::ReturnValue enableGravity(const std::string &id, const bool enable) override
yarp::dev::ReturnValue makeFrame(const std::string &id_name, const double size, const yarp::sig::Pose6D &pose, const yarp::sig::ColorRGB &color, const std::string &frame_name, const bool gravity_enable, const bool collision_enable) override
~ISimulatedWorldMsgsImpl()=default
yarp::dev::ReturnValue attach(const std::string &id, const std::string &link_name) override
yarp::dev::ReturnValue makeCylinder(const std::string &id_name, const double radius, const double length, const yarp::sig::Pose6D &pose, const yarp::sig::ColorRGB &color, const std::string &frame_name, const bool gravity_enable, const bool collision_enable) override
getListReturnValue getList() override
yarp::dev::ReturnValue makeActor(const std::string &id_name, const std::string &skin_filename, const std::string &actor_filename, const yarp::sig::Pose6D &pose) override
yarp::dev::ReturnValue deleteAll() override
This class is the parameters parser for class SimulatedWorld_nws_yarp.
SimulatedWorld_nws_yarp: Device that expose a simulator engine (using the ISimulatedWorld interface) ...
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &params) override
Open the DeviceDriver.
Interface implemented by all device drivers.
ISimulatedWorld Interface.
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
An interface for reading from a network connection.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
A mini-server for network communication.
Definition Port.h:46
A base class for nested structures that can be searched.
Definition Searchable.h:31