cmu-rss-lab / roswire

A library for static and dynamic analysis of ROS applications via Docker 🔌
http://christimperley.co.uk/roswire
Apache License 2.0
8 stars 0 forks source link

Value of parameter differs after encoding and decoding #320

Open DebyKatz opened 4 years ago

DebyKatz commented 4 years ago

When creating a Waypoint object with the below-specified parameters, the value of param1 changes after the object is encoded and decoded (2.545384369178356 before, 2.545384407043457 after).

Waypoint(frame=3, command=82, is_current=False, autocontinue=True, param1=2.545384369178356, param2=0.0, param3=0.0, param4=0.0, x_lat=-35.36326497378809, y_long=149.1652387253908, z_alt=3.45551165104657)
ChrisTimperley commented 4 years ago

Just curious: Do you remember where these floating point numbers came from?

ChrisTimperley commented 4 years ago

I can confirm that I can reproduce the failure with a regression test:

   9 =================================== FAILURES ===================================
  10 ____________________________ test_encode_and_decode ____________________________
  11 
  12     def test_encode_and_decode():
  13         db_type = load_mavros_type_db()
  14         Waypoint = db_type['mavros_msgs/Waypoint']
  15         wp = Waypoint(frame=3,
  16                       command=82, 
  17                       is_current=False,
  18                       autocontinue=True,
  19                       param1=2.545384369178356,
  20                       param2=0.0,    
  21                       param3=0.0,
  22                       param4=0.0,
  23                       x_lat=-35.36326497378809,
  24                       y_long=149.1652387253908,
  25                       z_alt=3.45551165104657)
  26 >       assert wp == Waypoint.decode(wp.encode())
  27 E       assert Waypoint(fram...5551165104657) == Waypoint(frame...5551165104657)
  28 E         Omitting 10 identical items, use -vv to show
  29 E         Differing attributes:
  30 E         param1: 2.545384369178356 != 2.545384407043457