Assembly4: Strange behaviour when rotating LCS about Y axis

Discussion about the development of the Assembly workbench.
heron
Posts: 131
Joined: Mon Apr 20, 2020 5:32 pm

Re: Assembly4: Strange behaviour when rotating LCS about Y axis

Postby heron » Wed May 19, 2021 1:55 pm

Hello keithp,
Very strange :?:
keithp wrote: Wed May 19, 2021 8:51 am I unzipped the AngleTest2 file and I see that the properties Animation Hints/Animation Hint List and Base/Expression Engine are both present in the file. They only appear in the Property pane if the Show all option is ticked (right click in the Property pane to see/change this).

Is it possible that you have Show all turned on for one document and not for the other? Another possibility is that these properties are only written to the file when it is saved, so if you hadn't saved your file after running Animate Assembly, they may not have been present.
Ok, Now I can watch them in my file too. I did the previous test in other PC, but with the same SO and Freecad and Assy4 versions. I don't know what's hapenning. This night will come back to test.
keithp wrote: Wed May 19, 2021 8:51 am I've tried different ways of creating and attaching the LCS, but I always get the strange Y axis behaviour.
My way:
- Create a new Assembly Model
- Create a new Coordinate system in a Part (LCS_1) and attach to LCS_Origin with mode XY on plane
- Add Variable -> Type : Float -> Name : rot -> Value : 0
- Select LCS_1 in model tree, select Attachment Offset/Angle field in Property View and introduce the Expression -> Variables.rot
- Set manually the Attachment Offset/Axis -> [0,00 1,00 0,00]
- Run Animate Assembly
simple_rot.png
simple_rot.png (106.56 KiB) Viewed 1018 times
- Everything is OK, File attached
keithp wrote: Wed May 19, 2021 8:51 am It would be very helpful if you could point me to the part of the manual which explains how you created your file.
For example in this tutorial: https://github.com/Zolko-123/FreeCAD_Ex ... /README.md
keithp wrote: Wed May 19, 2021 8:51 am I agree. I don't understand it either!
Are you kidding me? :lol:
I can't create 3 Variables (AngleX, AngleY, AngleZ) and without setting any expression simply by executing Animate Assembly they change the axis of rotation automatically and at the same time increase the angle attachment offset.
It would be great if you could show me your way of doing this.

Cheers!!!
Attachments
AngleTest3.FCStd
(7.56 KiB) Downloaded 32 times
heron
Posts: 131
Joined: Mon Apr 20, 2020 5:32 pm

Re: Assembly4: Strange behaviour when rotating LCS about Y axis

Postby heron » Wed May 19, 2021 10:39 pm

Hello again,
.
keithp wrote: Wed May 19, 2021 8:51 am I unzipped the AngleTest2 file and I see that the properties Animation Hints/Animation Hint List and Base/Expression Engine are both present in the file. They only appear in the Property pane if the Show all option is ticked (right click in the Property pane to see/change this).

Is it possible that you have Show all turned on for one document and not for the other? Another possibility is that these properties are only written to the file when it is saved, so if you hadn't saved your file after running Animate Assembly, they may not have been present.
Yes, I can see the Animation Hints/Animation Hint List field of Variables, is there, and the Base/Expression Engine of LCS_1 is there also. I promise that yesterday I couldn't see it. Above all, I would swear that the Base/Expression Engine of LCS_1 box was blank, there were only the brackets, in which I tried to write without success. Ok, let's forget this :?

Moreover, I want to attach a gif exported with the new tool of Assembly 4, because the last I was not very good.
lcs_rot_y.gif
lcs_rot_y.gif (162.95 KiB) Viewed 991 times
My apologies for the offtopic, How is it done to reduce the size of the gifs here in the forum?

Cheers!!!
keithp
Posts: 7
Joined: Fri May 14, 2021 1:42 pm

Re: Assembly4: Strange behaviour when rotating LCS about Y axis

Postby keithp » Thu May 20, 2021 11:01 am

Hi heron,

Thank you for your explanation. I think I now see the difference between the way we've done things.

FreeCAD has two ways of referring to angles: a) specifying the axis of rotation and the angle to rotate about that axis, and b) specifying the angle to rotate about each of the X, Y and Z axes (called Euler angles). Your file uses the first, while mine uses the second.

The first representation can use quaternions, which are mathematically robust, but generally not easy to visualise. I understand FreeCAD uses this representation internally. In contrast, Euler angles are intuitive (they correspond to roll, pitch and yaw of an aircraft, for example), but they have a problem called gimbal lock, which means they don't work correctly in certain circumstances.

Zolko mentioned in an earlier comment that he suspects the strange Y axis behaviour is due to gimbal lock.

For rotations about a single axis, the axis of rotation / rotation angle representation is fine, and is always well behaved. Where it is necessary to represent something with more axes of rotation, such as the attitude of an aircraft or the pose of the end effector on a robot arm, the Euler angle representation may be more useful.

FreeCAD allows you to set expressions for either the angle of rotation about an axis (your rot variable) or the three Euler angles (my AngleX, AngleY, AngleZ variables), but the ways of doing each are different and it does not appear to be possible to use both options together.

As you show in your screenshot, expanding Attachment Offset in the Properties pane shows Angle (set to rot by an expression), along with Axis and Position. There's no sign of the Euler angles. If you now click in the Value field of Attachment Offset, a button with three dots appears on the right. Clicking that opens a dialog with a menu with two options for rotation: Rotation axis with angle and Euler angles. Choosing Rotation axis with angle allows you to specify both, but only as values; the little function icon which allows you to enter an expression is absent. Choosing Euler angles gives fields for angles around each axis, and you can enter expressions for them. This is what I did to get AngleX, AngleY and AngleZ to work.

In summary, it appears that my Y axis behaves strangely because I use Euler angles and yours behaves properly because you use rotation axis with angle.
heron
Posts: 131
Joined: Mon Apr 20, 2020 5:32 pm

Re: Assembly4: Strange behaviour when rotating LCS about Y axis

Postby heron » Fri May 21, 2021 12:57 am

Hello keithp,

Now, I understand it also. I didn't know were you introduced the expressions of variables angles. Thank you very much for your explanations.

By the way, the robotic leg is very cool.

Cheers!!!