gazebosim / gz-omni

Connnects Gazebo to Isaac Sim
https://gazebosim.org/showcase
112 stars 14 forks source link

Connector: IssacSim -> Ignition #16

Closed ahcorde closed 2 years ago

ahcorde commented 2 years ago

Signed-off-by: ahcorde ahcorde@gmail.com

🎉 New feature

Summary

Communication between IssacSim -> Ignition.

Added a flag to check if the pose are set by Ignition or IssacSim

If you test this PR you might find some issue relative to this issue https://github.com/ignitionrobotics/ign-gazebo/issues/1358

Checklist

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

koonpeng commented 2 years ago

I'm getting service call timeout on the connector

[Dbg] [FUSDNoticeListener.hpp:234] path /shapes/box/box_link/box_visual/geometry.xformOp:translate
[Err] [FUSDNoticeListener.hpp:281] Service call timed out
[Dbg] [FUSDNoticeListener.hpp:234] path /shapes/box/box_link/box_visual/geometry.xformOp:translate
[Err] [FUSDNoticeListener.hpp:281] Service call timed out
[Dbg] [FUSDNoticeListener.hpp:234] path /shapes/box/box_link/box_visual/geometry.xformOp:translate

There are also errors on ignition

[Err] [UserCommands.cc:1337] Unable to update the pose for entity id:[0], name[geometry]
[Err] [UserCommands.cc:1337] Unable to update the pose for entity id:[0], name[geometry]
[Err] [UserCommands.cc:1337] Unable to update the pose for entity id:[0], name[geometry]
[Err] [UserCommands.cc:1337] Unable to update the pose for entity id:[0], name[geometry]

I think the problem is that usd allows transformations on geometry but not sdf, so when trying to translate that to sdf we get a non existing target.


I notice ignition physics is still running when isaacsim updates a pose, in theory this could lead to conflicting states. I can't test this now because I had to re-install omniverse to fix some other issues and downloads are down so I can't re-install isaacsim, and because of the above errors.

ahcorde commented 2 years ago

@koonpeng I was testing your changes, and I'm facing this issue. Translations look wrong

ign-omni-error1

You need this change in ign-gazebo https://github.com/ignitionrobotics/ign-gazebo/pull/1394

ahcorde commented 2 years ago

I fixed the pose: fixed_pose_ign-omni

ahcorde commented 2 years ago

But we are facing another issue. Issac Sim dos not provide the joint angle, we can only see changes in the links

Require: https://github.com/ignitionrobotics/ign-gazebo/pull/1394

I tried to implement something to calculate the joint angle but it's wrong https://github.com/ignitionrobotics/ign-omni/pull/16/commits/af1daca5967b8a829cec7cfe2c1477e3c3897754

panda_wrong_angle

koonpeng commented 2 years ago

But we are facing another issue. Issac Sim dos not provide the joint angle, we can only see changes in the links

Require: ignitionrobotics/ign-gazebo#1394

I tried to implement something to calculate the joint angle but it's wrong af1daca

Wasn't able to try this yet. I'm assuming this is the simulation being ran? https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/tutorial_ros_moveit.html

~Tried to follow the tutorial but getting 404 errors when installing some ros packages.~ Unfortunately I cannot run the sim with my current setup as it is now, it requires both ros2 and omniverse. My ros2 environment is in a container, trying to install nucleus in the container doesn't work for some unknown reason. Either I try to make omniverse work in the container or build ros + ignition on my host.

ahcorde commented 2 years ago

to test this you can run this script using ROS 1:

You should add the following ROS plugins: Clock, Tree pose and Joint state

``` #!/usr/bin/env python # Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. import rospy from sensor_msgs.msg import JointState import numpy as np import time rospy.init_node("test_rosbridge", anonymous=True) pub = rospy.Publisher("/joint_command", JointState, queue_size=10) joint_state = JointState() joint_state.name = [ "panda_joint1", "panda_joint2", "panda_joint3", "panda_joint4", "panda_joint5", "panda_joint6", "panda_joint7", "panda_finger_joint1", "panda_finger_joint2" ] num_joints = len(joint_state.name) # make sure kit's editor is playing for receiving messages ## joint_state.position = np.array([0.0] * num_joints) default_joints = [0.0, 1.57, 0.707, 0.707, 0, 3.1416, 0, 0, 0] # limiting the movements to a smaller range (this is not the range of the robot, just the range of the movement max_joints = np.array(default_joints) + 0.707 min_joints = np.array(default_joints) - 0.07 # position control the robot to wiggle around each joint time_start = time.time() rate = rospy.Rate(20) while not rospy.is_shutdown(): joint_state.position = [45.0*3.1416/180.0, 15.0*3.1416/180.0, 35.0*3.1416/180.0, 80.0*3.1416/180.0, 10.0*3.1416/180.0, 30.0*3.1416/180.0, 20.0*3.1416/180.0, 0, 0] joint_state.position = np.sin(time.time() - time_start) * (max_joints - min_joints) * 0.5 + default_joints #joint_state.position = default_joints pub.publish(joint_state) rate.sleep() ```
koonpeng commented 2 years ago

managed to run the sim in isaac but wasn't able to get the connector to work

https://user-images.githubusercontent.com/45189696/159428359-443016af-98bb-45db-a673-9e45564f0d61.mp4

ignition logs

<same>
[Err] [UserCommands.cc:761] Unable to update the pose for entity id:[0], name[panda_hand]
[Err] [UserCommands.cc:761] Unable to update the pose for entity id:[0], name[panda_hand]
[Err] [UserCommands.cc:761] Unable to update the pose for entity id:[0], name[panda_hand]
[Err] [UserCommands.cc:761] Unable to update the pose for entity id:[0], name[panda_hand]
[Err] [UserCommands.cc:761] Unable to update the pose for entity id:[0], name[panda_hand]
[Err] [UserCommands.cc:761] Unable to update the pose for entity id:[0], name[panda_hand]

ign-omni logs

<same>
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link7.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.xformOp:translate
[Err] [FUSDNoticeListener.hpp:450] Service call timed out
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_hand.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_hand.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_hand.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_hand.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_leftfinger.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_leftfinger.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_leftfinger.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_leftfinger.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link1.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link1.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link1.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link2.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link2.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link2.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link3.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link3.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link3.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link3.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link4.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link4.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link4.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link4.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link5.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link5.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link5.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link5.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link6.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link6.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link6.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link6.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link7.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link7.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link7.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link7.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_link8.xformOp:translate
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.physics:angularVelocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.physics:velocity
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.xformOp:orient
[Dbg] [FUSDNoticeListener.hpp:326] path /panda/panda_rightfinger.xformOp:translate