File pybullet_driver.hpp

C++ wrappers to use pyBullet simulation of fingers as robot_interfaces::RobotDriver.

namespace trifinger_simulation

Functions

template<typename Types, typename Driver>
Types::BackendPtr create_finger_backend(typename Types::BaseDataPtr robot_data, const bool real_time_mode, const bool visualize, const double first_action_timeout = std::numeric_limits<double>::infinity(), const uint32_t max_number_of_actions = 0)

Create a Finger/TriFinger-backend using pyBullet.

Template Parameters
  • Types – The struct providing the types for action, observation, etc.

  • Driver – pyBullet-Driver class for either single Finger or TriFinger.

Parameters
  • robot_data – RobotData instance for the backend.

  • real_time_mode – If true, step the simulation in real time, otherwise as fast as possible.

  • visualize – If true, pyBullet’s GUI is started for visualization.

  • first_action_timeout – See RobotBackend

  • max_number_of_actions – See RobotBackend

Returns

Backend using a driver of the specified type.

template<typename Action, typename Observation>
class BasePyBulletFingerDriver : public robot_interfaces::RobotDriver<Action, Observation>

Base driver for pyBullet of both single Finger and TriFinger.

Implements all methods of RobotDriver except initialize which needs to be implemented by the child class as there are differences between single Finger and TriFinger.

All other methods are generic and only need to be templated with the proper types for actions/observations.

Template Parameters
  • Action – Action type used for the specific robot.

  • Observation – Observation type used for the specific robot.

Public Types

typedef Observation::JointVector JointVector

Public Functions

inline BasePyBulletFingerDriver(bool real_time_mode, bool visualize)
inline Observation get_latest_observation() override
inline Action apply_action(const Action &desired_action) override
inline std::string get_error() override
inline void shutdown() override

Protected Attributes

bool real_time_mode_

If true, step simulation at 1 kHz, otherwise as fast as possible.

bool visualize_

If true, pyBullet GUI for visualization is started.

py::object sim_finger_

Instance of the Python class SimFinger that implements the pyBullet simulation of the finger robots.

This needs to be initialized by the child class!

class PyBulletSingleFingerDriver : public trifinger_simulation::BasePyBulletFingerDriver<robot_interfaces::MonoFingerTypes::Action, robot_interfaces::MonoFingerTypes::Observation>

pyBullet driver for the single Finger.

Public Functions

inline void initialize() override
inline BasePyBulletFingerDriver(bool real_time_mode, bool visualize)
class PyBulletTriFingerDriver : public trifinger_simulation::BasePyBulletFingerDriver<robot_interfaces::TriFingerTypes::Action, robot_interfaces::TriFingerTypes::Observation>

pyBullet driver for the TriFinger

Public Functions

inline void initialize() override
inline BasePyBulletFingerDriver(bool real_time_mode, bool visualize)