Hi,
I am performing a hybrid simulation with Isaac and MotionsolveI by building data transfer with two programs. I have checked the data transfer couple times and everything is looking correct. I have no idea what is wrong in the Omniverse because the “animation” looks odd.
I have demonstrated the problem with the simple inverted pendulum mode.
This how things are looking in Isaac
This how it should look like (Picture under)
Here is my code
def print_cube_info(self, step_size):
import socket, struct
UDP_IP = "127.0.0.1"
UDP_PORT = 8888
sock = socket.socket(socket.AF_INET, # Interne
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
timeline = omni.timeline.get_timeline_interface()
timecode = timeline.get_current_time() * timeline.get_time_codes_per_seconds()
data, addr = sock.recvfrom(1048)
value = struct.unpack('f'*7, data)
print(value)
self._world = self.get_world()
#component = "/World/testi/testi2/rod/rod"
boxes = XFormPrimView(component)
position, orientation = boxes.get_world_poses()
#linear_velocity = self._cube.get_linear_velocity()
# will be shown on terminal
#print("Cube position is : " + str(position))
#print("Cube's orientation is : " + str(orientation))
#print("Cube's linear velocity is : " + str(linear_velocity))
fix = 57.2957795
#checked
rotatationNew = [value[3]*fix,value[4]*fix,value[5]*fix]
#checked
translationNew = [value[0],value[1],value[2]]
file = open("D:/Projektit/Digital twin/pendelum_inverse_Run/demofile2.txt", "a")
message = str(value[0])+","+str(value[1])+","+str(value[2])+","+str(value[3])+","+str(value[4])+","+str(value[5])+"\n"
file.write(message)
file.close()
omni.kit.commands.execute('TransformMultiPrimsSRTCpp',
count=1,
paths=[component],
new_translations=translationNew,
new_rotation_eulers=rotatationNew,
new_rotation_orders=[0, 1, 2],
new_scales=[1.0, 1.0, 1.0],
old_translations=position,
old_rotation_eulers=orientation,
old_rotation_orders=[0, 1, 2],
old_scales=[1.0, 1.0, 1.0],
usd_context_name='',
time_code=timeline)
sock.close()
Basically I want that the other program calculates the translations and rotations. Omniverse uses them and do own simulations ( not in this inverted pendulum model)
Thanks & cheers,
Petri