Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Question ROS-Unity , changing spawn location in Unity

Discussion in 'Robotics' started by ninaetm, Mar 25, 2022.

  1. ninaetm

    ninaetm

    Joined:
    Jan 16, 2022
    Posts:
    1
    Hello,

    I am trying to create a robotic visualisation of a robotic station in Unity3D, controlled by ROS.

    I am using the TFAttachement on the robot joints, in order to receive TF from moveit in ROS.
    However, the trajectory movements only seem to work if the robot is located at 0,0,0 point in Unity.

    As I am planning to use multiple robots in the simulation, I am trying to find a way to be able to operate the robots in different locations.

    Changing these two lines of code from TFAttachement party works:
    transform.localPosition = Vector3.zero;
    transform.localRotation = Quaternion.identity;

    Removing them completely, shows the robot at complete disarray when tf comes in.
    On the other hand, trying to change it to another location f.e.:
    transform.localPosition = new Vector3(-2,0,0);
    transform.localRotation = new Quaternion(0,0,0,0);
    spanws the robot at correct location, but when a trajectory movement initiates, it seems to be rotating around 0.0.0 showing wrong movements...


    Any ideas on how to fix this?
    Thank you in advance

    Note: It appears that when entering play mode, new joints are created which are centered in 0,0,0 and contain as child objects the original joint (with the mesh). Is there a way to disable this or change it, because it looks like these empty objects which are created in runntime are causing the problem, as they are set to position 0.0.0
     
    Last edited: Mar 26, 2022