Hi, I am trying to move my robot go straight, but it did not.
I am using the UsdPhysics velocity API and using the transformation to convert the local velocity to global velocity.
The point is no matter how I try, the robot always goes left even I command robot to move straight.
I attached the video and the USD file.
hsr.usd (10.0 KB)
Allow me to add an extra problem, which, when I only input the angular velocity, the robot not only rotated, but iI moved a bit.
What I expected is it just does rotation and not any translation.
May I know what is the problem?
Someone from our team will review your problem and respond shortly.
Thank you so much.
I’m looking forward to your reply soon。
Hello, I’ll start with the angular velocity - If the angular velocity were applied at the center of mass on an isolated system, it would indeed spin in place. Since you have a robot with multiple links and you apply a velocity at the origin of the base, it already breaks the Center of Mass assumption - therefore the torque will also generate a resulting linear velocity. Furthermore, since the object is in collision with the ground, it will resist such movement where it touches the ground, also resulting in linear velocities.
On the first video, the behavior seems to be correct. Bear in mind that there is a checkbox to define if velocity attributes are in global or local coordinates, but by default they are already in global. (check the Velocities in Local Space, as from image - in the properties panel)
Your code seems to be converting it to local coordinates and applying it in the X direction, you can confirm that by the red arrow in the robot gizmo.
Thank you so much for your detailed explanation.
Regarding the angular velocity:
- Is there any method to solve the problem, making it only spins in place?
Regarding the robot’s behaviour:
I actually tried the “Velocities in Local Space”, and I found that whether it is checked or not, the robot behaviour was still the same. That is why I write the code to convert the velocity into the local coordinates. I want the velocity to be applied in local coordinates. Checking the “Velocities in Local Space” just simply didn’t work.
The point is, why the robot turns left gradually? Even though velocity is applied in local coordinates in the X direction, it should be going straight (please observe the local coordinates at the beginning). Based on the video, initially, the global and local frames are perfectly aligned, when I enter the command, the robot SHOULD only move forward (in the x direction), leaving the frames still aligning, BUT the robot gradually moves forward and to the left, causing the frames to start misaligning. (Meaning the robot is not only moving move in x direction but somehow it rotates?). This is my problem.
I think there’s some confusion about what should be happening. I can see that the target velocity is actually correctly being applied in the local coordinates (as in its always going in the direction of the robot X axis).
What is happening is that because of the resulting motion the robot ends up turning slightly, and st every step it drifts more. That is common and will happen in any system (specially in real environments). It’s an “accumulation error”.
This drifting in case happens for the same reason as applying a torque will cause the robot to move: since the velocity is not applied exactly at the center of mass of the entire system (robot base plus all connecting bodies) it generates a torque, that will make it turn slightly.
I think the better question to ask here is: what is your end goal? Maybe you are trying the wrong things to achieve your goal.