Skip to main content

A Python Robot Control Framework for quickly prototyping control algorithms for different robot embodiments.

Project description

pyrcf

Python GitHub release Documentation Status License

A Python Robot Control Framework for quickly prototyping control algorithms for different tasks and robot embodiments (in simulation; not designed to be used on real systems).

Primarily, this library provides an implementation of a typical control loop (via a MinimalCtrlLoop (extended from SimpleManagedCtrlLoop) class), and defines interfaces for the components in a control loop that can be used directly in these control loop implementations. It also provides utility and debugging tools that will be useful for developing controllers and planners for different robots. This package also provides implementations of basic controllers and planners (and other components required to define a full control loop).

In the long run, this package will also provide implementations of popular motion planners and controllers from literature and using existing libraries.

[!WARNING] THIS PROJECT IS STILL IN ACTIVE DEVELOPMENT.

Continuous Integration Status

Ci Codecov GitHub issues GitHub pull-requests merged

Features

  • Written fully in Python 3.
  • Full control loop for almost any robotic task can be created using a few easy-to-define components (robot interface, global planner, local planner, controller). Dummy implementations are provided if any of the components are not required and needs to be bypassed.
  • Create a valid RobotInterface for any robot just using a URDF. This will create a valid robot interface simulated in Pybullet. Easy to define custom interfaces if required. Handles robots with continuous joints as well, and is directly compatible with Pinocchio.
  • Default and basic implementations of several control loop components already available.
  • Easy to adapt existing components and define new custom ones.
  • Well-defined interfaces for all custom components, making each component modular and almost plug-and-play with an equivalent component.
  • Debugging tools available for monitoring and logging data from different components.
  • Control loop classes are available where properly defined components can be passed directly. No need to worry about interfacing different components, maintaining loop rates, etc.
  • Easy to obtain kinematics and dynamics information for any robot to be used within or outside the control loop (uses Pinocchio and Pybullet for kinematics and dynamics compuations).
  • Framework is easy to extend.

Installation

From pypi

PyPI version

  • pip install pyrcf

From source

  • Clone repo and run from inside the directory pip install . (recommended to use virtual env) or run pixi install (if using Pixi).

Testing Installation

After installation, you should be able to run a robot visualiser script installed globally called pyrcf-visualise-robot. Run it with the first argument as any of the robot descriptions mentioned in the robot_descriptions.py repo; e.g. pyrcf-visualise-robot pepper_description. This should start a visualiser in pybullet, where you should be able to move all robot joints and base pose using sliders in the pybullet GUI.

Usage demos

All the demos shown below are available in the examples folder of this repo.

Testing and developing a balancing controller for 2-wheeled segway type robot (upkie)

upkie-2024-08-09-20-22-42.gif

Implementing joint interpolator and joint tracking controllers for different robots (with debugging visualisers)

joint-pos-ctrlr-2024-08-09-20-21-15-2.gif

Supports data monitoring tools like Plotjuggler to debug and assess any component easily

ik-with-pj-2024-08-09-20-19-54-1.gif

NOTE: Plotjuggler has to be installed separately if it is needed (see https://github.com/facontidavide/PlotJuggler for installation instructions).

See the examples folder for more. More examples and demos will be added soon.

PyRCF Philosophy

Tutorials and more details about concepts will be provided in the tutorials folder (work in progress).

PyRCF follows the principle of a single thread control loop where components are communicating with each other strictly using pre-defined message types, and run sequentially.

PyRCF is designed to be a prototyping tool to test different controllers and algorithms in simulation, and NOT optimised for real-time control on a real robot. Although the framework has been tested on real robot interfaces, it is not recommended to do so unless you know what you are doing.

A generic control loop

LOOP:
  # Read latest robot state
  robot_state = ROBOT_INTERFACE->read_robot_state()

  # Update robot state with estimations (when all states are not directly measurable)
  robot_state = STATE_ESTIMATOR->update_robot_state_estimates(robot_state)

  # Generate global plan (high-level task objective or target)
  global_plan = GLOBAL_PLANNER->generate_global_plan()

  # Generate local plan based on state and global plan
  local_plan = LOCAL_PLANNER->generate_local_plan(robot_state, global_plan)

  # Generate control command based on state and local plan
  cmd = CONTROLLER->compute_commands(robot_state, local_plan)

  # Send command to robot
  ROBOT_INTERFACE->write_robot_command(cmd)

  # Maintain loop frequency (naive implementation)
  SLEEP(period)

END LOOP

This package provides interfaces to define custom components (such as controller, robot interface, global planner, local planner, etc) that can be run in a control loop, as well as provides an implementation of a control loop class which can execute these components in the required order at the specified rate. Implementations of simple forms of all components are also available in this package, including simulated interfaces for many robot embodiments.

Custom controllers and planners can be implemented and quickly tested on existing robot interfaces or on custom robot interfaces (which can be easily defined).

More complex algorithms for control and planning will be provided by this package over time.

Tutorials and more details about concepts will be provided in the tutorials folder (work in progress).

Documentation Status Pixi Badge

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrcf-0.0.6.tar.gz (98.7 kB view details)

Uploaded Source

Built Distribution

pyrcf-0.0.6-py3-none-any.whl (130.2 kB view details)

Uploaded Python 3

File details

Details for the file pyrcf-0.0.6.tar.gz.

File metadata

  • Download URL: pyrcf-0.0.6.tar.gz
  • Upload date:
  • Size: 98.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pyrcf-0.0.6.tar.gz
Algorithm Hash digest
SHA256 523722be915ec57653cb4a79391b01f40ece1c237c46739caf49be114993ee27
MD5 5fa30fb47cccc1365b302dce00d95878
BLAKE2b-256 cfa11b340402a54c691ea3ecf1af7f784dc7cf6e8f9eef419bd5eb33766b9330

See more details on using hashes here.

File details

Details for the file pyrcf-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyrcf-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 130.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pyrcf-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 73acc1afdffc8f5d3e8099e7f1ccc9d866217f107b300472ccdaa956b19ee5b5
MD5 651889fb3c7da12c6f57d72214448560
BLAKE2b-256 7ee26fb3dd15c1bf112398e2c4c277ad15c65cdf3918d4dfc520867a16def8a0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page