Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wpical output question #7722

Open
ShmayaR opened this issue Jan 23, 2025 · 10 comments
Open

Wpical output question #7722

ShmayaR opened this issue Jan 23, 2025 · 10 comments

Comments

@ShmayaR
Copy link

ShmayaR commented Jan 23, 2025

Hi! I’ve recently started using wpical to calibrate the April tags on my field. I’ve realized that in the outputted Json file there are a few lines of code that are preventing the simulation from running. This code is nearly identical to 2025 April tag field layout json file but at the end it has an extra pose with no ID. if I remove this code everything seems to run properly. does anyone know what this last pose is for?

the 2025 game field json which lets the simulation run properly:

{
  "tags": [
    {
      "ID": 1,
      "pose": {
        "translation": {
          "x": 16.697198,
          "y": 0.65532,
          "z": 1.4859
        },
        "rotation": {
          "quaternion": {
            "W": 0.4539904997395468,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.8910065241883678
          }
        }
      }
    },
    {
      "ID": 2,
      "pose": {
        "translation": {
          "x": 16.697198,
          "y": 7.3964799999999995,
          "z": 1.4859
        },
        "rotation": {
          "quaternion": {
            "W": -0.45399049973954675,
            "X": -0.0,
            "Y": 0.0,
            "Z": 0.8910065241883679
          }
        }
      }
    },
    {
      "ID": 3,
      "pose": {
        "translation": {
          "x": 11.560809999999998,
          "y": 8.05561,
          "z": 1.30175
        },
        "rotation": {
          "quaternion": {
            "W": -0.7071067811865475,
            "X": -0.0,
            "Y": 0.0,
            "Z": 0.7071067811865476
          }
        }
      }
    },
    {
      "ID": 4,
      "pose": {
        "translation": {
          "x": 9.276079999999999,
          "y": 6.137656,
          "z": 1.8679160000000001
        },
        "rotation": {
          "quaternion": {
            "W": 0.9659258262890683,
            "X": 0.0,
            "Y": 0.25881904510252074,
            "Z": 0.0
          }
        }
      }
    },
    {
      "ID": 5,
      "pose": {
        "translation": {
          "x": 9.276079999999999,
          "y": 1.914906,
          "z": 1.8679160000000001
        },
        "rotation": {
          "quaternion": {
            "W": 0.9659258262890683,
            "X": 0.0,
            "Y": 0.25881904510252074,
            "Z": 0.0
          }
        }
      }
    },
    {
      "ID": 6,
      "pose": {
        "translation": {
          "x": 13.474446,
          "y": 3.3063179999999996,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": -0.8660254037844387,
            "X": -0.0,
            "Y": 0.0,
            "Z": 0.49999999999999994
          }
        }
      }
    },
    {
      "ID": 7,
      "pose": {
        "translation": {
          "x": 13.890498,
          "y": 4.0259,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 1.0,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.0
          }
        }
      }
    },
    {
      "ID": 8,
      "pose": {
        "translation": {
          "x": 13.474446,
          "y": 4.745482,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 0.8660254037844387,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.49999999999999994
          }
        }
      }
    },
    {
      "ID": 9,
      "pose": {
        "translation": {
          "x": 12.643358,
          "y": 4.745482,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 0.5000000000000001,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.8660254037844386
          }
        }
      }
    },
    {
      "ID": 10,
      "pose": {
        "translation": {
          "x": 12.227305999999999,
          "y": 4.0259,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 6.123233995736766e-17,
            "X": 0.0,
            "Y": 0.0,
            "Z": 1.0
          }
        }
      }
    },
    {
      "ID": 11,
      "pose": {
        "translation": {
          "x": 12.643358,
          "y": 3.3063179999999996,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": -0.4999999999999998,
            "X": -0.0,
            "Y": 0.0,
            "Z": 0.8660254037844387
          }
        }
      }
    },
    {
      "ID": 12,
      "pose": {
        "translation": {
          "x": 0.851154,
          "y": 0.65532,
          "z": 1.4859
        },
        "rotation": {
          "quaternion": {
            "W": 0.8910065241883679,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.45399049973954675
          }
        }
      }
    },
    {
      "ID": 13,
      "pose": {
        "translation": {
          "x": 0.851154,
          "y": 7.3964799999999995,
          "z": 1.4859
        },
        "rotation": {
          "quaternion": {
            "W": -0.8910065241883678,
            "X": -0.0,
            "Y": 0.0,
            "Z": 0.45399049973954686
          }
        }
      }
    },
    {
      "ID": 14,
      "pose": {
        "translation": {
          "x": 8.272272,
          "y": 6.137656,
          "z": 1.8679160000000001
        },
        "rotation": {
          "quaternion": {
            "W": 5.914589856893349e-17,
            "X": -0.25881904510252074,
            "Y": 1.5848095757158825e-17,
            "Z": 0.9659258262890683
          }
        }
      }
    },
    {
      "ID": 15,
      "pose": {
        "translation": {
          "x": 8.272272,
          "y": 1.914906,
          "z": 1.8679160000000001
        },
        "rotation": {
          "quaternion": {
            "W": 5.914589856893349e-17,
            "X": -0.25881904510252074,
            "Y": 1.5848095757158825e-17,
            "Z": 0.9659258262890683
          }
        }
      }
    },
    {
      "ID": 16,
      "pose": {
        "translation": {
          "x": 5.9875419999999995,
          "y": -0.0038099999999999996,
          "z": 1.30175
        },
        "rotation": {
          "quaternion": {
            "W": 0.7071067811865476,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.7071067811865476
          }
        }
      }
    },
    {
      "ID": 17,
      "pose": {
        "translation": {
          "x": 4.073905999999999,
          "y": 3.3063179999999996,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": -0.4999999999999998,
            "X": -0.0,
            "Y": 0.0,
            "Z": 0.8660254037844387
          }
        }
      }
    },
    {
      "ID": 18,
      "pose": {
        "translation": {
          "x": 3.6576,
          "y": 4.0259,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 6.123233995736766e-17,
            "X": 0.0,
            "Y": 0.0,
            "Z": 1.0
          }
        }
      }
    },
    {
      "ID": 19,
      "pose": {
        "translation": {
          "x": 4.073905999999999,
          "y": 4.745482,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 0.5000000000000001,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.8660254037844386
          }
        }
      }
    },
    {
      "ID": 20,
      "pose": {
        "translation": {
          "x": 4.904739999999999,
          "y": 4.745482,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 0.8660254037844387,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.49999999999999994
          }
        }
      }
    },
    {
      "ID": 21,
      "pose": {
        "translation": {
          "x": 5.321046,
          "y": 4.0259,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": 1.0,
            "X": 0.0,
            "Y": 0.0,
            "Z": 0.0
          }
        }
      }
    },
    {
      "ID": 22,
      "pose": {
        "translation": {
          "x": 4.904739999999999,
          "y": 3.3063179999999996,
          "z": 0.308102
        },
        "rotation": {
          "quaternion": {
            "W": -0.8660254037844387,
            "X": -0.0,
            "Y": 0.0,
            "Z": 0.49999999999999994
          }
        }
      }
    }
  ],
  "field": {
    "length": 17.548,
    "width": 8.052
  }
}

