Manipulation OpenAI Gym environments to simulate robots at the STARS lab

Related tags

Miscellaneous math
Overview

liegroups

Python implementation of SO2, SE2, SO3, and SE3 matrix Lie groups using numpy or PyTorch.

[Documentation]

Installation

To install, cd into the repository directory (the one with setup.py) and run:

pip install .

or

pip install -e .

The -e flag tells pip to install the package in-place, which lets you make changes to the code without having to reinstall every time. Do not do this on shared workstations!

Testing

Ensure you have pytest installed on your system, or install it using conda install pytest or pip install pytest. Then run pytest in the repository directory.

Usage

Numpy and torch implementations are accessible through the liegroups.numpy and liegroups.torch subpackages. By default, the numpy implementation is available through the top-level package.

Access the numpy implementation using something like

from liegroups import SE3

or

from liegroups.numpy import SO2

Access the pytorch implementation using something like

from liegroups.torch import SE2
Comments
  • Bug in quaternion conversion?

    Bug in quaternion conversion?

    Code to reproduce

    R = np.array([[-0.26588199,  0.0721791,  -0.96129961],
                          [ 0.01772801,  0.99739046,  0.06998566],
                          [ 0.96384256,  0.001566,   -0.26646775]])
    R = SO3.from_matrix(R, True)
    q = R.to_quaternion()
    print(np.isclose(la.norm(q), 1))
    

    prints False

    opened by versatran01 2
  • Update mask inversion inside torch/so3.py

    Update mask inversion inside torch/so3.py

    I recently found two occurrences of this error, both in torch/so3.py:

    Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/.local/lib/python3.6/site-packages/liegroups/torch/se3.py", line 80, in exp rot_jac = cls.RotationType.left_jacobian(phi) File "/home/ubuntu/.local/lib/python3.6/site-packages/liegroups/torch/so3.py", line 187, in left_jacobian #large_angle_mask = 1 - small_angle_mask # element-wise not File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/tensor.py", line 362, in rsub return _C._VariableFunctions.rsub(self, other) RuntimeError: Subtraction, the - operator, with a bool tensor is not supported. If you are trying to invert a mask, use the ~ or logical_not() operator instead.

    I could verify locally that it is just a matter of doing what is suggested and it works fine. P.S.: My pytorch version is 1.3

    opened by Ronnypetson 1
  •  Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead.

    Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead.

    When I use liegroups in a loss function, it reports error as follows: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead.

    Here is the code:

        print('rotation_ab_pred size = {} type = {}'.format(rotation_ab_pred.size(), rotation_ab_pred.type()))
        rvec_ab_pred = SO2.from_matrix(rotation_ab_pred)
    

    And the result:

    rotation_ab_pred size = torch.Size([32, 2, 2]) type = torch.cuda.FloatTensor

    opened by skylook 1
  • Add support to Sim(3) and sim(3)

    Add support to Sim(3) and sim(3)

    I do not know whether you have considered this, but in monocular VO with bundle adjustment it may be interesting to include the scale directly in the similarity transformation (see http://roboticsproceedings.org/rss06/p10.pdf, page 6) and optimize over it rather than separately.

    opened by Ronnypetson 0
  • Python2.7 dev

    Python2.7 dev

    Modification to base classes for compatibility with python 2.7. On some systems, may require installing future (easy with pip).

    For explanation of changes, see https://python-future.org/compatible_idioms.html, specifically the "Metaclasses" section.

    opened by trevorablett 0
  • exp and log not invertible

    exp and log not invertible

    This assertion fails.

    import numpy as np
    from liegroups import SO3
    s = SO3.from_rpy(np.pi, 0, np.pi/2)
    es = SO3.exp(s.log())
    assert np.allclose(s.mat, es.mat)
    
    opened by Carpetfizz 0
  • Extra care needed for np.sin(theta) where theta = +np.pi or -np.pi ?

    Extra care needed for np.sin(theta) where theta = +np.pi or -np.pi ?

    Hello,

    In the so3.log function

    https://github.com/utiasSTARS/liegroups/blob/fe1d376b7d33809dec78724b456f01833507c305/liegroups/numpy/so3.py#L205

    There's a division by np.sin(angle) but there isn't a check to see if angle is +np.pi or -np.pi. I understand that due to numerical precision, np.sin(np.pi) != 0.0 but I'm wondering if there needs to be some extra care taken here.

    See

    https://en.wikipedia.org/wiki/Axis–angle_representation#Log_map_from_SO(3)to%7F'%22%60UNIQ--postMath-0000000D-QINU%60%22'%7F(3)

    opened by Carpetfizz 0
  • Update so3.py

    Update so3.py

    When using the liegroups lib I run into the following SyntaxWarning when using the so3.py file

    liegroups/numpy/so3.py:83: SyntaxWarning: "is" with a literal. Did you mean "=="?
      elif ordering is 'wxyz':
    

    I've changed the literal with two equal signs for this file to prevent the warning. I will look through some of the other files to see if I can find any more needing to be changed.

    opened by zmk5 0
  • SE2 left jacobians

    SE2 left jacobians

    Implemented the SE(2) group jacobian (and inverse) in numpy and torch. These did not seem to be covered in Barfoot and so the reference for the solution implemented in this PR is a Lie theory described in https://arxiv.org/pdf/1812.01537.pdf. Specifically, I ported the left jacobian implementation from the C++ code here: https://github.com/artivis/manif/blob/6f2c1cd3e050a2a232cc5f6c4fb0d33b74f08701/include/manif/impl/se2/SE2Tangent_base.h The paper does not provide a closed form solution for the inverse left jacobian, so I used MATLAB's symbolic toolbox to arrive at one - for both the general and small angle cases. This has all been unit tested in the same style as SE(3) cases. Incidentally, when testing this on GPU (torch version), I ran into a few problems with the SO2/base interfaces. This PR thus includes a few fixes along those lines.

    opened by mttgdd 0
  • Fixing device selection (cuda or cpu)

    Fixing device selection (cuda or cpu)

    The class methods in so3 creates new matrices (eye etc.) without taking the device selection taking into account. This patch should fix this by setting the right device directly while creating new matrices.

    opened by ArashJavan 0
Owner
STARS Laboratory
We are the Space and Terrestrial Autonomous Robotic Systems Laboratory at the University of Toronto
STARS Laboratory
python based clash stars made by grade 7 and 5

clash_stars python based clash stars made by grade 7 and 5 How to play: PLAYER ONE (LEFT PLAYER) Move: W,A,S,D Shoot: SHIFT PLAYER TWO (RIGHT PLAYER)

null 5 Oct 22, 2021
Experimental Brawl Stars v36.218 server emulator written in Python.

Brawl Stars v36 Experimental Brawl Stars v36.218 server emulator written in Python. Requirements: Python 3.7 or higher colorama Running the server In

null 8 Oct 31, 2021
Experimental proxy for dumping the unencrypted packet data from Brawl Stars (WIP)

Brawl Stars Proxy Experimental proxy for version 39.99 of Brawl Stars. It allows you to capture the packets being sent between the Brawl Stars client

null 4 Oct 29, 2021
Starscape is a Blender add-on for adding stars to the background of a scene.

Starscape Starscape is a Blender add-on for adding stars to the background of a scene. Features The add-on provides the following features: Procedural

Marco Rossini 5 Jun 24, 2022
Implementation of the Angular Spectrum method in Python to simulate Diffraction Patterns

Diffraction Simulations - Angular Spectrum Method Implementation of the Angular Spectrum method in Python to simulate Diffraction Patterns with arbitr

Rafael de la Fuente 276 Dec 30, 2022
A Python library to simulate a Zoom H6 recorder remote control

H6 A Python library to emulate a Zoom H6 recorder remote control Introduction This library allows you to control your Zoom H6 recorder from your compu

Matias Godoy 68 Nov 2, 2022
Hook and simulate global keyboard events on Windows and Linux.

keyboard Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more.

BoppreH 3.2k Jan 1, 2023
Probably the best way to simulate block scopes in Python

This is a package, as it says on the tin, to emulate block scoping in Python, the lack of which being a clever design choice yet sometimes a trouble.

null 88 Oct 26, 2022
This is a Python program I wrote to simulate the solar system with 79 lines of code.

Solar System With Python This is a Python program I wrote to simulate the solar system with 79 lines of code. Required modules tkinter, math, time Why

Mehmet Aydoğmuş 1 Oct 26, 2021
A redesign of our previous Python World Cup, aiming to simulate the 2022 World Cup all the way from the qualifiers

A redesign of our previous Python World Cup, aiming to simulate the 2022 World Cup all the way from the qualifiers. This new version is designed to be more compact and more efficient and will reflect the improvements in our programming ability.

Sam Counsell 1 Jan 7, 2022
MeerKAT radio telescope simulation package. Built to simulate multibeam antenna data.

MeerKATgen MeerKAT radio telescope simulation package. Designed with performance in mind and utilizes Just in time compile (JIT) and XLA backed vectro

Peter Ma 6 Jan 23, 2022
This is a library for simulate probability theory problems specialy conditional probability

This is a library for simulate probability theory problems specialy conditional probability. It is also useful to create custom single or joint distribution with specific PMF or PDF to get probability table and genearte data based on probability function.

Mohamadreza Kariminejad 6 Mar 30, 2022
Q-Tracker is originally a High School Project created by Admins of Cirus Lab.

Q-Tracker is originally a High School Project created by Admins of Cirus Lab. It's completly coded in python along with mysql.(Tkinter For GUI)

Adithya Krishnan 2 Nov 14, 2022
DC619/DC858 Mainframe Environment/Lab

DC619 Training LPAR The file DC619 - Mainframe Overflows Hands On.pdf contains the labs and walks through how to perform them. Use docker You can use

Soldier of FORTRAN 9 Jun 27, 2022
This repository contains the code for the python introduction lab

This repository contains the code for the python introduction lab. The purpose is to have a fairly simple python assignment that introduces the basic features and tools of python

null 1 Jan 24, 2022
Interactivity Lab: Household Pulse Explorable

Interactivity Lab: Household Pulse Explorable Goal: Build an interactive application that incorporates fundamental Streamlit components to offer a cur

null 1 Feb 10, 2022
Safely pass trusted data to untrusted environments and back.

ItsDangerous ... so better sign this Various helpers to pass data to untrusted environments and to get it back safe and sound. Data is cryptographical

The Pallets Projects 2.6k Jan 1, 2023
Traditionally, there is considerable friction for developers when setting up development environments

This self-led, half-day training will teach participants the patterns and best practices for working with GitHub Codespaces

CSE Labs at Spark 12 Dec 2, 2022
Url-check-migration-python - A python script using Apica API's to migrate URL checks between environments

url-check-migration-python A python script using Apica API's to migrate URL chec

Angelo Aquino 1 Feb 16, 2022