Efficient curved conveyor using angular velocity instead of path

Typically: "How do I... ", "How can I... " questions
Post Reply
Justus
Posts: 15
Joined: 24 Jan 2017, 07:37

Efficient curved conveyor using angular velocity instead of path

Post by Justus » 17 May 2017, 07:31

Hi,

The circular conveyor in the example model browser (equipment->conveyor belts->"circular conveyor belt.ttm") uses a path. This works, but is not very efficient. So I tried to create a more efficient one using the same method as used with the "conveyor belt (very efficient).ttm", but using sim_shapefloatparam_init_velocity_g instead of sim_shapefloatparam_init_velocity_x/y/z:

Code: Select all

if (sim_call_type==sim_childscriptcall_initialization) then 
    forwarder=simGetObjectAssociatedWithScript(sim_handle_self)
    speed=0.1
end 

if (sim_call_type==sim_childscriptcall_actuation) then 
    simResetDynamicObject(forwarder)
    simSetObjectFloatParameter(forwarder,sim_shapefloatparam_init_velocity_g,speed)
end 
This works but rotation is relative to the geometric centre of the shape. Fine when creating 360 degree conveyors, but not for 90 degree conveyors. I can move the centre by grouping a extra shape to the plane, like so: http://imgur.com/ewUpSX4

But now I have a extra shape responding to the environment. Is there any other way to change the geometric centre, or a different way to create a very efficient angular conveyor?

Regards,
Justus

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

Re: Efficient curved conveyor using angular velocity instead of path

Post by coppelia » 17 May 2017, 16:28

Hello Justus,

ok, if I understood you correctly, you have other ways, next to what you did. For example:
  • If the rotation center is not where the shape center is, then you will have to add an initial rotation and an initial translation
  • Use a combination of two shapes and two joints, and move the first joint by a few degrees, while the other shape is non-respondable. Then reset the first joint, make its shape non-respondable. And make the second shape respondable, then move the joint of the second shape. Once you have moved the second joint by a few degrees, reset it, set the second shape to non-respondable, and start all over with the first joint and its shape.
Cheers

Justus
Posts: 15
Joined: 24 Jan 2017, 07:37

Re: Efficient curved conveyor using angular velocity instead of path

Post by Justus » 17 May 2017, 19:19

The 2nd option works (thanks!) but adds some extra shapes and joints, so I'm trying to work out your first suggestion.

I can rotate the shape around the correct axis (using simRotateAroundAxis), like so:

Code: Select all

m=simRotateAroundAxis(m,{0,0,1},{-2,0,0},math.rad(speed))
simSetObjectMatrix(forwarder,-1,m)
Should I use this matrix to calculate a combination of linear and angular velocities? Maybe you can explain a bit more about adding initial rotation and an initial translation?

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

Re: Efficient curved conveyor using angular velocity instead of path

Post by coppelia » 26 May 2017, 15:08

The initial rotation velocity component (i.e. G) would be the same as you did previously. But in addition, you need to figure out an initial linear velocity. That velocity is basically: R*G, where R is the distance to the rotation center.

Probably you have to transform that velocity into an X and Y velocity component, depending on the bounding box of your shape. And for that, you can use the shape matrix.

Cheers

Justus
Posts: 15
Joined: 24 Jan 2017, 07:37

Re: Efficient curved conveyor using angular velocity instead of path

Post by Justus » 01 Jun 2017, 19:27

Works like a charm:

Code: Select all

simSetObjectFloatParameter(forwarder,sim_shapefloatparam_init_velocity_g,speed)
simSetObjectFloatParameter(forwarder,sim_shapefloatparam_init_velocity_x,speed*-factor)
simSetObjectFloatParameter(forwarder,sim_shapefloatparam_init_velocity_y,speed*factor)
Where factor=outer radius of the conveyor/2 (in case of a 90 degree angular conveyor). When creating a 45 degree conveyor, calculations are a bit more complex.

Thanks!

Post Reply