SimMechanics - Choose point of application of torque - matlab

I have a CAD model of a bar 25cm x 5cm x 2cm imported into SimMechanics.
On one of the sides, I have a small "hole", around which I have to apply a certain torque, to make the bar spin.
I have applied said torque through a revolute joint, but the axis of rotation is assumed by SimMechanics to be one of the edges, giving a "lopsided" rotation.
How can I shift the position of the torque to this specific point on the bar?

To answer my own question, the way I solved it was to add a Rigid Transform "after" the revolute joint.
What happened was that adding the Rigid Transform after the revolute joint essentially "shifted" the bar to the imaginary axis of rotation of the revolute joint, which was what I was looking for.

Related

Apply 1D Torque to 3D Revolute Joint without back reaction

the model is as simple as this: I'd like to apply a torque to the Rotational Flange of a Revolute Joint.
However, the torque reaction should not be applied to the Support Flange of the Revolute Joint.
The torque reaction is indeed counterbalanced elsewhere and not in the Revolute Joint itself.
A real-world example is a vehicle wheel: the torque is given by a powertrain and transferred to the wheel by a shaft, so the torque reaction is not perceived on the wheelhub but on the powertrain mounts.
So, none of the above seems to be correct:
in BLUE: there is a reaction on the Revolute frame_a that there shoudn't be. The support (white circle) seems to always balance the torque applied to the flange (gray circle)) but it doesn't make sense in this case;
in RED: there is no reaction on Revolute frame_a but there is no speed in the 1D line and this is not ok.
So, how can apply a Torque to a Revolute Joint without being forced to sense the counterbalanced torque directly on the joint?
Here the code
I came up with this solution that requires modifying the Revolute joint.
This is a minimal library with the modified Revolute Joint and a minimal example
Basically I just required that the torque on frame_a and frame_b is equal only along two directions orthogonal to the revolute axis (before they were equal along any direction).
And the torque called 'tau' provided by the auxiliary flange is applied along revolute axis direction only to frame_b, while for frame_a along this direction the torque is imposed to be zero.
This makes much more sense to me, but I'll be glad if someone proves me wrong.
As #tbeu just saw, I also sent an issue to the Modelica Standard Library GitHub, so it might be worth to wait for some official answer.

Simulink 3D Animation using VRML

I've set up an animation of a tugboat [from VRML library] using the Virtual Reality Animation objects. but am having trouble with viewing the rotation of the boat.
To be more specific: I have a simulator going, where I calculate from rigid body dynamics the trajectory of it in time. This is, I have x, y, z, phi, theta, psi vs. time. I associate the translations and rotations to the node corresponding to the boat. When pressing play, I can see the translation and rotation which is not as expected.
Not sure what the problem could be. I tried to add one Transform in the .wrl for each of the rotational degrees of freedom, but I found it weird as when I give rotation in one direction I see the object rotating and translating other directions as well.
Any help is most welcome.

Change Revolute Joint Axis in SimMechanics

I am leveraging SimMechanics, SimElectronics, and Simulink to model a quadcopter system for an embedded system class project ( files here ). I have generated a 2nd Generation SimMechanics model of an F450 quadcopter frame, including the motors and propellers. We were hoping to develop a model of a quadcopter with only a single rotational degree of freedom around either the x or y axis. I was hoping to model this with a revolute joint connecting the quadcopter frame to the "world frame". However, the "revolute joint" block in SimMechanics only acts around the z-axis. How can I change the axis of rotation for a revolute joint?
It appears that another individual has asked the same question, but no one has yet responded to his question.
See Assembling Multibody Models in the SimMechanics documentation, in particular the section on "orienting joints":
To obtain the motion expected in a model, you must align its various
joint motion axes properly. This means aligning the joints themselves
as observed or anticipated in the real system. Misaligning the joint
axes may lead to unexpected motion but it often leads to something
more serious, such as a failure to assemble and simulate.
You can specify and change joint alignment by rotating the connection
frames local to the adjoining body subsystems. For this purpose, you
specify rotation transforms using Rigid Transform blocks, either by
adding new blocks to the body subsystems or, if appropriate, by
changing the rotation transforms in existing blocks within the
subsystems.
Why change the orientation of joints through body subsystem frames?
The primitives in a Joint block each have a predetermined motion axis,
such as x or z. The axis definition is fixed and cannot be changed.
Realigning the connection frames local to the adjoining body
subsystems provides a natural way to reorient joints while avoiding
confusion over which axis a particular joint uses.
For an example of how to rotate joint connection frames, see Model
Mount.
So the answer is to use a Rigid Transform block to change the orientation of the frames, you cannot change the axis of the revolute joint.
I think you should change it in your CAD file. Change your propeller axis to align with z axis. But you should only change the propeller axis, not the whole body.

