Is there any cross compatibility between 51515 and 31313? I'm thinking of buying another Mindstorms set, and I already have a 31313. I don't want to spend $370 just to learn they are completely incapable of communicating with each other, so if you could tell me whether they are capable of communicating in any way other than mechanical (e.g. have the EV3 turn a motor and give a readout on some other sensor on the 51515) or using distance sensors, please tell me of their existence and type. Thanks.
It is possible to communicate between the 31313 and 51515 hubs.
See these youtube videos:
https://www.youtube.com/watch?v=PT4_4v1W2C8
https://www.youtube.com/watch?v=p3uk80tuqI4
In the first video a SPIKE Prime hub (same as 51515 just different firmware) is used to control a 31313 hub and in the second video there's more of explanation of how it's done.
I do not think that currently there is any compatibility between sensors. So you would need to use the 31313 hub to handle all its sensors and motors, which you could then communicate with or control from the 51515 (which is handling its own sensors and motors).