New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Interaction plane to slithering snake example #107
Comments
Hi @matei1996 You cannot add If you want to add obstacles, you can add rigid cylinders and set contact between rod and cylinders. Here you can see the examples how to do. Let me know if this helps. |
Thanks a lot. Yes this helps me for now. Is it also possible to use something else than a cylinder as obstacle? I would like to into interaction with a plane or letting the rod start inside the cylinder. Best regards, |
No, currently we only support contact between rod-cylinder and rod with flat plane (AnisotropicFrictionalPlane). However, you can extend the contact and interaction classes based on your problem requirements. |
Ok, thank you! One other question. Is it possible to integrate multiple cylinders? Through my first attempts it seems to be the case. However, I still have problems with the plot_cylinder_rod_position, since it only takes as argument cylinder_history of 1 cylinder. I tried using further "plot_cylinder_rod_position" functions with different cylinders but that didn't work as intended. Can I use only one function for all cylinders? |
Hi again, I am also trying to rotate the cylinder by the changing the normal and the directional vector, however it does not seem work. Do you have any idea why this might be the case? If I should open a new issue please let me know. I am unsure... Best regards, |
You need to define |
Are you changing |
Thanks. I was able to plot multiple rods now. Regarding the position of the cylinder: Right not I am only trying to change the direction and normal of the rod at initialization. However, this does not work yet as intended. The cylinders do not change compared to the original position in the example. Furthermore, I noticed that some specific interactions of the rod lead to the following error message: :95: UserWarning: Z contains NaN values. This may result in rendering artifacts. I assume it depends on the contact position of the rod with the cylinder. Usually the error occurs if the rod is hitting the cylinder "further to the middle" and therefore is deflected stronger as opposed to hitting it on the upper or lower edges. |
Can you share me how you initialize the cylinder? Cylinder should rotate but the plotting might have issues.
Do you have any videos or some plots? I am currently working on improving the rod-cylinder contact model and there should be a PR soon. Maybe that can fix the problem you have. |
To initialize the cylinder i use the same code that is used in the example you mentioned above. (#107) I initialize it using cylinder_start = np.array([0.3, 0.0, 0.0]) cylinder = Cylinder( and then change the parameters. I would like to have the cylinder pointing upwards. For the second problem I can only attach a video where everything is working, when I get an error message, no video is created. 2D_mult_cylinder_rod_collision_2.mp4 |
Hi, I have one more different question. I don't know if I should open a new request. If yes please let me know. We are trying right now to model a long rod that enters an environment(like the above one with multiple cylinders) through some narrow entry. So we would like to have some boundary conditions at the entrance, for example at the point (0,0), where the rod is fixed and can not change. Is there an example where something similar is done? We would need moving BC where the values are time dependent, meaning we would like to have BC at a specific element of the rod and after some time shift the BC to the next element. |
It seems there is an issue in plotting script and not the initialization of cylinder. You can check the tangent of cylinder as printing out the |
It seems you have a numerical problem. Have you tried the contact with smaller contact constant? |
We don't have a boundary condition exactly for your needs so you need to write your own custom boundary condition class. I think HelicalBucklingBC is a good example for you to start. This BC class slowly rotates the ends of the rods and pulls it by changing the angular and translational velocity. So there are time-dependency, and modifying the position of end node/elements. |
Fix incorrect assertion of indices while forming connections
Dear PyElastica Team,
I am currently trying to add an Interaction plane (or any arbitrary obstacle) to the slithering snake example, so that the snake "bounces of" the plane and continues to move into a different direction. However, I wasn't able to find out the correct way to do it. I tried adding the following code into the example
side_plane = np.array([0.0, 0.0, 3.0])
side_normal = np.array([0.0, 0.0, 1.0])
surface_tol=1e-4
plane_sim = InteractionPlane(k=1.0,nu=1e-6,plane_origin=side_plane,plane_normal=normal_plane)
I do not obtain any error messages. Unfortunately, the code does not seem to have any effect on the snake. I am thankful for any tips. I am very new to the PyElastica (and Github) implementation, however I think this is a great project!
The text was updated successfully, but these errors were encountered: