- Unity Version 2020.2+
- URDF Importer repo
- Niryo One URDF files from Niryo One ROS
- Working ROS environment
- Integrate the URDF Importer following these instructions
- Create a new directory in
Assets
and name itURDF
- Clone the Niryo One ROS repo and copy the
niryo_one_description
directory intoAssets/URDF
- This directory only includes a
.urdf.xacro
file which will need to be converted into a.urdf
file before we can import it- Run the following command to convert Xacro to URDF,
rosrun xacro xacro --inorder -o PATH/TO/niryo_one.urdf PATH/TO/niryo_one.urdf.xacro
- Copy the generated
niryo_one.urdf
file toAssets/URDF
- Right click on the this file and select
Import Robot from URDF
- Select the co-ordinate system in which the meshes were designed. Default mesh orientation is Y-up which is supported by Unity but some packages often use Z-up and X-up configuration. For more information.
- Select the Convex Mesh Decomposer you want to use for the imported robot. More information can be found here.
- Click
Import
- Run the following command to convert Xacro to URDF,
- By default a robot imported using the URDF Importer is loaded without any constraints or controller.
- A controller is pre-built in Unity URDF Importer to help showcase the movement of robots in Unity.
- To add the controller to an imported robot click the
Enable
button in the Inspector window in front of theController Script
option. This will add a Controller Script, FKrobot and Joint Control at runtime. - To prevent the joints from slipping set the
Stiffness
andDamping
to100,000
and10,000
respectively. - To be able to apply forces to the joints set the
Force Limit
to10,000
. - To prevent the robot from falling over, in the GameObject tree expand
niryo_one
->world
->base_link
and set the toggle forImmovable
for the base_link. - Press the play button to start the scene.
- Use the left and right arrow keys to select the articulation body you want to move.
- Use the up and down keys to move the articulation body clockwise and counterclockwise.
A guide to making a custom controller can be found here
Forward Kinematics scripts gives you the ability to see the current position of the end effector based on forward kinematics of the robot. You can use it to compare the end effector position of the robot of the articulation body to make sure the importer is working correctly.