the json file generated by wpical:

{
    "field": {
        "length": 17.548,
        "width": 8.052
    },
    "tags": [
        {
            "ID": 1,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.4539904997395468,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.8910065241883678
                    }
                },
                "translation": {
                    "x": 16.697198,
                    "y": 0.65532,
                    "z": 1.4859
                }
            }
        },
        {
            "ID": 2,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": -0.45399049973954675,
                        "X": -0.0,
                        "Y": 0.0,
                        "Z": 0.8910065241883679
                    }
                },
                "translation": {
                    "x": 16.697198,
                    "y": 7.3964799999999995,
                    "z": 1.4859
                }
            }
        },
        {
            "ID": 3,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": -0.7071067811865475,
                        "X": -0.0,
                        "Y": 0.0,
                        "Z": 0.7071067811865476
                    }
                },
                "translation": {
                    "x": 11.560809999999998,
                    "y": 8.05561,
                    "z": 1.30175
                }
            }
        },
        {
            "ID": 4,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.9659258262890683,
                        "X": 0.0,
                        "Y": 0.25881904510252074,
                        "Z": 0.0
                    }
                },
                "translation": {
                    "x": 9.276079999999999,
                    "y": 6.137656,
                    "z": 1.8679160000000001
                }
            }
        },
        {
            "ID": 5,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.9659258262890683,
                        "X": 0.0,
                        "Y": 0.25881904510252074,
                        "Z": 0.0
                    }
                },
                "translation": {
                    "x": 9.276079999999999,
                    "y": 1.914906,
                    "z": 1.8679160000000001
                }
            }
        },
        {
            "ID": 6,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": -0.8660254037844387,
                        "X": -0.0,
                        "Y": 0.0,
                        "Z": 0.49999999999999994
                    }
                },
                "translation": {
                    "x": 13.474446,
                    "y": 3.3063179999999996,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 7,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 1.0,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.0
                    }
                },
                "translation": {
                    "x": 13.890498,
                    "y": 4.0259,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 8,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.8660254037844387,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.49999999999999994
                    }
                },
                "translation": {
                    "x": 13.474446,
                    "y": 4.745482,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 9,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.5000000000000001,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.8660254037844386
                    }
                },
                "translation": {
                    "x": 12.643358,
                    "y": 4.745482,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 10,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 6.123233995736766e-17,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 1.0
                    }
                },
                "translation": {
                    "x": 12.227305999999999,
                    "y": 4.0259,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 11,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": -0.4999999999999998,
                        "X": -0.0,
                        "Y": 0.0,
                        "Z": 0.8660254037844387
                    }
                },
                "translation": {
                    "x": 12.643358,
                    "y": 3.3063179999999996,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 12,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.8910065241883679,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.45399049973954675
                    }
                },
                "translation": {
                    "x": 0.851154,
                    "y": 0.65532,
                    "z": 1.4859
                }
            }
        },
        {
            "ID": 13,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": -0.8910065241883678,
                        "X": -0.0,
                        "Y": 0.0,
                        "Z": 0.45399049973954686
                    }
                },
                "translation": {
                    "x": 0.851154,
                    "y": 7.3964799999999995,
                    "z": 1.4859
                }
            }
        },
        {
            "ID": 14,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 5.914589856893349e-17,
                        "X": -0.25881904510252074,
                        "Y": 1.5848095757158825e-17,
                        "Z": 0.9659258262890683
                    }
                },
                "translation": {
                    "x": 8.272272,
                    "y": 6.137656,
                    "z": 1.8679160000000001
                }
            }
        },
        {
            "ID": 15,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 5.914589856893349e-17,
                        "X": -0.25881904510252074,
                        "Y": 1.5848095757158825e-17,
                        "Z": 0.9659258262890683
                    }
                },
                "translation": {
                    "x": 8.272272,
                    "y": 1.914906,
                    "z": 1.8679160000000001
                }
            }
        },
        {
            "ID": 16,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.7071067811865476,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.7071067811865476
                    }
                },
                "translation": {
                    "x": 5.9875419999999995,
                    "y": -0.0038099999999999996,
                    "z": 1.30175
                }
            }
        },
        {
            "ID": 17,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": -0.4035927712957329,
                        "X": 0.01996412432854348,
                        "Y": 0.009904508897942364,
                        "Z": 0.9146672670436585
                    }
                },
                "translation": {
                    "x": 4.041182597944263,
                    "y": 3.1917488555738283,
                    "z": 0.3185553565091048
                }
            }
        },
        {
            "ID": 18,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 6.123233995736766e-17,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 1.0
                    }
                },
                "translation": {
                    "x": 3.6576,
                    "y": 4.0259,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 19,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.5000000000000001,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.8660254037844386
                    }
                },
                "translation": {
                    "x": 4.073905999999999,
                    "y": 4.745482,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 20,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.8660254037844387,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.49999999999999994
                    }
                },
                "translation": {
                    "x": 4.904739999999999,
                    "y": 4.745482,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 21,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 1.0,
                        "X": 0.0,
                        "Y": 0.0,
                        "Z": 0.0
                    }
                },
                "translation": {
                    "x": 5.321046,
                    "y": 4.0259,
                    "z": 0.308102
                }
            }
        },
        {
            "ID": 22,
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": -0.8660254037844387,
                        "X": -0.0,
                        "Y": 0.0,
                        "Z": 0.49999999999999994
                    }
                },
                "translation": {
                    "x": 4.904739999999999,
                    "y": 3.3063179999999996,
                    "z": 0.308102
                }
            }
        },
        {
            "pose": {
                "rotation": {
                    "quaternion": {
                        "W": 0.35114692668777203,
                        "X": 0.8895263884556711,
                        "Y": -0.18386634973611068,
                        "Z": 0.2272263311182522
                    }
                },
                "translation": {
                    "x": 4.975261414530195,
                    "y": 10.107371606412972,
                    "z": -0.012881997722484717
                }
            }
        }
    ]
}

