robotics-toolbox-python icon indicating copy to clipboard operation
robotics-toolbox-python copied to clipboard

Collision detection

Open jianchaoci opened this issue 1 year ago • 3 comments

Hi,

I want to use roboticstoolbox to do collision detection. But I got a problem when creating the obstacles. I follow the instruction you give to crate box using rtb.Box(). But I got an error as below.

image

jianchaoci avatar May 31 '23 12:05 jianchaoci

Hi @jianchaoci :wave:, I've attached the working code below

import roboticstoolbox as rtb
from spatialmath import *
from spatialgeometry import *

panda = rtb.models.Panda()
obstacle = Cuboid([1, 1, 1], pose = SE3(1, 0, 0))
iscollision = panda.iscollided(panda.q, obstacle) # boolean
iscollision = panda.links[0].iscollided(obstacle)

jkaniuka avatar Jun 11 '23 23:06 jkaniuka

Hi @jianchaoci 👋, I've attached the working code below

import roboticstoolbox as rtb
from spatialmath import *
from spatialgeometry import *

panda = rtb.models.Panda()
obstacle = Cuboid([1, 1, 1], pose = SE3(1, 0, 0))
iscollision = panda.iscollided(panda.q, obstacle) # boolean
iscollision = panda.links[0].iscollided(obstacle)

Hi Jkaniuka, Really thanks for your reply. I am wondering is there a method to help to visualize the created obstacle. And is there a IK_xx method to help to avoid those solutions collide the obstacle?

jianchaoci avatar Jun 12 '23 13:06 jianchaoci

@jianchaoci, glad I could help :wink: I've only used robotics-toolbox-python to generate manipulator trajectories, so I don't know if it has the functions you're talking about. I can, however, offer you other solutions :smile:

  • Robotics Toolbox for Python uses PyBullet for collision checking. Using this module, you can easily visualize the obstacles you add. Besides, you can check there whether the robot collides with an obstacle. You can find sample code in this tutorial - Collision Detection in PyBullet.
  • If you want to generate a trajectory so that the robot does not come into collision with an obstacle, you can use MoveIt. MoveIt is motion planning framework that is part of ROS 2. If you're familiar with Robot Operating System, I suggest you check this tutorial - Planning Around Objects.

jkaniuka avatar Jun 12 '23 22:06 jkaniuka