I hope someone can help you before you take it on, this has been posted about before, most likely in a few threads on this forum.
I did a search here on the entire forum for > M1P mavic pro gimbal restart in flight < but couldn't find anything eaisly.
Did same search on google, some reading here might help . . .
Google search
Are you using a filter ?
If so, take it off and try it again.
Check the gimbal base tabs are secured where they should be, nd the little rubber band 'shock absorbers' are all ok.
Often a bad ribbon cable can cause this, they wear out sometimes through movement / hard landing, available online, simple repair, loads of youtube tutorials for this.