the extra pose is the one at the end.

pinned and reference tag is 18 and the focused tag is 17.
here are the field and camera calibration videos

https://drive.google.com/drive/folders/1piKNZW77aXC70hIWzsmx5dpHmSUF9uuh?usp=share_link
(I know they aren't very good videos I just wanted to get it over with quickly so that I can test it)

@ElliotScher
Copy link
Contributor

Would you be able to share your camera calibration (video or json), pinned tag and field calibration videos?

@ElliotScher
Copy link
Contributor

Would you be able to share your camera calibration parameters?

Example:

Image

@ShmayaR
Copy link
Author

ShmayaR commented Jan 23, 2025

MRcal
Square Width:1
Marker Width:0.75
Board Width:8
Board Height:8
Image Width:3840
Image Height: 2160

@ShmayaR ShmayaR closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2025
@ShmayaR ShmayaR reopened this Jan 23, 2025
@ElliotScher
Copy link
Contributor

ElliotScher commented Jan 24, 2025

Can you verify that when you are calibrating, your field calibration directory only contains your field calibration video? Can you also share what version of WPILib you are currently running and the operating system it is running on?

@ShmayaR
Copy link
Author

ShmayaR commented Jan 24, 2025

I can verify that my field calibration directory only contains my field calibration video and i'm using WPILib 2025.1.1
running on macOS 15.2

@ElliotScher
Copy link
Contributor

Make sure that you are using the same camera/lens for the camera calibration and the field calibration, other than that there a few more things to try:

If you could, try updating to WPILib version 2025.2.1, there were a couple of changes that occurred in that update and it may fix the issue.

If that doesn't work, please try printing out a ChArUco board with the 5x5 dictionary. (they can be generated here: https://calib.io/pages/camera-calibration-pattern-generator), as that is currently the only wpical compatible charuco dictionary (This is currently a feature being worked on: #7644)

@ShmayaR
Copy link
Author

ShmayaR commented Jan 24, 2025

ive solved the issue. in the video of the field, wpical Identified a random object as an April tag for just a second but because it wasn't a real April tag it had no id and therefor wouldn't let the simulation run.
thank you, I wouldn't have found the problem if you hadn't tried to help.

@ShmayaR ShmayaR closed this as completed Jan 24, 2025
@ElliotScher
Copy link
Contributor

Sounds good!

@sciencewhiz
Copy link
Contributor

Seems like there's still a bug that the tool output a tag without an id.

@sciencewhiz sciencewhiz reopened this Jan 24, 2025
@ElliotScher
Copy link
Contributor

I think it would be ok adding a check to determine if all the JSON information is present for each tag. That way if something like this happens again, it removes the entire block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants