A magnet keeps rotating when implementing magnetic dipoles in VREP

Typically: "How do I... ", "How can I... " questions
Post Reply
WELLBEINGLWB
Posts: 5
Joined: 17 Oct 2015, 08:16

A magnet keeps rotating when implementing magnetic dipoles in VREP

Post by WELLBEINGLWB »

Dear Sir or Madam,

I have been trying to use VREP to implement the dipole-dipole model of two permanent magnets as shown in the following video and GitHub repository.

https://www.youtube.com/watch?v=Lw2KfwgySWI
https://github.com/vustormlab/storm_gazebo_ros_magnet

They used ROS and Gazebo to realize the simulation. However, when I use VREP to do the same thing, the magnet would keep rotating, which is unrealistic for a real magnet. I have attached the results generated by the attached codes.

Initial state in VREP: https://www.dropbox.com/s/bo7l02glpt7ff ... P.jpg?dl=0
Final state in VREP: https://www.dropbox.com/s/pnihskt5pwfpu ... P.jpg?dl=0

Initial state in Gazebo: https://www.dropbox.com/s/zmg0zk7qwkzxp ... o.png?dl=0
Final state in Gazebo: https://www.dropbox.com/s/wrttfq8bfge0i ... o.png?dl=0

MATLAB codes and scene for VREP: https://www.dropbox.com/s/vrjghxbjiiaf2 ... P.zip?dl=0

The capsule magnet in Gazebo wouldn't rotate, while it will keep rotating in VREP. I have tried to set same values for related parameters of the ODE physics engine in VREP. Is there any parameters can prevent the magnet from rotating? I tried to tune the linear and angular damping values in VREP, but I failed to achieve a satisfactory result.

Could anyone help me to get rid of this situation? Thanks in advance for any help.

coppelia
Site Admin
Posts: 10312
Joined: 14 Dec 2012, 00:25

Re: A magnet keeps rotating when implementing magnetic dipoles in VREP

Post by coppelia »

Hello,

not really sure how to implement this correctly, I would also have said to use damping. That this is always cheating. Did you try with a different physics engine? Is the result similar?

Cheers

WELLBEINGLWB
Posts: 5
Joined: 17 Oct 2015, 08:16

Re: A magnet keeps rotating when implementing magnetic dipoles in VREP

Post by WELLBEINGLWB »

Hi Coppelia robotics,

I tried different physics engines. ODE and Newton can do it if the newest version VREP is used. The sim.addForceAndTorque function will cumulate all forces, which makes the magnet keep rotating. The sysCall_dynCallback function can solve this problem. But I am not sure how to control the magnets using remote APIs in a synchronous manner in this case.

Cheers

Post Reply