-
Notifications
You must be signed in to change notification settings - Fork 29
Command SetPlacement
The command SetPlacement allows to set the Origin property of Joints and the MountedPlacement of Links. The core principle is that you select the joint or the link you want to set the property for and then you select two local coordinate systems (LCS). The property will then be equal to the transform from the first selected LCS to the second one.
The command SetPlacement relies on local coordinate systems (LCS). This means that you also need a body because LCS must belong to one. To create LCSs, activate the Part Design workbench:
Then, add an LCS with (cf. below) and place one LCS where each joint will be. You must add one LCS for the parent joint and one LCS for each of the child joint, which means that each joint will have two LCS, one on the parent link and one on the child link, and the SetPlacement command will bring them together. See the official documentation for details about LCSs.
The command SetPlacement can be reached from CROSS's toolbar, , from the menu "CROSS/Set placement", or via the keyboard shortcut "S P" ("s", then "p"). You can hover over the button with the mouse to get an hint how to use the command.
Select either
- a CROSS::Joint, the LCS of the parent link, and the LCS of the child link on the same link,
- a CROSS::Joint, the "child" LCS on the parent link, and the "parent" LCS on the child link.
The Origin property of the joint, which will then be the origin tag of the export URDF, will be set to the transform from the first selected LCS to the second one.
Let's take the robot_5r from the cross_test_files repository as starting point.
See there for installation, open the fc_files/empty.FCStd
file in FreeCAD and launch the robot_5r
macro.
Delete the joints forearm_hand
and arm_forearm
as well as the links hand
and forearm
.
Select arm
in the tree and create a new joint that will then have arm
as parent.
To be able to select the LCS in the 3D view, hide the link shoulder
.
As of March 2024, CROSS::Links cannot be made invisible, you have to make invisible all the link's children as shown below.
Select the joint in the tree.
Then, select the LCS located at the parent joint in the 3D view.
At last, select the LCS located at the child joint in the 3D view.
Running the SetPlacement command (cf. below) will lead to no apparently no visible result because the absolute placement of a joint is not computed as long as the joint has no parent link.
To show-up the joint position, let's add a link, which will be needed to continue modeling anyway. Select the joint and use the Add Link command.
The MountedPlacement is used to bring the shapes that constitute the link to the correct position. This placement is the transform from the origin of the shape to the location of the joint that is parent of this link.
Let's take a real-world example from the CAD file of Mitsubishi's RV-5AS because it can be downloaded from internet without registration.
Unpack the file and open it in FreeCAD (leave the Use LinkGroup
option unchecked).
Let us concentrate on the object RV5AS_J5_WRIST_MODEL and use it to illustrate the MountedPlacement property. Follow these steps:
- Select the part RV5AS_SO-ASSY_MODEL_ASM and make it the active object (right-click or double-click)
- Select the object RV5AS_J5_WRIST_MODEL and make a new PartDesign::Body (ignore the warning about multiple solid), a link to the original object is created inside the body.
- Create 1 local coordinate system as stated above and illustrated below, where the joint of the parent link needs to be (we'll use it later). Select the body, which should be the active body, and choose "Create a local coordinate system" from the PartDesign Workbench.
- Hide the part RV5AS_SO-ASSY_MODEL_ASM (right-click or "space")
- Create a Robot, 2 Links, and a Joint.
- Set the first link as parent of the joint and the second one as child.
- Set the joint type to
revolute
to be able to actuate it. - Select the second link in the tree and click on the "…" on the right of its
Real
property and select the body created earlier. - You can see that the joint axis (the z-axis, in blue) is not aligned with the cylindrical shape of the link
- To align it, set MountedPlacement to Position (0, 0, 5.3) and Yaw-Pitch-Roll (-180, 0, 90)
- By changing the joint angle in the Robot object, you can see that the link's rotation is now correct because the joint is aligned with the local coordinate system
Now, let us reproduce this with the SetPlacement command.
Select the link Link001 in the tree.
Ctrl-select the LCS in the 3D view.
Ctrl-select the link Link in the tree (we use this object because it has a null placemement).
Run the SetPlacement command to set the MountedPlacement property.
The MountedPlacement property will be set such that it corresponds to the transform from the LCS (which has the Placement App.Placement(App.Vector(0, -5.3, 0), App.Rotation(0, 0.70711, 0.70711, 0))
i.e. rpy: (90, 0, -180) deg before calling the SetPlacement command) to Link
.