Problem with protobot's sensor plugin

9 views
Skip to first unread message

David Estévez Fernández

unread,
May 30, 2012, 8:03:21 AM5/30/12
to oo...@googlegroups.com
Hello everybody!

I'm trying to make a derivative of the sensor plugin to use it with Obijuan's miniskybot, so I downloaded the sources and I compiled them to figure out how it works.

I have no problems compiling and executing the code, but the openscad file that is generated is not rendered correctly. More precisely, the part that is not rendered correctly is the "body", the part that is the intersection of a triangular prism and a rounded tablet. When I compile the code in openscad only the rounded tablet is shown.

If I use the debug operator (#) to show the triangular prism it is not show, and I think is because it has the normals towards the inside instead of towards the outside of the prism. However, as you have been able to render it correctly and upload it to the thingiverse, the problem may be other.

--
---
David Estévez Fernández
plugin01(render).png
plugin02(stl)png

Alberto Valero Gomez

unread,
May 30, 2012, 8:32:52 AM5/30/12
to oo...@googlegroups.com
Have you used F6 to generate the view? Because if that is the view generated with F5 the intersection is not shown. 

Alberto.

David Estévez Fernández

unread,
May 30, 2012, 8:47:57 AM5/30/12
to oo...@googlegroups.com
Yes I have done both, in the pictures, plugin01.png is the render with F5 and plugin02.png is the compilation with F6.

2012/5/30 Alberto Valero Gomez <alberto.va...@gmail.com>

Alberto Valero Gomez

unread,
May 30, 2012, 9:02:36 AM5/30/12
to oo...@googlegroups.com
As recently we changed the polygon class I suggest you to change the order of the triangle points to check if you are right with the normals.  Or try to render just the triangle to check if it comes ok.

Alberto.

David Estévez Fernández

unread,
May 30, 2012, 9:41:48 AM5/30/12
to oo...@googlegroups.com
After a few changes of points, when I arranged them counterclockwise, the normals when outside and now it renders it correctly, thanks!

Alberto Valero Gomez

unread,
May 30, 2012, 9:42:18 AM5/30/12
to oo...@googlegroups.com
Thanks to you David!

David Estévez Fernández

unread,
May 30, 2012, 9:48:01 AM5/30/12
to oo...@googlegroups.com
I still have curiosity in the way ooml create polygonal prisms (as polyhedrons instead of extruded polygons).

Maybe I am wrong, but since that is the way one would do it in openscad, I think of the extrusion as a more straightforward way to perform them, and would solve most of the problems with normals, as you would only have to be sure about the orientation of the normal of the polygon, not all the normal of all the faces of the polyhedron.

Alberto Valero Gomez

unread,
May 30, 2012, 9:53:18 AM5/30/12
to oo...@googlegroups.com
David, you may be right.

The reason to choose a polyhedron is that it renders the prism with triangles, generating a cleaner and smaller stl. But if it keeps giving problems we can change it and do it extruding the polygon. If you find more problems let us know.

Alberto.

David Estévez Fernández

unread,
May 30, 2012, 10:05:50 AM5/30/12
to oo...@googlegroups.com
Well, I have finish to compile the model (F6) and I am afraid I may have gone too fast saying that it was solved. The compiled model is still not performing correctly the intersection, I have rotated the view (the rendered with F5)  and it seems the only polygons of the polyhedron that have the normals correctly are the upper ones (the ones that I could see without rotating the model).

I'm going to fix it the quick way (changing the lines in the openscad code by a linear extrusion), as a momentary solution, but as I have also to finish the new repy module, I will have to deal with more prisms, so I can send more feedback on this topic.

Alberto Valero Gomez

unread,
May 30, 2012, 10:18:47 AM5/30/12
to oo...@googlegroups.com

I will implememt the linear extrusion tomorrow. Thanks david

Alberto Valero Gomez

unread,
May 31, 2012, 4:27:11 AM5/31/12
to oo...@googlegroups.com
David.

I have changed the prisms to linear extrusion. svn up your ooml and remember to make and make install in order to have the new version available for your things.

Please, let us know if this has solved the problem.

Alberto.

David Estévez Fernández

unread,
May 31, 2012, 12:23:32 PM5/31/12
to oo...@googlegroups.com
The problem with the normal is corrected, but for some strange reason the height of the linear extrusion is half of the height of the prism with the previous method.

I have attached an image showing the problem.

PS: I have not changed anything, the code is the same as yesterday.

2012/5/31 Alberto Valero Gomez <alberto.va...@gmail.com>
plugin03.png

Alberto Valero Gomez

unread,
May 31, 2012, 12:30:53 PM5/31/12
to oo...@googlegroups.com
The reason is that now the Prism is not over the xy, but centered on the origin. So half up half down. I will correct it to be on xy

Alberto.

David Estévez Fernández

unread,
Jun 4, 2012, 11:04:31 AM6/4/12
to oo...@googlegroups.com
I have made some tests and I think the extrusion is half the height, not displaced, because I looked for the "linear_extrude" instruction in the generated scad code, multiply the height by 2 and the model was displayed correctly.

However, modifying the height parameter in the ooml code does not affect the scad code generated, i.e the linear extrusion is always 2.5 mm, whatever value I put as parameter.

Alberto Valero Gomez

unread,
Jun 4, 2012, 12:00:06 PM6/4/12
to oo...@googlegroups.com
Hey David,

I cannot replicate your problem. In my computer it works properly. Are you sure that you have svn up, make, sudo make install?

In any case, I changed the prism so that now is over the xy plane, and not centred.

Please, if you keep on having the same problem, send me the c++ code and the openscad generated code.

I have used this:

int main(int argc, char **argv)
{
  IndentWriter writer;
Polygon<Point2D> base;

    base.addPoint(Point2D(1.0, 2.0));
    base.addPoint(Point2D(1.0, -2.0));
base.addPoint(Point2D(-1.0, -1.0));
    base.addPoint(Point2D(-2.0, 1.0));

  Component prism(PolygonalPrism(base, 5.0));

  writer << prism;
std::cout << writer;

return 0;
}

Best

David Estévez Fernández

unread,
Jun 5, 2012, 6:46:52 PM6/5/12
to oo...@googlegroups.com
I keep obtaining the centered prism, with both your example and the protobot plugin.

I am currently at revision 602 and I compiled and installed ooml successfully.

2012/6/4 Alberto Valero Gomez <alberto.va...@gmail.com>

Alberto Valero Gomez

unread,
Jun 5, 2012, 6:57:10 PM6/5/12
to oo...@googlegroups.com
Try now with revision 604

Alb

David Estévez Fernández

unread,
Jun 6, 2012, 4:39:37 AM6/6/12
to oo...@googlegroups.com
Now it works! Thank you very much!

2012/6/6 Alberto Valero Gomez <alberto.va...@gmail.com>
Reply all
Reply to author
Forward
0 new messages