I need help understanding a method for mechanism, namely CalculateInverseKinematics(RsTarget, RsToolData, Boolean, Double). I’m receiving data from a kinect which delivers
calculations of a distance between two targets in x-, y-, z-axis (in meters) and I want to use that direction and distance to guide a virtual robot. You can see a picture of an example at the bottom what the Kinect does, it calculates the distance between the pink dot and the center of the red marked hand. I want the pink dot to represent the virtual robot tcp’s current position and the marked hand is the direction and distance I want the virtual robot to travel to.
So my following questions are: Can I use CalculateInverseKinematics mentioned above to achieve this? If so, could someone explain how it works thoroughly and how I should use it, as I’m a beginner in programming in C# for RobotStudio.
Each axis and its calculated distance is separately sent to another class for processing the data:
// Send calculated distance to the KinectData class for processing
myKinectData.DistanceX = calcDistanceX;
myKinectData.DistanceY = calcDistanceY;
myKinectData.DistanceZ = calcDistanceZ;
Example of distance in x-, y-, z-axis between the
dot and red marked hand
I don’t know if you can use the Calcinversekinematics - but why don’t just send the x,y,z to the virtual controller and then calculate the next position as follows (in psedo code):
Wait for data from PC(analyzed kinect data)
Calc current robtarget
add the X,Y,Z
Move to new Target
And do these 4 steps in a loop.
If you implement it in C# and using Robotstudio, you won’t be able to send the data to a real robot etc ?
You could be right DanLars, as I said I’m still a beginner in robotstudio programming with C# so still looking for all methods Could you possibly give an example of how I can do like your example and/or there’s anything I can look up in the RobotStudio 6.0 SDK reference manual?
I think if I could connect it to a Controller through RobotStudio, it is highly possible to send data to a real robot and move it, that’s my end goal anyhow
Lars is right, the method CalculateInverseKinematics of RobotStudio SDK is intended to be used when testing for example reachability in a simulation environment. You can use related APIs to set the joint values of a virtual robot in the simulation environment.
Example:
RobotStudio has a function “Check reachability”. You specify a robtarget and we check if the robot can move to it with a given configuration. If successful the robot model in the 3D window moves its TCP to this position in order to indicate that its possible. If you like this position you create a robtarget in the RAPID program and this program can be executed and further verified by the Virtual Controller, and then transferred to the real robot.
The use of CalcInverseKinematics and SetJointValues has nothing to do with moving a real robot using RAPID, or moving a virtual robot using RAPID.
Of course you may find a use for CalcInverseKinematics which is different from the above example. I just want to help you avoid spending lots of time to do something that only works in the simulation environment and cannot be transferred to the real robot.
I think you should look into Lars suggestion. You can develop the RAPID program and the PC SDK program on your PC. The Virtual robot will move according to the input from PC SDK and you can see this on the Online Monitor in RobotStudio.
Lets see if we “agree” on the concepts before digging into the details.
I believe I’m starting to understand and it may be best if I’m doing it in the way you two are trying to explain. Hope you maybe can guide as this is my first project working with PC SDK towards RobotStudio! And thanks again for the reply!