Resistance in a hinge joint #2366
Replies: 1 comment
-
flag contact="disable" seems to have done the trick. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Intro
Hi!
I am a principal mechanical engineer working on a wind energy project.
My setup
Windows 11 / Linux, Mujoco, Python, Pytorch.
My question
There exists a resistance in a joint, which increases with inertia that I don't understand. I have a rotating body with high inertia via a armature parameter. I need the high inertia to mimic the physical system and make a PID controller happy. The behavior I would expect is that with initialized velocity, it would continue to spin, decaying slowly if there is damping under the hood somewhere, or maintain that velocity. What is causing this behavior?
Minimal model and/or code that explain my question
Python:
import mujoco as mj
import numpy as np
from mujoco.glfw import glfw
from numpy.linalg import inv
import matplotlib.pyplot as plt
from mujoco_base import MuJoCoBase
integral = 0
previous_error = 0
ts = []
thetas = []
def controller(model, data):
global integral, previous_error
kp = 0.
ki = 0.
kd = 0.
dt = model.opt.timestep
pos = data.joint('mast_joint').qpos[0]
model = mj.MjModel.from_xml_path("caro_test.xml")
data = mj.MjData(model)
mj.set_mjcb_control(controller)
data.joint('mast_joint').qvel[0] = np.pi * 2
simend = 5.0
glfw.init()
Create window
window = glfw.create_window(640, 480, "Kite Simulation", None, None)
glfw.make_context_current(window)
Initialize visualization data structures
cam = mj.MjvCamera()
opt = mj.MjvOption()
scene = mj.MjvScene(model, maxgeom=10000)
context = mj.MjrContext(model, mj.mjtFontScale.mjFONTSCALE_150.value)
cam.azimuth = 89.608063
cam.elevation = -30
cam.distance = 24.0
cam.lookat = np.array([0.0, 0.0, 1.5])
while not glfw.window_should_close(window):
simstart = data.time
glfw.terminate()
plt.plot(ts, thetas, label='theta_error')
plt.legend()
plt.show()
Confirmations
Beta Was this translation helpful? Give feedback.
All reactions