Hello guys, I am programming a virtual simulation of CNC milling machines. I created a model which contains the kinematics - axes with limits etc. I also implemented a function, which calculates the axis values, so that the tool follows the mouse which points to the surface of the workpiece. This works fine, the problem is only when the workpiece is moving together with the table and not only the head around the workpiece (one axis is on the table which the workpiece is on). In this case, the workpiece moves so in the next step, the mouse points to another place of the workpiece. This results into an uncontrolled jumping of the machine axis.
I tried to handle this with moving the camera the same vector as the workpiece moves, so that then it looks like that the workpiece stays always in the same position (and the machine is moving around) - watch video. This is working ALMOST fine, but sometimes there is still jumping of the tool. Here are the steps what I do in the MOUSE DRAG event handler 1. I store original axis values. 2. I make an intersection on the workpiece using osgUtil::LineSegmentIntersector. 3. I set all axis values to 0 and apply them using setMatrix() on axis nodes (which actually inherit from osg::MatrixTransform). 4. I calculate the new axis values and apply them using setMatrix() on axis nodes. 5. I perform a camera movement dependent from the axis value change. I assume that there can be a problem with intersection - is it possible that I get an intersection from a frame before? I found out that If I make faster movements, the jumping is bigger. Or can it be maybe caused by multitreading? I don't know the background exactly. If you watch the video attached, you will see that the workpiece is never jumping, only the tool. Thank you for reading and watching! I look forward for your suggestions. Cheers, Peter ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56597#56597 Attachments: http://forum.openscenegraph.org//files/machine_tool_jumping_773.zip http://forum.openscenegraph.org//files/screenshot_103.png _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

