# connecting dc motor to assembly

1 view (last 30 days)
Yasin on 31 Aug 2023
Edited: Nathan Hardenberg on 5 Sep 2023
hello in my model, i have assembly below. i have a dc motor (black object) which grey shaft is connected to. i want to connect a dc motor to my blocks, and give torque&rotational velocity of the motor. how can i do it? i used cylindirical joint between gray hub and shaft, i can give motion with wave blocks, but i just can give velocity not torque in that way. thank you for attention.

Nathan Hardenberg on 1 Sep 2023
First of all I would recommend a "Revolute Joint" instead of a "Cylindirical Joint". A cylindrical joint can also move linearly along the rotation axis, which is most likely not what you want. A revolute joint does only rotation.
Secondly, it is not possible to directly provide a velocity. But you can provide motion according to your desired velocity, because position s(t) is the integral of velocity v(t):
Simply integrate your desired velocity and you get the according position.
If you have a constant velocity you can also directly use a "Ramp"-Block and enter your velocity as the "Slope" value.
Revolute Joint Settings:
• Actuation > Torque > Automatically Computed
• Actuation > Motion > Provided by Input
Converter Settings:
• Filter input, derivatives calculated
• Second-order filtering
Yasin on 4 Sep 2023
Thank you for your help Nathan, but here my part does a translational motion as well. That's why it is not possible using revolute joint (only rotational movement) here. Also can I ask do you know a way giving motion with a DC motor (torque and velocity simultaneously) instead of joint inputs?
Nathan Hardenberg on 5 Sep 2023
Edited: Nathan Hardenberg on 5 Sep 2023
Okay, the actuation works the same as in a revolute joint. But you should also define the movement/position of the linear movement in a similar way.
Providing torque and velocity simultaneously is not possible, since it does not make sense! Torque is a function of position/velocity and velocity is a function of torque. Think about it: If you supply a torque to an object, it will start to accelerate accordingly. And if you set a velocity it will always have that velocity.
The question now is which case you want and this depends on you usecase. Maybe tell a bit more on what you want to achive

### Categories

Find more on Multibody Dynamics in Help Center and File Exchange

R2023a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!