question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ROSTCPConnector ArgumentOutOfRangeException in PickAndPlaceDemo

See original GitHub issue

Hi,

When running either DemoScene or a completed part3 of the Pick-And-Place tutorials, occasionally the ROSTCPConnector throws an ArgumentOutOfRangeException upon receiving the trajectory (service response) from ROS.

It usually works fine, but after playing DemoScene many times, it happens about every 20th or 30th execution or so.

  • Anyone else experiencing the same problem?

  • Is there something we can do to prevent it or is it an issue with the actual ROSTCPConnector implementation?

  • Is there a way to detect that the problem has occurred (from e.g. TrajectoryPlanner or another MonoBehaviour)?

Exception:

ArgumentOutOfRangeException: Index and count must refer to a location within the buffer.
Parameter name: bytes
System.Text.UTF8Encoding.GetString (System.Byte[] bytes, System.Int32 index, System.Int32 count) (at <695d1cc93cca45069c528c15c9fdd749>:0)
Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer.Read (System.String& value) (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/MessageGeneration/MessageDeserializer.cs:138)
Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer.Read (System.String[]& values, System.Int32 length) (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/MessageGeneration/MessageDeserializer.cs:169)
RosMessageTypes.Trajectory.JointTrajectoryMsg..ctor (Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer deserializer) (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/Messages/Trajectory/msg/JointTrajectoryMsg.cs:45)
RosMessageTypes.Trajectory.JointTrajectoryMsg.Deserialize (Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer deserializer) (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/Messages/Trajectory/msg/JointTrajectoryMsg.cs:40)
RosMessageTypes.Moveit.RobotTrajectoryMsg..ctor (Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer deserializer) (at <b682a19673f04b5ebaddbcd775aa531b>:0)
RosMessageTypes.Moveit.RobotTrajectoryMsg.Deserialize (Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer deserializer) (at <b682a19673f04b5ebaddbcd775aa531b>:0)
Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer.Read[T] (T[]& values, System.Func`2[T,TResult] loader, System.Int32 length) (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/MessageGeneration/MessageDeserializer.cs:160)
RosMessageTypes.NiryoMoveit.MoverServiceResponse..ctor (Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer deserializer) (at <b682a19673f04b5ebaddbcd775aa531b>:0)
RosMessageTypes.NiryoMoveit.MoverServiceResponse.Deserialize (Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer deserializer) (at <b682a19673f04b5ebaddbcd775aa531b>:0)
Unity.Robotics.ROSTCPConnector.MessageGeneration.MessageDeserializer.DeserializeMessage[T] (System.Byte[] data) (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/MessageGeneration/MessageDeserializer.cs:25)
Unity.Robotics.ROSTCPConnector.ROSConnection+<SendServiceMessage>d__83`1[RESPONSE].MoveNext () (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/TcpConnector/ROSConnection.cs:314)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Unity.Robotics.ROSTCPConnector.ROSConnection+<SendServiceMessage>d__82`1[RESPONSE].MoveNext () (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@7f055108f4/Runtime/TcpConnector/ROSConnection.cs:283)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

image

Environment:

  • Unity Version: 2020.3.11f1
  • ROS machine OS + version: Ubuntu 18.04, Melodic, run in Docker
  • UnityRoboticsHub / ROSTCPConnector version: v0.6.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
hyounesycommented, Dec 18, 2021

Hi @PetterVMC. Thank you for reaching out. We have created an internal ticket (AIRO-1647) to investigate the issue. We will come back to you soon.

0reactions
cambelcommented, Jun 9, 2023

Nevermind.

The problem was the MoveIt msgs. The RobotTrajectory.msg on Noetic must be different from the version on Melodic.

I updated the whole ROS/src/moveit_msgs with the same version as in my Noetic environment and rebuild them on Unity.

Now it works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · Unity-Technologies/ROS-TCP-Connector
I want to use unity to connect to multiple ROS systems, but it doesn't seem to work. #309 opened on Jul 6 by...
Read more >
Can't estabilish connection between ROS and Unity
Hi everyone, I'm trying to estabilish a connection between ROS and unity using https://github.com/Unity-Technologies/ROS-TCP-Connector .
Read more >
ROS-TCP-Connector C# Unity subscriber callback never fires
I feel reasonably comfortable that it is properly connecting to ROS, it errors out when I pick a bad IP or port. I've...
Read more >
Untitled
Serangan fajar youtube downloader, Wordpress hosting themes torrent, ... Minecraft skull hunter servers, Friends in high places larnelle harris mp3, ...
Read more >
Untitled
Remote control demo board microchip. Xtx50 regulator? Spotify music player app, Micropollutants in the environment, Bass tester mp3 songs, Plamenech, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found