petercorke / robotics-toolbox-python

Robotics Toolbox for Python
MIT License
2.12k stars 437 forks source link

Collision detection #376

Closed jianchaoci closed 3 months ago

jianchaoci commented 1 year ago

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

jkaniuka commented 1 year ago

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)
jianchaoci commented 1 year ago

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?

jkaniuka commented 1 year ago

@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: