Marco, You do not indicate what version of the PyChrono conda package you are using. >From your message, I infer that this is likely a package corresponding to the >current main development code. However, that doesn’t seem to be consistent >with some line numbers you refer to. Please make sure you look at the right >demo for whatever PyChrono distribution you are using! Please see the notice >(marked in red) at the top of >https://api.projectchrono.org/tutorial_table_of_content_pychrono.html
Having said that, the scripts in src/demos/python/chrono-tensorflow/envs/ were out-of-date. I pushed a fix to update them to the latest Chrono API. Keep in mind that these are not included in any PyChrono conda package yet! My suggestion would be to: 1. Use the C++ API if possible. 2. If you must stick with Python, build your own PyChrono from the C++ sources instead of using a conda package. In either case, use the latest Chrono code, in the ‘main’ branch of the GitHub repository. (As a side note, to answer your question about ChFrame, in Python you should be using ChFramed – look for other uses of this in the very same script). --Radu From: [email protected] <[email protected]> On Behalf Of Marco Zanichelli Sent: Friday, April 19, 2024 11:10 AM To: ProjectChrono <[email protected]> Subject: [chrono] Chtrain_pendulum Dear all, I am new to project chrono, I have installed pychrono via anaconda on windows and I have been running some tests. My goal for the moment would be to run a MB simulation of an inverted pendulum, with the later goal of producing a simulation of an inverted pendulum on a cart. I have seen that at the path "demos\chrono-tensorflow\envs" there is already available a script that should already do the latter. The problem I'm having is that the demo does not seem to run on the version of pychrono I am using (the latest build for win). I will now refer to the files env_test.py and chtrain_pendulum.py . The first issue I face is with: self.body_rod_shape = chrono.ChVisualShapeCylinder() self.body_rod_shape.GetCylinderGeometry().p1= self.cyl_base1 self.body_rod_shape.GetCylinderGeometry().p2= self.cyl_base2 self.body_rod_shape.GetCylinderGeometry().rad= self.radius_rod For which I get the error telling me that the ChVisualShapeCylinder has no attribute GetCylinderGeometry. I have worked around this problem by just assigning a radius and height to the first of those 4 lines and discarding the other 3, not sure if that is a good solution. The problem that I have not be able to fix is related to ImposeAbsoluteTransform which I found in rows 143 and 147 of the chtrain_pendulum.py file. By looking at the documentation for the C++ version, that method is supposed to take as argument a ChFrame, whereas in the demo the argument given is a ChCoordsysd built with a ChVector3d. ImposeAbsoluteTransform(chrono.ChCoordsysd(chrono.ChVector3d(0,0,0))) This gives an error so I tried to build a chframe as follows: ImposeAbsoluteTransform(chrono.ChFrame(chrono.ChCoordsysd(chrono.ChVector3d(0,0,0)))) but the error is telling me that ChFrame does not exist in pychrono. How can I fix this issue? Is there anywhere a specific documentation for pychrono or should I switch to the C++ version? I am sorry if I was unclear and I am of course available to give more information about this. Thank you in advance. Best regards, Marco -- You received this message because you are subscribed to the Google Groups "ProjectChrono" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/9c38cb0a-d450-4c42-90bd-13833456c537n%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/9c38cb0a-d450-4c42-90bd-13833456c537n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!J_caS_PIP6Hn16fUgx86Y7n19RR4b8xIQ3-L2vz2r8_-c43b_VFBE8CQjtOi-fYk3GTc3l9PanLYfvDIeg$>. -- You received this message because you are subscribed to the Google Groups "ProjectChrono" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/PH0PR06MB8237F060EC5DEBA40F0CE516A70C2%40PH0PR06MB8237.namprd06.prod.outlook.com.
