Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[irteus/irtmodel.l] support :fat option in self-collision-check (#147) #234

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

k-okada
Copy link
Member

@k-okada k-okada commented Jul 20, 2015

see #147

@snozawa
Copy link
Contributor

snozawa commented Jul 20, 2015

Do we need to re-create pqpmodel in changing fat?
https://github.com/euslisp/jskeus/blob/master/irteus/pqp.l#L58
PQP model is updated only when the links does not have pqpmodel.
So, when the link has pqp model and we specify fat, new pqp model is not created and fat seem to be neglected.

@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

This method evaluate (original 'fat' to create pqpmodel + distance returned
pep ) <( fat given in this method)

So if you create pqpmodel with fat=0, it works correctly
If you create pqp mode with fat somewhere, it is not
and I'm afraid we do not have mean to know fat value from pqp model

Fat in pqp model means the mergen to create collision model so this can be
hard safety mergen

Fat in this method is threshold distance to consider self collision, so it
may change depends on situation

Maybe we should change key name from fat to min-distance or something

2015年7月20日月曜日、Shunichi [email protected]さんは書きました:

Do we need to re-create pqpmodel in changing fat?
https://github.com/euslisp/jskeus/blob/master/irteus/pqp.l#L58
PQP model is updated only when the links does not have pqpmodel.
So, when the link has pqp model and we specify fat, new pqp model is not
created and fat seem to be neglected.


Reply to this email directly or view it on GitHub
#234 (comment).

◉ Kei Okada

(let ((cpairs) (col-count 0))
(dolist (p pairs)
(let ((colp (/= (funcall collision-func (car p) (cdr p)) 0)))
(let ((colp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I understand the motivation of this PR.
For this purpose, it would be better to another name for fat as you said.,
e.g., fat => min-distance, because fatting collision shape is not theoretically same as changing distance.

@snozawa
Copy link
Contributor

snozawa commented Jul 20, 2015

How about adding fat to link's plist and checking it?

(defmethod cascaded-coords
  (:make-pqpmodel
   (&key (fat 0) ((:faces fs) (send self :faces)))
   (let ((m (pqpmakemodel))
         vs v1 v2 v3 (id 0))
     (setf (get self :pqpmodel) m)
     (setf (get self :fat) fat) ;; change here
     ....
     m))
  )

(defun pqp-collision-check (model1 model2
                                       &optional (flag PQP_FIRST_CONTACT) &key (fat 0) (fat2 nil))
  (let ((m1 (get model1 :pqpmodel))
        (m2 (get model2 :pqpmodel))
        (f1 (get model1 :fat)) (f2 (get model :fat)) ;; change here
        (r1 (send model1 :worldrot))
        (t1 (send model1 :worldpos))
        (r2 (send model2 :worldrot))
        (t2 (send model2 :worldpos)))
    (if (null fat2) (setq fat2 fat))
    (if (and (null m1) (not (eps= fat f1)))  (setq m1 (send model1 :make-pqpmodel :fat fat))) ;; change here, check fat change
    (if (and (null m2) (not (eps= fat2 f2))) (setq m2 (send model2 :make-pqpmodel :fat fat2)))
    (pqpcollide r1 t1 m1 r2 t2 m2 flag)
    ))

In this way, we can check fat change and when we increase and decrease fat we can obtain pqpmodel for adequate fat value.

@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

having fat to plist may good (pqpmodel-fat ?) but if someone is using fat for calculating distance between two links, that's mistake. Main advantage of using PQP over RAPID is that it is able to calculate distance between two objects.

I interpret the motivation of #147 to specify minimum distance when calculating self collision , but if #147 is "really" want to change fat, I'd like to know the detail.

@snozawa
Copy link
Contributor

snozawa commented Jul 20, 2015

Main advantage of using PQP over RAPID is that it is able to calculate distance between two objects.

I see.
As you said, if we use PQP, using distance is quite useful.

@garaemon,
in #147 , do you really want to change fat? or, is it enough to check distance for you?

k-okada added a commit to k-okada/jskeus that referenced this pull request Jul 20, 2015
@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

add fat to pslot -> #234 (comment)

@garaemon
Copy link
Contributor

@garaemon,
in #147 , do you really want to change fat? or, is it enough to check distance for you?

hmm, yes distance may be enough for me.

@garaemon
Copy link
Contributor

However, if checking collision or not is much faster than computing distance, :fat parameter would be important.

@garaemon
Copy link
Contributor

And also, I'd like to manage several pqp models with different :fat parameters.

@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

why?

◉ Kei Okada

On Mon, Jul 20, 2015 at 8:42 PM, Ryohei Ueda [email protected]
wrote:

And also, I'd like to manage several pqp models with different :fat
parameters.


Reply to this email directly or view it on GitHub
#234 (comment).

@garaemon
Copy link
Contributor

for example, in IK just use :fat 0 and use larger value in order to check
collision with environment.

2015年7月20日月曜日、Kei [email protected]さんは書きました:

why?

◉ Kei Okada

On Mon, Jul 20, 2015 at 8:42 PM, Ryohei Ueda <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');>
wrote:

And also, I'd like to manage several pqp models with different :fat
parameters.


Reply to this email directly or view it on GitHub
#234 (comment).


Reply to this email directly or view it on GitHub
#234 (comment).

✉︎ from iPhone

@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

In that case we should check 'distance' between a robot and environment.

◉ Kei Okada

2015/07/20 20:52、Ryohei Ueda [email protected] のメッセージ:

for example, in IK just use :fat 0 and use larger value in order to check
collision with environment.

2015年7月20日月曜日、Kei [email protected]さんは書きました:

why?

◉ Kei Okada

On Mon, Jul 20, 2015 at 8:42 PM, Ryohei Ueda <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');>
wrote:

And also, I'd like to manage several pqp models with different :fat
parameters.


Reply to this email directly or view it on GitHub
#234 (comment).


Reply to this email directly or view it on GitHub
#234 (comment).

✉︎ from iPhone

Reply to this email directly or view it on GitHub.

@garaemon
Copy link
Contributor

Yes but Collision check might be easier than distance calculation. But I
don't know implementation of pqp

2015年7月20日月曜日、Kei [email protected]さんは書きました:

In that case we should check 'distance' between a robot and environment.

◉ Kei Okada

2015/07/20 20:52、Ryohei Ueda <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> のメッセージ:

for example, in IK just use :fat 0 and use larger value in order to check
collision with environment.

2015年7月20日月曜日、Kei Okada<[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');>さんは書きました:

why?

◉ Kei Okada

On Mon, Jul 20, 2015 at 8:42 PM, Ryohei Ueda <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');
<javascript:_e(%7B%7D,'cvml','[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');');>>
wrote:

And also, I'd like to manage several pqp models with different :fat
parameters.


Reply to this email directly or view it on GitHub
#234 (comment).


Reply to this email directly or view it on GitHub
#234 (comment).

✉︎ from iPhone

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#234 (comment).

✉︎ from iPhone

@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

Ok, I created test code to compare collision detection vs collision distance at 95454fd

the results shows there are no difference between collision detection / distance calculation

create model (base line time)   0.074 ((t 0.0 #f(-50.0 50.0 50.0) (0.0 0.0 0.0)))
pqp collision check   0.274 (0.002004 msec/check)
pqp collision distance   0.263 (0.001887 msec/check)
create model (base line time)   0.074 ((nil 50.0 #f(-150.0 50.0 50.0) (0.0 0.0 0.0)))
pqp collision check   0.234 (0.001597 msec/check)
pqp collision distance   0.234 (0.001599 msec/check)
create model (base line time)   0.068 ((t 0.0 #f(-50.0 50.0 50.0) (0.3 0.3 0.3)))
pqp collision check   0.232 (0.001647 msec/check)
pqp collision distance   0.244 (0.001759 msec/check)
create model (base line time)   0.076 ((nil 30.8431 #f(-150.0 50.0 50.0) (0.3 0.3 0.3)))
pqp collision check   0.232 (0.001563 msec/check)
pqp collision distance   0.228 (0.001524 msec/check)

@garaemon
Copy link
Contributor

the results shows there are no difference between collision detection / distance calculation

I see, it means that... we do not need :fat option?

@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

oh, you mean add :fat option besides :min-distance at :self-collision-check
method?

◉ Kei Okada

On Mon, Jul 20, 2015 at 10:06 PM, Ryohei Ueda [email protected]
wrote:

the results shows there are no difference between collision detection /
distance calculation

I see, it means that... we do not need :fat option?


Reply to this email directly or view it on GitHub
#234 (comment).

@garaemon
Copy link
Contributor

oh, you mean add :fat option besides :min-distance at :self-collision-check
method?

Yes,

However if we want to use different :fat parameters for the objects, :fat parameter makes sense.
For example, larger values for end effectors and smaller values for torso links.

@k-okada
Copy link
Member Author

k-okada commented Jul 20, 2015

@snozawa , please check k-okada@a762650, which i changed from #234 (comment)

@garaemon, hum if you want to do that we can not supply :fat keyward to :self-collision-check as k-okada@4a6c4ee, may be we can use :fat (list 0 0 30 0 40 0 ...) (too complex...), simplest way is to set :fat for each object before we call :self-collision-check, and in this case we may better to remove :fat option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants