Skip to content

Command SetPlacement

Gaël Écorchard edited this page Sep 11, 2024 · 5 revisions

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.

Preparation

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:

Part Design in the Workbench Selector

Then, add an LCS with Add LCS icon (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.

"Add LCS" icon on the Part Design toolbar

Command

The command SetPlacement can be reached from CROSS's toolbar, SetPlacement Icon, 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.

Setting the Origin of joints

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.

Example

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.

Hide the shoulder link

Select the joint in the tree.

Select the joint

Then, select the LCS located at the parent joint in the 3D view.

Select the parent LCS

At last, select the LCS located at the child joint in the 3D view.

Select the child LCS

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.

Click on the SetPlacement command

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.

Add a link to show the joint's placement

Setting the MountedPlacement property of links

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).

Mitsubishi's RV-5AS in FreeCAD

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.

LCS for wrist

  • 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

Wrong MountedPlacement

  • 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

Correct MountedPlacement

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.

Clone this wiki locally