RobotStudio event

Has the method Body.CenterOfGravity changed?

scottdf93
scottdf93
edited November 2020 in RobotStudio
I have a tool that creates a frame at the center of a body object and was working fine until I updated the dlls to the latest SDK version.

Below is the code I use to create a frame at the bodys COG but now I've updated the dlls it places this frame relative to world not the part or body as was before. Also see the image, the frame named center of gravity is where the latest dll is putting the frame, the frame called frame1 is where the older version puts the frame (using the same code)



        private Frame GetTheMiddleOfTheBox(Body box, double offset)
        {
            Frame frame = new Frame();
            frame.Name = "CenterOfGravity";
            frame.Transform.X = box.CenterOfGravity.x /*+ (offset / 2)*/;
            frame.Transform.Y = box.CenterOfGravity.y;
            frame.Transform.Z = box.CenterOfGravity.z;

            return frame;
        }

If anyone can provide some guidance on this it would be much appreciated. 

Comments

  • As far as I can tell CenterOfGravity is relative to the Body's origin and that has not changed.
    To get the global position use 
    Vector3 globalCog = box.Transform.GlobalMatrix.MultiplyPoint(box.CenterOfGravity);


    Johannes Weiman
    Software Engineer
    RobotStudio Team, ABB Robotics