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.
Related
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.
I have 2 sensors: on an upper arm and on a hand, each gives me a quaternion (or Euler angles) of its position in global 3d space, do you have any ideas, how can I find the forearm position?
For example, I need this value to solve the issue:
when I hold my hand on a table and move up my upper arm (like a wing), the program thinks that I move my hand up together with the upper arm.
The situation you describe sounds like an inverse kinematics problem. In effect, this is the way of determining the required angles (and by extension, positioning) of intermediate joints in a limb (or other jointed object) based on the desired position of its free end (the end effector).
Rather than tackling this difficult mathematics question on your own, you may want to look at Unity's own inverse kinematics implementation. However, this might not be feasible if you can't adapt your in-game object(s) to an Animator.
You could also code a solution on your own. Creating a generic solution to this problem is extremely mathematically complex - but you've got some extra information available to you: the actual angle and positioning of the hand and upper arm. If you specify either the forearm length or upper arm length (you can even derive this mathematically, up to you!), then some light linear algebra should be enough for your purposes (provided your sensor readings are correct).
If you specify a forearm length FL, then you need to find the point of intersection (the elbow) along the upper arm's direction vector which is distance FL from the hand. Alternatively, if you specify an upper arm length UL, you just need to move UL/2 down the upper arm's direction vector (since the position is in the middle of the upper arm) to get the elbow position.
In both cases, once you have the elbow position, it's trivial to get the forearm position and angle. Here's a diagram for visualization of the problem:
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.
How can I create radial images like this (see images below)
My goal is to control the number of radial arms, thinkness, along with the angle they are created. I'm trying to create patterns that will show me different Moiré patterns when overlapped and turned / animated in octave / matlab.
PS: I'm using octave 3.8.1
I've tried the code here but it doesn't give me the fine tuning all of the following parameters, of radial arm amount, angle, and thickness. Also the image package is needed which I'm trying to avoid.
http://www.mathworks.com/matlabcentral/answers/uploaded_files/20287/moire_pattern.m
As I see it the two approaches which would be worth investigating first are equations and patches.
You could for instance generate a generic equation for an arm with parameters to control the rotation angle and the shape of the curve. You could then plot that at each of a given number of rotation angles, with varying linewidths (a plot property not an equation parameter). Your equation would probably not look pretty as you'd be best off specifying it parametrically (in terms of a third variable) or in polar coordinates, and then translating it to cartesian for the plot commands.
With patches you'd be computing the outline of the arm (as opposed to the centreline) and would probably find it convenient to generate the patch for one arm and then transform it for each rotation. This would be a one-liner with the appropriate rotational transform matrix, and the expression you use to generate the arm wouldn't need to be nearly so complex as it wouldn't need to handle the rotation. A quadratic might even do at a push.
Another advantage of patches is that, having generated an arm and rotated it around, you could also flip it and generate the figure with the opposite sense for very little extra code.
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