Awesome
RelaxedIK Unity
You can find an introduction and the citation information of RelaxedIK in the README of RelaxedIK Core which is a submodule of this repo. It is recommended to look at RelaxedIK Core before working with this wrapper.
This wrapper allows users to use RelaxedIK in Unity on Windows. A few commonly used simulated robot arms have already been set up for you to play with. In the simulation, you will be able to disable or enable RelaxedIK as you like. When RelaxedIK is disabled, a joint angle writer panel will show up for you to adjust and visualize the joint angle configuration. When RelaxedIK is enabled, you will be able to have real-time interactions with RelaxedIK by dragging the transform gizmo associated with the gripper of the robot.
RelaxedIK Family
More information about RelaxedIK, Collision IK, and all the wrappers could be found in this documentation.
- RelaxedIK (Deprecated)
- RelaxedIK Core
- RelaxedIK ROS1
- RelaxedIK Unity
- RelaxedIK CoppeliaSim
- RelaxedIK Mujoco
RelaxedIK (Deprecated) | RelaxedIK ROS1 | RelaxedIK Unity | RelaxedIK Coppeliasim | RelaxedIK Mujoco | |
---|---|---|---|---|---|
RelaxedIK | :o: | :o: | :o: | :o: | :o: |
Collision IK | :x: | :o: | :x: | :x: | :x: |
Dependencies
- To use this wrapper, you will first need to install Rust. Please go to https://www.rust-lang.org/learn/get-started for more infomation.
- You will also need to install Unity. Version 2020.3.5f1 or newer is recommended. An older version might or might not work dependending how old it is.
Getting Started
- Make sure that you have installed all the dependencies.
- Clone this repo to your windows machine and open the subdirectory RelaxedIK as a Unity Project.
- Initialize relaxed_ik_core (the Rust library of RelaxedIK) as a submodule by running the following command from the project directory:
git submodule update --init
- Navigate to the relaxed_ik_core folder and go through the steps below to get relaxed_ik_core ready.
- If your robot is in this list: [baxter, hubo, iiwa7, jaco7, panda, sawyer, ur5, yumi], ignore this step. Else, you will need to clone this repo and follow the step-by-step guide there to get the required robot config files into corresponding folders in the config folder in the core. To specify, there should be (replace "sawyer" with your robot name or your urdf name in some cases):
- 1 self-collision file <collision_sawyer.yaml> in the collision_files folder
- 4 Rust neural network files <sawyer_nn, sawyer_nn.yaml, sawyer_nn_jointpoint, sawyer_nn_jointpoint.yaml> in the collision_nn_rust folder
- 1 info file <sawyer_info.yaml> in the info_files folder
- 1 joint state function file <sawyer_joint_state_define> in the joint_state_define_functions folder
- 1 urdf file <sawyer.urdf> in the urdfs folder.
- Compile the core:
cargo build
- If your robot is in this list: [baxter, hubo, iiwa7, jaco7, panda, sawyer, ur5, yumi], ignore this step. Else, you will need to clone this repo and follow the step-by-step guide there to get the required robot config files into corresponding folders in the config folder in the core. To specify, there should be (replace "sawyer" with your robot name or your urdf name in some cases):
- If you are adding a new robot arm instead of working with an existing one, aside from generating robot config files in the last step, you also need to
- Follow the steps at ros-sharp wiki to set up the simulation of the new robot arm in Unity. Please make sure that the urdf file has inertia information in it, otherwise the joints may not be set up correctly.
- Once the robot arm is loaded, add the RelaxedIKUnity script in Assets/Scripts to it. Set up the list of robot Limbs and end-effectors by adding the corresponding game object to the list. The size of this list should be the same as the size of joint angle solution array published by RelaxedIK for that robot. You can refer to the corresponding <xxx_info.yaml> for how many and the order of links to add to the list. Be careful that you only want to add those links with the Hinge Joint component which imply that they are associated with revolute joints.
- You also need to drag and drop the transform(s) of the end effector(s) and the pose goal prefab (which can be found at Assets/Prefabs/PoseGoal) to the RelaxedIK Unity component.
- On the component of the UrdfRobot script, enable Is Kinematic and All Convex Colliders and disable Use Gravity and Use Inertia from URDF.
- Optional: Add a child named ViewCenter to the robot arm to configure the position of the camera at runtime.
- Copy and paste the new dll file which you can find in
relaxed_ik_core/target/debug/relaxed_ik_lib.dll
toRelaxedIK/Assets/Plugins/relaxed_ik_lib.dll
. - Set the gameobject of a robot arm as active to play with it. Make sure only one robot arm is active at the same time.
- Click play in Unity. Hold left Alt key and use your mouse to navigate the camera. Use the GUI on the left side to play with the robot arm. Have fun!
Existing issues
- Lack of flexibility to customize the fixed frame of a robot. For example, in the case of hubo, we are not interested in the legs of hubo and would like to define its waist as the fixed frame.
- There is a hard-coded coordinate system transformation to sort out the difference of the coordinate system in Unity with that in Rviz in RelaxedIKUnity.cs.
The signature of that function is:
private Vector3 TransformUnityToRviz(int idx, Vector3 v)
. - Collision IK is not set up in this wrapper. The key issue of setting it up would be communicating the environment representation in Unity with the Collision IK library.