YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeSimulatedWorld Class Reference

fakeSimulatedWorld : fake device implementing the ISimulatedWorld interface. More...

#include <fake/fakeSimulatedWorld/FakeSimulatedWorld.h>

+ Inheritance diagram for FakeSimulatedWorld:

Public Member Functions

 FakeSimulatedWorld ()
 
 FakeSimulatedWorld (const FakeSimulatedWorld &)=delete
 
 FakeSimulatedWorld (FakeSimulatedWorld &&)=delete
 
FakeSimulatedWorld & operator= (const FakeSimulatedWorld &)=delete
 
FakeSimulatedWorld & operator= (FakeSimulatedWorld &&)=delete
 
 ~FakeSimulatedWorld () override
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver.
 
bool close () override
 Close the DeviceDriver.
 
yarp::dev::ReturnValue makeSphere (std::string id, double radius, yarp::sig::Pose6D pose, yarp::sig::ColorRGB color, std::string frame_name, bool gravity_enable, bool collision_enable) override
 Make a sphere.
 
yarp::dev::ReturnValue makeBox (std::string id, double width, double height, double thickness, yarp::sig::Pose6D pose, yarp::sig::ColorRGB color, std::string frame_name, bool gravity_enable, bool collision_enable) override
 Make a box.
 
yarp::dev::ReturnValue makeCylinder (std::string id, double radius, double length, yarp::sig::Pose6D pose, yarp::sig::ColorRGB color, std::string frame_name, bool gravity_enable, bool collision_enable) override
 Make a cylinder.
 
yarp::dev::ReturnValue makeFrame (std::string id, double size, yarp::sig::Pose6D pose, yarp::sig::ColorRGB color, std::string frame_name, bool gravity_enable, bool collision_enable) override
 Make a reference frame (a 3D model with 3 arrows representing the axes)
 
yarp::dev::ReturnValue makeModel (std::string id, std::string filename, yarp::sig::Pose6D pose, std::string frame_name, bool gravity_enable, bool collision_enable) override
 Create a model from a file.
 
yarp::dev::ReturnValue makeActor (std::string id, std::string skin_filename, std::string animation_filename, yarp::sig::Pose6D pose) override
 Create an actor.
 
yarp::dev::ReturnValue changeColor (std::string id, yarp::sig::ColorRGB color) override
 Change the color of an object.
 
yarp::dev::ReturnValue setPose (std::string id, yarp::sig::Pose6D pose, std::string frame_name) override
 Set new object pose.
 
yarp::dev::ReturnValue enableGravity (std::string id, bool enable) override
 Enable/disables gravity for an object.
 
yarp::dev::ReturnValue enableCollision (std::string id, bool enable) override
 Enable/disables collision detection for an object.
 
yarp::dev::ReturnValue getPose (std::string id, yarp::sig::Pose6D &pose, std::string frame_name) override
 Get object pose.
 
yarp::dev::ReturnValue deleteObject (std::string id) override
 Delete an object.
 
yarp::dev::ReturnValue deleteAll () override
 Delete all objects in the world.
 
yarp::dev::ReturnValue getList (std::vector< std::string > &names) override
 List id of all objects that have been added to the world.
 
yarp::dev::ReturnValue attach (std::string id, std::string link_name) override
 Attach an object to a link of another object.
 
yarp::dev::ReturnValue detach (std::string id) override
 Detach a previously attached object.
 
yarp::dev::ReturnValue rename (std::string old_name, std::string new_name) override
 Change the names of an object.
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 DeviceDriver ()
 
 DeviceDriver (const DeviceDriver &other)=delete
 
 DeviceDriver (DeviceDriver &&other) noexcept=delete
 
DeviceDriver & operator= (const DeviceDriver &other)=delete
 
DeviceDriver & operator= (DeviceDriver &&other) noexcept=delete
 
virtual ~DeviceDriver ()
 
virtual std::string id () const
 Return the id assigned to the PolyDriver.
 
virtual void setId (const std::string &id)
 Set the id for this device.
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver.
 
virtual DeviceDriver * getImplementation ()
 Some drivers are bureaucrats, pointing at others.
 
