h2r / ros_reality

Connect a ROS-enabled robot to Unity
MIT License
132 stars 42 forks source link

Error of running Position Control #4

Open ghost opened 5 years ago

ghost commented 5 years ago

Hello, I am trying to control our Baxter robot with HTC vive.

My baxter has a right electric gripper but does not have a left electric gripper (Instead left vacuum gripper). So, I changed the launch file (https://github.com/h2r/ros_reality_bridge/blob/master/launch/ros_reality_bridge.launch) to not use the electric gripper on the left arm. Specifically, I deleted line 15. After changing the launch file, I could run ros_reality_bridge.launch without problem.

But in Windows cmputer, when I run one scene (Position Control), some error occurs.

KeyNotFoundException: The given key was not present in the dictionary. System.Collections.Generic.Dictionary`2[System.String,System.String].get_Item (System.String key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150) TFListener.Update () (at Assets/Scripts/TFListener.cs:21) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

unity_error

Image from the right_hand_camera and the left_hand_camera is output on the VR space. However, depth image and color image from kinect is not output on the VR space.

unity_game

Do you know what is the problem?

dwhit commented 5 years ago

Is the robot's position updating correctly?

ghost commented 5 years ago

How should I check? I’m sorry for the rudimentary question.

dwhit commented 5 years ago

When the robot moves in real life, does it move in Unity?

ghost commented 5 years ago

Thank you for reply. Yes, the robot moved in real life, it moved in Unity.

ericrosenbrown commented 5 years ago

That's good. Can you confirm that the kinect is actually streaming data on the ROS side, such as in RViz? In addition, can you please confirm that the Kinect has a transform that can accessed relative to the robot base transform?

The error that you're getting in the Unity scene is that a specific key in the TFListener is not available, which is preventing something in the unity scene from being updated. Considering the robot is updating and not the kinect, I suspect it is the kinect, and that it's transform is not being streamed properly. Can you add a debug statement to line 21 of the TFListener (where the error is happening), and print out the name of the key so we can verify what transform is failing to be updated?

ghost commented 5 years ago

Thank you for reply. I confirmed in RViz that the kinect is actually streaming data and has a transform that can accessed relative to the robot base transform.

screenshot from 2018-11-13 11-00-46

I'm sorry. Could you tell me how to print out the name of the key?

And does the fact that the left gripper transform ( l_grepper_l_finger , l_grepper_l_finger_tip , l_grepper_r_finger , l_grepper_r_finger_tip) does not exist affect? I am worried about it.

ericrosenbrown commented 5 years ago

On line 20 of TFListener.cs in the scripts folder, right before line 21, can you add the line: Debug.log(topic) After you do this, run the unity scene and you should see a constant printout of strings. The error you are getting will still appear, but can you show us the print statements around the error so we can see which topic is causing the dictionary to fail a lookup? Specifically, what string is printing out right before you get that error? That's the ros topic that is failing.

I don't believe the fact that the left gripper transform is not showing matters, but this step will help us confirm that.

ghost commented 5 years ago

Thanks for the explanation. I was relieved to hear that you don't believe the fact that the left gripper transform is not showing matters.

I added a debug statement to line 20 of TFListener.cs. After running the unity scene, the results were displayed on the console. unity_error_printout

On the ROS side, it says that the client has subscribed to ros_unity. 2018-11-14 2

I tried to check the contents of ros_unity by running rostopic echo. 2018-11-14 4

Do you know what is wrong from this result?