060726-1501 EST USA
I do not know Fanuc details, and I am not where the HAAS manual is.
On HAAS I would use G5x (in your case G54) as the base zero reference. This might be a location near one corner of the pallets. Then I would use G52 to offset from the G54 to the work zero for your part. This hopefully will be clear in the following example.
If there is a machine variable that contains the the pallet number, assume for the following example it is #3028 (pallet number in receiver from HAAS manual on line -- I do not know what this is because we do not have a pallet changer machine), and that a 1 in this variable is pallet 1 and a 2 is pallet 2, then we can make your part zero relative to machine zero automatically set based on which pallet is in the machine. This is automatic as follows:
You can either manually load G54 before you run the program or G54 can be loaded at the start of the program. But this G54 value will remain unchanged from part to part and pallet to pallet. So will the two different G52 values remain constant, but the ones loaded into the G52 location are determined by which pallet is in the machine.
Within your program you will have
IF [ #3028 NE 1 ] GOTO 110
G52 X5.1260 Y4.8796 (for pallet 1 work zero from G54)
IF [ #3028 NE 2 ] GOTO 120
G52 X5.1753 Y4.9903 (for pallet 2 work zero from G54)
(Pallet number error)
(Your common program is here)