Connect two moving objects with rigid link

Typically: "How do I... ", "How can I... " questions
Post Reply
sample
Posts: 14
Joined: 27 Mar 2017, 21:30

Connect two moving objects with rigid link

Post by sample » 12 Jan 2018, 16:15

Hi coppelia!

My scene is given on the pictures below.
I have two modules, capable of moving in only one direction. What I want to accomplish is when these two modules are close to each other, I want them to align and form rigid connection. When connection is established I want them to continue motion together. I have tried solutions with magnets and I don't find them good enough because of the misalignment between the modules.

Is there any way to accomplish this?
Thank you!

https://imgur.com/44Yxd2F
https://imgur.com/ZPgM0DU

coppelia
Site Admin
Posts: 6864
Joined: 14 Dec 2012, 00:25

Re: Connect two moving objects with rigid link

Post by coppelia » 15 Jan 2018, 18:28

Hello,

if you want to force attachement of the two modules, then you could use a construction similar to following:

Code: Select all

Shape1 --> dummyA

shape2 --> forceSensor --> dummyB
When you want the two shapes to be rigidly connected at the position/orientation of their respective dummies, then use simSetLinkDummy. Make sure that the link type for each dummy was previously set to dynamics, overlap constraint. Practically, this will achieve a loop closure as described here.

Cheers

sample
Posts: 14
Joined: 27 Mar 2017, 21:30

Re: Connect two moving objects with rigid link

Post by sample » 16 Jan 2018, 13:11

That's the exactly what I was trying to accomplish. Thank you!

sample
Posts: 14
Joined: 27 Mar 2017, 21:30

Re: Connect two moving objects with rigid link

Post by sample » 30 Jan 2018, 12:36

Hi Coppelia, I have an additional question!
Is it possible (in similar fashion) to form rigid connection with the floor (not with the predefined spot but rather anywhere on the floor). To be more precise, when one half of the robot is rotated and base is facing floor (second image) I want that face to form rigid connection with the floor. I know it is possible to accomplish this using magnet, but I am trying to avoid that. Thank you!

image 1: neutral state

https://imgur.com/a/R8d1j

image 2: rotated blue half

https://imgur.com/a/IihqY

coppelia
Site Admin
Posts: 6864
Joined: 14 Dec 2012, 00:25

Re: Connect two moving objects with rigid link

Post by coppelia » 04 Feb 2018, 16:07

You can use the exact same approach. You will however have to correctly place the dummy attached to the floor before creating the connection.

Cheers

sample
Posts: 14
Joined: 27 Mar 2017, 21:30

Re: Connect two moving objects with rigid link

Post by sample » 05 Feb 2018, 08:30

coppelia wrote:
04 Feb 2018, 16:07
You can use the exact same approach. You will however have to correctly place the dummy attached to the floor before creating the connection.

Cheers
Hi Coppelia,

in simulations I do not know in advance where the connection will occur. Having that in mind, placing dummy on a preset location is not an option. Is there any way around it? I want my module to connect (attach itself) to the floor when quadratic side is facing the floor.

It would be ideal if I could establish rigid link with ResizableFloor_5_25 dummy, but it is not possible because in that case force sensor attached to my robot is not dynamically enabled (warning sign). Is this possible in any way?
Next option would be to place new dummy on the floor, make it a child object of the ResizableFloor_5_25-element, and to change it's position in respect to corresponding dummy on the robot (to match their positions when certain criteria is met). This solution works, but since I am using max floor dimension (25x25) I would have to add 25 dummies (one for each floor element), detect the matching one for the current robot position, re-position it, and form the link using simsetlinkdummy with that exact dummy. This might work but it is not elegant solution... Is there an easier way to do this?

Thank you for your time!

coppelia
Site Admin
Posts: 6864
Joined: 14 Dec 2012, 00:25

Re: Connect two moving objects with rigid link

Post by coppelia » 07 Feb 2018, 18:01

Not sure why your solution is not elegant with the 25X25 sized floor: you are not required to attach the dummy to the floor just below. The dummy could also hang over the void, but still be attached to one floor element (basically constantly stay attached to one floor element, and only moving the dummy position just before attachement). Maybe I haven't understood your real problem..

Cheers

sample
Posts: 14
Joined: 27 Mar 2017, 21:30

Re: Connect two moving objects with rigid link

Post by sample » 09 Feb 2018, 09:38

coppelia wrote:
07 Feb 2018, 18:01
Not sure why your solution is not elegant with the 25X25 sized floor: you are not required to attach the dummy to the floor just below. The dummy could also hang over the void, but still be attached to one floor element (basically constantly stay attached to one floor element, and only moving the dummy position just before attachment). Maybe I haven't understood your real problem..

Cheers
Hi, I have managed to establish link but I get weird repellent force when the robot rotates to desired position. Basically robot gets rejected by the floor. It's easier to see than to explain, so here is my scene:

scene: https://drive.google.com/open?id=1NzIO8 ... hP9KnFHecp

dummy_m2(attached to robot) should connect to Dummy (attached to floor element) and provide attraction force (like connection to the ground) required for robot to stand up (goal is to put red part above the blue one).

What's causing this repellent force?
Is dummy - dummy link set properly?

coppelia
Site Admin
Posts: 6864
Joined: 14 Dec 2012, 00:25

Re: Connect two moving objects with rigid link

Post by coppelia » 12 Feb 2018, 07:57

From what I can see you are setting the connection for a very short time, then breaking it apart again. Also, the dummy-dummy distance very shortly before setting the connection is close to 0.2 meters: this will of course generate such a force. Both dummies need to be almost coincident when making the connections. This means same position and same orientation.

Cheers

Post Reply