Giter VIP home page Giter VIP logo

dual_quaternions_ros's Introduction

Dual Quaternions ROS

travis GitHub tag (latest SemVer)

Simple conversion methods for going from ROS geometry_msgs to dual quaternions and vice versa. For the dual_quaternions repo, see dual_quaternions.

Installation

pip

pip install dual_quaternions

ROS1 package

apt install ros-$ROS_DISTRO-dual-quaternions-ros

Requirements

  • dual_quaternions
  • geometry_msgs

Usage

Import using:

from dual_quaternions_ros import from_ros, to_ros_pose, to_ros_transform

NOTE: there is no concept of 'from' and 'to' as frame names aren't tracked or used (e.g. use of Pose iso PoseStamped). It is up to the user to keep track of those to avoid picking a convention (active vs. passive)

Publishing and getting transforms from tf

This package purposefully doesn't have methods to receive and publish transforms to tf. Instead, it supports converting transforms to various ROS messages so you can use the standard way of interfacing:

br = tf2_ros.TransformBroadcaster()
T_odom_baselink = DualQuaternion(...)
msg = geometry_msgs.msg.TransformStamped()
msg.transform = T_odom_baselink.to_ros_transform
msg.header.frame_id = 'odom'
msg.child_frame_id = 'base_link'
br.sendTransform(msg)

dual_quaternions_ros's People

Contributors

achllle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dual_quaternions_ros's Issues

Only use properties when required

Properties really only are meant for 'properties' of a class that can't be readily derived from other instance attributes.

Consider changing these to regular methods. Would need to change all code that uses these properties since you can invoke them as dq.ros_pose instead of dq.ros_pose().

DQ addition isn't correct

Currently it is assumed that the dual quaternion doesn't have a rotation and the unit quaternion is returned for the rotation part. Instead, the quaternions should simply be added:

dq1 + dq2 = (dqr1 + dqr2) + e(dqd1 + dqd2)

Clarify inverse / add mathematical inverse

The formula for the inverse of a not necessarily unit DQ is

Inv(a +eb) = inv(a) (1 - eb inv(a)) # a != 0

, not sure if we need to replace the current formulation or have a separate formulation

Clarify existence and use of 3 conjugate forms

There's

  1. Dual number conjugate p-eq
  2. Classical quaternion conjugate p* + eq*
  3. Combo p* - eq*

Clarify which one we're using and explain in readme what each one does. We're using 1 and 2. Provide link to Yan-Bin Jia's notes

Run CI in python3 as well

Run dual_quaternions tests with Python3 in Travis CI. This requires a few modifications:

  1. In setup.py, from distutils.core import setup --> from setuptools import setup although this old article says it doesn't like it but I think that can be disregarded.
  2. Code needs to become python3 compatible. Just need to fix one test!
  3. Modify Travis config to run python3. Not sure how that would work with ROS installation.

Implement screw representation

A dual quaternion corresponds nicely to a screw transformation. Allow a user to get this screw 6D vector.
Optionally also include a distance metric based on the screw representation

Make scipy a requirement to avoid warning message

Got following error on a fresh install:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Could not import from scipy, which means that derivatives
and integrals will use less accurate finite-differencing
techniques.  You may want to install scipy.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

is_unit() only checks real part of DQ

A dual quaternion sigma = p+eq is unit if, when multiplied with its quaternion_conjugate(), results in 1.

In the current definition of us_unit, it just checks if the norm of the real part (q_r) of the DQ has norm 1 which I think is incorrect.

Clarify transforming points vs similarity transform

The code of transform_point is as follows:

        # dq_point = DualQuaternion.identity()
        # dq_point.q_d = np.quaternion(0., point_xyz[0], point_xyz[1], point_xyz[2])
        # transformed_dq = (self * dq_point) * (self.conjugate())
        # return [transformed_dq.q_d.x, transformed_dq.q_d.y, transformed_dq.q_d.z]

        # this works, but not mathematically elegant (?)
        dq_point = DualQuaternion.from_translation_vector(point_xyz)
        transformed_dq = self * dq_point

        return transformed_dq.translation

Seems like I was confused writing this down. The commented out code describes a similarity transform, which is used to relate transformation between frames, not points. I would educate but let the user do the similarity transform if they need it.

Add mathematical norm

The norm of a dual quaternion is |q| = sqrt(qq*). Currently the normalized rotation is used. Should make this clear and have a separate norm() method

More explicit documentation

There are several definitions of a conjugate or an inverse. Documentation also does not indicate if a DQ will be normalized or not.

Add verbosity, explicit math, potentially different new methods

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.