simulator icon indicating copy to clipboard operation
simulator copied to clipboard

Possible inconsistency object type of Waypoint acceleration

Open ZiwenWan opened this issue 3 years ago • 2 comments

Hi SVL team,

I meet some problem when I was using waypoints following in Python API in SVL. The error message shows that some type can not be serialized into JSON when sending remote control command. After I checked the internal code, I found the root cause is that the acceleration field of lgsvl.DriveWaypoint will be a Vector while JSON does not support a Vector object. The error will happen at "lgsvl/agent.py" line 296 self.remote.command(...).

My current solution is that I manually set the acceleration to be a constant value the error will not occur. I am wondering what should be the default type of acceleration.

Thanks a lot!

ZiwenWan avatar Jan 19 '22 23:01 ZiwenWan

We have helper methods to convert vectors, see Vector.fromJSON(); I am not sure how you are getting this error. Is this from your own api code?

EricBoiseLGSVL avatar Jan 24 '22 23:01 EricBoiseLGSVL

The error python code I wrote can be simplified as: wp = lgsvl.DriveWaypoint(state.position, 5, angle = state.rotation) npc.follow(waypoints = [wp])

Somehow the acceleration of wp is Vector and also in the agent.py, when generating the cmd, the to_json() method is not called.

Thanks a lot for your reply and help! Really appreciate it!

ZiwenWan avatar Jan 25 '22 18:01 ZiwenWan