surgical-robotics-ai / surgical_robotics_challenge

Interactive Robot Assisted Suturing Simulation
55 stars 43 forks source link

Weird oscillations in simulator #37

Closed micsc12 closed 2 years ago

micsc12 commented 2 years ago

I have a issue with the ambf simulator oscillating. I'm trying to control psm2 through the /CRTK/psm2/servo_cp topic. After settling on a point, it starts oscillating like crazy. Here is a video:

video

Any ideas whats going on?

adnanmunawar commented 2 years ago

Thanks for posting the video. I see from it that the Physics Frequency, 'Phx' on the bottom of the screen is very unstable. With the default launch commands, it is supposed to run at 120 Hz. Can you tell me the specs of your computer that you are running this on?

micsc12 commented 2 years ago

I'm running this on a HP Elitebook 840 G5 laptop. Might this simply be a case of the laptop being too slow?

adnanmunawar commented 2 years ago

Hmm, it would seem so. You don't really need a powerful PC to run the challenge, a mid tier setup should be fine.

  1. Are you running the simulator on Docker/Virtual Machine running Ubuntu on Windows or natively on Ubuntu?
  2. What is the processor model, size of ram and type of GPU on your laptop?

A common reason for the arms to shake is because of the joint PID controllers. If the frequency drops drastically, the D gain causes large outputs which destabilizes the joint.

I am attaching the modified PSM ADF files with the D gain for each joint controller set to 0.. You can replace the psm1.yaml and psm2.yaml files in your copy with these two files to check if the oscillations are gone.

micsc12 commented 2 years ago
  1. I'm running it natively in Ubuntu 20.04.
  2. Intel i7-8650U, 16 GB, Intel HD Graphics.

The simulator can actually run at 120 Hz (and above) before starting the CRTK interface and my own ros-node. Its only after sending the first servo command that Phx sim rate drops considerably. I will now check the modified psm Yaml files and get back to you. Seems like a reasonable fix :)

micsc12 commented 2 years ago

New PID parameters fixed the problem. And your explanation regarding the control loop frequency dropping makes a lot of sense. Thanks Adnan :)