- Public Member Functions inherited from yarp::os::PeriodicThread
 PeriodicThread (double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No, PeriodicThreadClock clockAccuracy=PeriodicThreadClock::Relative)
 Constructor.
 
 PeriodicThread (double period, PeriodicThreadClock clockAccuracy)
 Constructor.
 
virtual ~PeriodicThread ()
 
bool start ()
 Call this to start the thread.
 
void step ()
 Call this to "step" the thread rather than starting it.
 
void stop ()
 Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() called).
 
void askToStop ()
 Stop the thread.
 
bool isRunning () const
 Returns true when the thread is started, false otherwise.
 
bool isSuspended () const
 Returns true when the thread is suspended, false otherwise.
 
bool setPeriod (double period)
 Set the (new) period of the thread.
 
double getPeriod () const
 Return the current period of the thread.
 
void suspend ()
 Suspend the thread, the thread keeps running by doLoop is never executed.
 
void resume ()
 Resume the thread if previously suspended.
 
void resetStat ()
 Reset thread statistics.
 
double getEstimatedPeriod () const
 Return estimated period since last reset.
 
void getEstimatedPeriod (double &av, double &std) const
 Return estimated period since last reset.
 
unsigned int getIterations () const
 Return the number of iterations performed since last reset.
 
double getEstimatedUsed () const
 Return the estimated duration of the run() function since last reset.
 
void getEstimatedUsed (double &av, double &std) const
 Return estimated duration of the run() function since last reset.
 
int setPriority (int priority, int policy=-1)
 Set the priority and scheduling policy of the thread, if the OS supports that.
 
int getPriority () const
 Query the current priority of the thread, if the OS supports that.
 
int getPolicy () const
 Query the current scheduling policy of the thread, if the OS supports that.
 
- Public Member Functions inherited from yarp::dev::ISimulatedWorld
virtual ~ISimulatedWorld ()
 Destructor.
 
- Public Member Functions inherited from FakeSimulatedWorld_ParamsParser
 FakeSimulatedWorld_ParamsParser ()
 
 ~FakeSimulatedWorld_ParamsParser () override=default
 
bool parseParams (const yarp::os::Searchable &config) override
 Parse the DeviceDriver parameters.
 
std::string getDeviceClassName () const override
 Get the name of the DeviceDriver class.
 
