# RigidBodyDynamics : velocity\_range

**URL:** <https://discourse.julialang.org/t/rigidbodydynamics-velocity-range/23004>\
**Category:** Modelling & Simulations\
**Created:** [April 10, 2019, 4:05pm UTC](https://discourse.julialang.org/t/rigidbodydynamics-velocity-range/23004 "2019-04-10T16:05:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RogerP](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rogerp/32/17496_2.png) [@RogerP](https://discourse.julialang.org/u/RogerP)\
**Post date:** [April 10, 2019, 4:05pm UTC](https://discourse.julialang.org/t/rigidbodydynamics-velocity-range/23004/1 "2019-04-10T16:05:12Z")

</div>

I am trying to understand the relationship between `v` and `q̇` using the functions that provide the Jacobians relating the two and I wonder if someone could explain the meaning of the required velocity ranges?

The docs say:

```julia
Return the range of indices into the joint velocity vector ``v`` corresponding to joint `joint`.

```

E.g. For the second joint in my robot I get:

```julia
julia> state.vranges[jointVector[2]]
2:2

julia> velocity_range(state, jointVector[2])
2:2

```

The range is a set of indices but I don’t understand how a one-dimensional joint can span more than one index at a time. The result is always a one-dimensional Jacobian `J = 1.0` which seems to imply that `v == q̇` for all my joints (none are planar). Use case: I am using RBD in a state-estimator and I need to compute a number of variables to compare with the corresponding measurements from sensors.

BTW: noticed in `test_mechanism_algorithms.jl` there was this, which looks like a typo in the arguments:

```julia
Jv_to_q̇_j = RigidBodyDynamics.velocity_to_configuration_derivative_jacobian(joint, qj)
Jq̇_to_v_j = RigidBodyDynamics.configuration_derivative_to_velocity_jacobian(joint, qj)

```

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [April 10, 2019, 9:10pm UTC](https://discourse.julialang.org/t/rigidbodydynamics-velocity-range/23004/2 "2019-04-10T21:10:43Z")

</div>

> [@RogerP](#):
>
> The result is always a one-dimensional Jacobian `J = 1.0` which seems to imply that `v == q̇` for all my joints (none are planar).

For the `Prismatic` and `Revolute` joint types, v = \dot{q}, but that’s not the case for the `SinCosRevolute`, `Planar`, `QuaternionSpherical`, `QuaternionFloating`, or `SPQuatFloating` joint types.

> [@RogerP](#):
>
> The range is a set of indices but I don’t understand how a one-dimensional joint can span more than one index at a time.

The planar, spherical, and floating joint types have multiple indices into the joint velocity vector associated with them. For type stability, the return type of `velocity_range` is always a `UnitRange`, even if a joint only has a single velocity variable associated with it (resulting in e.g. the 1-length velocity range `2 : 2` you were seeing).

> [@RogerP](#):
>
> BTW: noticed in `test_mechanism_algorithms.jl` there was this, which looks like a typo in the arguments:

No, the _Jacobian_ for both mappings only depends on q. The mappings themselves also depend linearly on \dot{q} or v, depending on the direction. But since these dependencies are linear, \dot{q} and v are not needed as arguments for the Jacobian functions.

---

<div class="post-metadata">

**Author:** ![RogerP](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rogerp/32/17496_2.png) [@RogerP](https://discourse.julialang.org/u/RogerP)\
**Post date:** [April 11, 2019, 7:28am UTC](https://discourse.julialang.org/t/rigidbodydynamics-velocity-range/23004/3 "2019-04-11T07:28:46Z")

</div>

🙂 Brilliant!! Very clear now. Many thanks for your help!!