compute pitch, roll and yaw movement of an object in Matlab

I am currently working, with Matlab, on a 3D simulator whose aim is to move an object (currently it's just a simple circle) in space (using plot3).
Although it's easy to compute a trajectory without any rotation of my object, I do not manage to rotate my object around its own axis. Indeed, I have computed the 3 well-known rotation matrix but it (of course) rotate my object (represented by a set of points) around the axis of my figure (in the "world" system).
For example, the center of inertia of my object (currently the center of my circle) is I whose coordinates are (Xi,Yi,Zi). Thus, I suppose that I need to define an additional system for my object to be able to rotate my object about these 3 new axis composing such a system...
I would like something like:
[X2,Y2,Z2]=Mat*[X1,Y1,Z1] where [X1,Y1,Z1] is the coordinates of a point of my object before the rotation, [X2,Y2,Z2] the coordinates after the rotation and Mat the matrix I am looking for. Of course, the center of inertia must be unchanged whichever the rotation (yaw and/or pitch or/and roll)
However I have no idea about the way to compute such a matrix. The link below summarizes my wish.
Drawing of my problem

Using the iPhone accelerometer in a car

I want to use the iPhones's accelerometer to detect motions while driving. I'm a bit confused what the accelerometer actually measures, especially when driving a curve.
As you can see in the picture, a car driving a curve causes two forces. One is the centripetal force and one is the velocity. Imagine the iPhone is placed on the dashboard with +y-axis is pointing to the front, +x-axis to the right and +z-axis to the top.
My Question is now what acceleration will be measured when the car drives this curve. Will it measure g-force on the -x-axis or will the g-force appear on the +y axis?
Thanks for helping!
UPDATE!
For thoses interested, as one of the answers suggested it measures both. The accelerometer is effected by centrifugal force and velocity resulting in an acceleration vector that is a combination of these two.
I think it will measure both. But don't forget that the sensor will measure gravity as well. So when your car is not moving, you will still get accelerometer readings. A nice talk on sensors in smartphones http://www.youtube.com/watch?v=C7JQ7Rpwn2k&feature=results_main&playnext=1&list=PL29AD66D8C4372129 (it's on android, but the same type of sensors are used in iphone).
Accelerometer measures acceleration of resultant force applied to it (velocity is not a force by the way). In this case force is F = g + w + c i.e. vector sum of gravity, centrifugal force (reaction to steering centripetal force, points from the center of the turn) and car acceleration force (a force changing absolute value of instantaneous velocity, points along the velocity vector). Providing Z axis of accelerometer always points along the gravity vector (which is rare case for actual car) values of g, w and c accelerations can be accessed in Z, X and Y coordinates respectively.
Unless you are in free fall the g-force (gravity) is always measured. If I understand your setup correctly, the g-force will appear on the z axis, the axis that is vertical in the Earth frame of reference. I cannot tell whether it will be +z or -z, it is partly convention so you will have to check it for yourself.
UPDATE: If the car is also going up/downhill then you have to take the rotation into account. In other words, there are two frames of reference: the iPhone's frame of reference and the Earth frame of reference. If you would like to deal with this situation, then please ask a new question.