std::string getDeviceName () const override
 Get the name of the device (i.e.
 
std::string getDocumentationOfDeviceParams () const override
 Get the documentation of the DeviceDriver's parameters.
 
std::vector< std::string > getListOfParams () const override
 Return a list of all params used by the device.
 
bool getParamValue (const std::string &paramName, std::string &paramValue) const override
 Return the value (represented as a string) of the requested parameter.
 
std::string getConfiguration () const override
 Return the configuration of the device.
 
- Public Member Functions inherited from yarp::dev::IDeviceDriverParams
virtual ~IDeviceDriverParams ()
 

Additional Inherited Members

- Public Attributes inherited from FakeSimulatedWorld_ParamsParser
const std::string m_device_classname = {"FakeSimulatedWorld"}
 
const std::string m_device_name = {"fakeSimulatedWorld"}
 
bool m_parser_is_strict = false
 
const parser_version_type m_parser_version = {}
 
std::string m_provided_configuration
 
const std::string m_period_defaultValue = {"10"}
 
int m_period = {10}
 
- Protected Member Functions inherited from yarp::os::PeriodicThread
virtual void threadRelease ()
 Release method.
 
virtual void beforeStart ()
 Called just before a new thread starts.
 
virtual void afterStart (bool success)
 Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start().
 

Detailed Description

fakeSimulatedWorld : fake device implementing the ISimulatedWorld interface.

Parameters required by this device are shown in class: FakeSimulatedWorld_ParamsParser

Definition at line 20 of file FakeSimulatedWorld.h.

Constructor & Destructor Documentation

◆ FakeSimulatedWorld() [1/3]

FakeSimulatedWorld::FakeSimulatedWorld ( )

Definition at line 21 of file FakeSimulatedWorld.cpp.

◆ FakeSimulatedWorld() [2/3]

FakeSimulatedWorld::FakeSimulatedWorld ( const FakeSimulatedWorld &  )
delete

◆ FakeSimulatedWorld() [3/3]

FakeSimulatedWorld::FakeSimulatedWorld ( FakeSimulatedWorld &&  )
delete

◆ ~FakeSimulatedWorld()

FakeSimulatedWorld::~FakeSimulatedWorld ( )
override

Definition at line 26 of file FakeSimulatedWorld.cpp.

Member Function Documentation

◆ attach()

ReturnValue FakeSimulatedWorld::attach ( std::string  id,
std::string  link_name 
)
overridevirtual

Attach an object to a link of another object.

Parameters
idstring that identifies object in gazebo
link_namename of a link
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 125 of file FakeSimulatedWorld.cpp.

◆ changeColor()

ReturnValue FakeSimulatedWorld::changeColor ( std::string  id,
yarp::sig::ColorRGB  color 
)
overridevirtual

Change the color of an object.

Parameters
idobject id
colorthe color of the frame
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 75 of file FakeSimulatedWorld.cpp.

◆ close()

bool FakeSimulatedWorld::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 39 of file FakeSimulatedWorld.cpp.

◆ deleteAll()

ReturnValue FakeSimulatedWorld::deleteAll ( )
overridevirtual

Delete all objects in the world.

Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 115 of file FakeSimulatedWorld.cpp.

◆ deleteObject()

ReturnValue FakeSimulatedWorld::deleteObject ( std::string  id)
overridevirtual

Delete an object.

Parameters
idstring that identifies object in gazebo
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 110 of file FakeSimulatedWorld.cpp.

◆ detach()

ReturnValue FakeSimulatedWorld::detach ( std::string  id)
overridevirtual

Detach a previously attached object.

Parameters
idstring that identifies object in gazebo
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 130 of file FakeSimulatedWorld.cpp.

◆ enableCollision()

ReturnValue FakeSimulatedWorld::enableCollision ( std::string  id,
bool  enable 
)
overridevirtual

Enable/disables collision detection for an object.

Parameters
idobject id
enable1 to enable collision detection, 0 otherwise
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 90 of file FakeSimulatedWorld.cpp.

◆ enableGravity()

ReturnValue FakeSimulatedWorld::enableGravity ( std::string  id,
bool  enable 
)
overridevirtual

Enable/disables gravity for an object.

Parameters
idobject id
enable1 to enable gravity, 0 otherwise
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 85 of file FakeSimulatedWorld.cpp.

◆ getList()

ReturnValue FakeSimulatedWorld::getList ( std::vector< std::string > &  names)
overridevirtual

List id of all objects that have been added to the world.

Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 120 of file FakeSimulatedWorld.cpp.

◆ getPose()

ReturnValue FakeSimulatedWorld::getPose ( std::string  id,
yarp::sig::Pose6D &  pose,
std::string  frame_name 
)
overridevirtual

Get object pose.

Parameters
idobject id
frame_name(optional) is specified, the pose will be relative to the specified fully scoped frame (e.g. MODEL_ID::FRAME_ID). Otherwise, world it will be used.
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 95 of file FakeSimulatedWorld.cpp.

◆ makeActor()

ReturnValue FakeSimulatedWorld::makeActor ( std::string  id,
std::string  skin_filename,
std::string  animation_filename,
yarp::sig::Pose6D  pose 
)
overridevirtual

Create an actor.

Parameters
idthe name of the object to create
skin_filenamestring that specifies the name of the model to load
animation_filenamestring that specifies the name of the animation to load (e.g. walking, running, etc.)
posethe initial pose of the object [m]
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 105 of file FakeSimulatedWorld.cpp.

◆ makeBox()

ReturnValue FakeSimulatedWorld::makeBox ( std::string  id,
double  width,
double  height,
double  thickness,
yarp::sig::Pose6D  pose,
yarp::sig::ColorRGB  color,
std::string  frame_name,
bool  gravity_enable,
bool  collision_enable 
)
overridevirtual

Make a box.

Parameters
idthe name of the object to create
widthbox width [m]
heightbox height[m]
thicknessbox thickness [m]
posethe pose of the box [m]
colorthe color of the box
frame_name(optional) is specified, the pose will be relative to the specified fully scoped frame (e.g. MODEL_ID::FRAME_ID). Otherwise, world it will be used.
gravity_enable(optional) enables gravity (default false)
collision_enable(optional) enables collision (default true)
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 60 of file FakeSimulatedWorld.cpp.

◆ makeCylinder()

ReturnValue FakeSimulatedWorld::makeCylinder ( std::string  id,
double  radius,
double  length,
yarp::sig::Pose6D  pose,
yarp::sig::ColorRGB  color,
std::string  frame_name,
bool  gravity_enable,
bool  collision_enable 
)
overridevirtual

Make a cylinder.

Parameters
idthe name of the object to create
radiusthe radius of the cylinder [m]
lengththe length of the cylinder [m]
posethe pose of the cylinder [m]
colorthe color of the cylinder
frame_name(optional) is specified, the pose will be relative to the specified fully scoped frame (e.g. MODEL_ID::FRAME_ID). Otherwise, world it will be used.
object_name(optional) assigns a name to the object.
gravity_enable(optional) enables gravity (default false)
collision_enable(optional) enables collision (default true)
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 65 of file FakeSimulatedWorld.cpp.

◆ makeFrame()

ReturnValue FakeSimulatedWorld::makeFrame ( std::string  id,
double  size,
yarp::sig::Pose6D  pose,
yarp::sig::ColorRGB  color,
std::string  frame_name,
bool  gravity_enable,
bool  collision_enable 
)
overridevirtual

Make a reference frame (a 3D model with 3 arrows representing the axes)

Parameters
idthe name of the object to create
sizethe size of the frame [m]
posethe pose of the frame [m]
colorthe color of the frame
frame_name(optional) is specified, the pose will be relative to the specified fully scoped frame (e.g. MODEL_ID::FRAME_ID). Otherwise, world it will be used.
object_name(optional) assigns a name to the object.
gravity_enable(optional) enables gravity (default false)
collision_enable(optional) enables collision (default true)
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 70 of file FakeSimulatedWorld.cpp.

◆ makeModel()

ReturnValue FakeSimulatedWorld::makeModel ( std::string  id,
std::string  filename,
yarp::sig::Pose6D  pose,
std::string  frame_name,
bool  gravity_enable,
bool  collision_enable 
)
overridevirtual

Create a model from a file.

Parameters
idthe name of the object to create
filenamestring that specifies the name of the model to load
posethe initial pose of the object [m]
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 100 of file FakeSimulatedWorld.cpp.

◆ makeSphere()

ReturnValue FakeSimulatedWorld::makeSphere ( std::string  id,
double  radius,
yarp::sig::Pose6D  pose,
yarp::sig::ColorRGB  color,
std::string  frame_name,
bool  gravity_enable,
bool  collision_enable 
)
overridevirtual

Make a sphere.

Parameters
idthe name of the object to create
radiusthe radius of the sphere [m]
posethe pose of the sphere [m]
colorthe color of the sphere
frame_name(optional) is specified, the pose will be relative to the specified fully scoped frame (e.g. MODEL_ID::FRAME_ID). Otherwise, world it will be used.
gravity_enable(optional) enables gravity (default false)
collision_enable(optional) enables collision (default true)
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 55 of file FakeSimulatedWorld.cpp.

◆ open()

bool FakeSimulatedWorld::open ( yarp::os::Searchable &  config)
overridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 31 of file FakeSimulatedWorld.cpp.

◆ operator=() [1/2]

FakeSimulatedWorld & FakeSimulatedWorld::operator= ( const FakeSimulatedWorld &  )
delete

◆ operator=() [2/2]

FakeSimulatedWorld & FakeSimulatedWorld::operator= ( FakeSimulatedWorld &&  )
delete

◆ rename()

ReturnValue FakeSimulatedWorld::rename ( std::string  old_name,
std::string  new_name 
)
overridevirtual

Change the names of an object.

Parameters
old_namestring that identifies object in gazebo
new_namestring that will be used as new name
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 135 of file FakeSimulatedWorld.cpp.

◆ setPose()

ReturnValue FakeSimulatedWorld::setPose ( std::string  id,
yarp::sig::Pose6D  pose,
std::string  frame_name 
)
overridevirtual

Set new object pose.

Parameters
idobject id
posenew pose
frame_name(optional) is specified, the pose will be relative to the specified fully scoped frame (e.g. MODEL_ID::FRAME_ID). Otherwise, world it will be used.
Returns
returns true or false on success failure

Implements yarp::dev::ISimulatedWorld.

Definition at line 80 of file FakeSimulatedWorld.cpp.


The documentation for this class was generated from the following files: