You can get some information on that using notify-level-glgsg debug
.
Good point ! I just started a job this option enabled.
is there something I could run to see if it happens for me?
Yes, there is ! First, you need to install jiminy-py
via pip
(pip install --upgrade jiminy-py
). Here is a self-contained script that is generated the same screenshot than the CI job:
import os
import tempfile
import xml.etree.ElementTree as ET
import numpy as np
import matplotlib.pyplot as plt
import jiminy_py.core as jiminy
from jiminy_py.simulator import Simulator
# Model parameters
MASS_SEGMENTS = 0.1
INERTIA_SEGMENTS = 0.001
LENGTH_SEGMENTS = 0.01
N_FLEXIBILITY = 40
# Create temporary urdf file
fd, urdf_path = tempfile.mkstemp(
prefix="flexible_arm_", suffix=".urdf")
os.close(fd)
# Procedural model generation
robot = ET.Element("robot", name="flexible_arm")
ET.SubElement(robot, "link", name="base")
for i in range(N_FLEXIBILITY + 1):
link = ET.SubElement(robot, "link", name=f"link{i}")
visual = ET.SubElement(link, "visual")
ET.SubElement(
visual, "origin", xyz=f"{LENGTH_SEGMENTS/2} 0 0", rpy="0 0 0")
geometry = ET.SubElement(visual, "geometry")
ET.SubElement(geometry, "box", size=f"{LENGTH_SEGMENTS} 0.025 0.01")
material = ET.SubElement(visual, "material", name="")
ET.SubElement(material, "color", rgba="0 0 0 1")
inertial = ET.SubElement(link, "inertial")
ET.SubElement(
inertial, "origin", xyz=f"{LENGTH_SEGMENTS/2} 0 0", rpy="0 0 0")
ET.SubElement(inertial, "mass", value=f"{MASS_SEGMENTS}")
ET.SubElement(
inertial, "inertia", ixx="0", ixy="0", ixz="0", iyy="0", iyz="0",
izz=f"{INERTIA_SEGMENTS}")
motor = ET.SubElement(
robot, "joint", name="base_to_link0", type="revolute")
ET.SubElement(motor, "parent", link="base")
ET.SubElement(motor, "child", link="link0")
ET.SubElement(motor, "origin", xyz="0 0 0", rpy=f"{np.pi/2} 0 0")
ET.SubElement(motor, "axis", xyz="0 0 1")
ET.SubElement(
motor, "limit", effort="100.0", lower=f"{-np.pi}", upper=f"{np.pi}",
velocity="10.0")
for i in range(1, N_FLEXIBILITY + 1):
joint = ET.SubElement(
robot, "joint", name=f"link{i-1}_to_link{i}", type="fixed")
ET.SubElement(joint, "parent", link=f"link{i-1}")
ET.SubElement(joint, "child", link=f"link{i}")
ET.SubElement(
joint, "origin", xyz=f"{LENGTH_SEGMENTS} 0 0", rpy="0 0 0")
tree = ET.ElementTree(robot)
tree.write(urdf_path)
# Create and initialize the robot
robot = jiminy.Robot()
robot.initialize(urdf_path, False)
# Add motors to the robot
for joint_name in ("base_to_link0",):
motor = jiminy.SimpleMotor(joint_name)
robot.attach_motor(motor)
motor.initialize(joint_name)
# Configure the robot
robot_options = robot.get_options()
motor_options = robot_options["motors"]
for motor in robot.motors:
motor_options[motor.name]["enableVelocityLimit"] = False
motor_options[motor.name]['enableEffortLimit'] = False
motor_options[motor.name]['enableArmature'] = False
robot.set_options(robot_options)
# Remove temporary file
os.remove(urdf_path)
# Create a simulator using this robot and controller
simulator = Simulator(
robot,
viewer_kwargs=dict(
camera_pose=((0.0, -2.0, 0.0), (np.pi/2, 0.0, 0.0), None)
))
# Set initial condition and simulation duration
q0, v0 = np.array([0.]), np.array([0.])
t_end = 4.0
# Run a first simulation without flexibility
simulator.simulate(
t_end, q0, v0, is_state_theoretical=True, show_progress_bar=False)
# Extract the final configuration
q_rigid = simulator.robot_state.q.copy()
# Render the scene
img_rigid = simulator.render(return_rgb_array=True)
# Check different flexibility ordering
for order in (range(N_FLEXIBILITY), range(N_FLEXIBILITY)[::-1]):
# Specify joint flexibility parameters
model_options = simulator.robot.get_model_options()
model_options['dynamics']['enableFlexibility'] = True
model_options['dynamics']['flexibilityConfig'] = [{
'frameName': f"link{i}_to_link{i+1}",
'stiffness': np.zeros(3),
'damping': np.zeros(3),
'inertia': np.full(3, fill_value=1e6)
} for i in order]
simulator.robot.set_model_options(model_options)
# Launch the simulation
simulator.simulate(
t_end, q0, v0, is_state_theoretical=True,
show_progress_bar=False)
# Render the scene
plt.figure()
plt.imshow(simulator.render(return_rgb_array=True))
plt.show()