Small Aircraft; High Wing; 1 Eng; Retractable Gear
Flight Crew Private
Flight Crew Last 90 Days 2; Flight Crew Total 471; Flight Crew Type 322
Communication Breakdown; Confusion
Aircraft Equipment Problem Less Severe; Airspace Violation All Types; Deviation - Altitude Excursion From Assigned Altitude; Deviation / Discrepancy - Procedural Clearance; Deviation / Discrepancy - Procedural Published Material / Policy
Flight Crew Exited Penetrated Airspace
Aircraft; Human Factors; Environment - Non Weather Related
While on climbout from ZZZ; I activated the autopilot at about 2.2 nm  from ZZZ by pushing the reverse course and uploading it to the GNS-530.  The autopilot engaged and then turned the plane from the runway heading of 260 to a heading of 217 to intercept the course at heading of 241. When the autopilot turned to course 241 I was at about 3;000 feet MSL and was entering R-XXXX.  About 30 seconds later I realized my that I was in R-XXXX and took action to climbout of R-XXXX to the min altitude of 3;999 feel MSL.  I was able to climb above 4;000 feet in about 30 seconds and climbed out the R-2XXXX.  During this time I was still on ZZZ UNICOM.  I was not able to communicate with ZZZ TRACON well past R-XXXX.  I do not know if R-XXXX was active when I flew through it...and I did not ask ATC when I received flight following to ZZZ1 a few minutes later.This violation of airspace was caused by two actions:  1- On my flight out; I used a feature of Foreflight to plot out the procedure to enter the traffic pattern on Runway XX.  When Foreflight plotted this course out it went around R-XXXX.  When I reversed the course to take me back to ZZZ1; Foreflight plotted me directly through R-XXXX.  My failure to fully understand how the software works and making an assumption that it would take me back on the same course around R-XXXX was an error in my judgment.2- My lack of situational awareness played a large part in this.  During the climbout the air was turbulent and I was getting bumped around a bit.  This in combination with trying to change the radio to ZZZ TRACON; I lost track of where I was at and made assumptions about where I was flying.  I fell into the trap of trusting the autopilot but not verifying where it was going.My lessons learned for this flight are as follows:1- When plotting a return course; do not attempt to do it in the air; take 5 minutes and do it on the ground verifying that the course is what I expect and does not take me where I am not supposed to be.  In other words; slow down for I was trying to get back to the airport at a certain time to meet someone...I should have kept them waiting 5 minutes as I did a proper flight plan home.2- I have not been flying a lot in the last 6 month (COVID-19 has seen to that) and I was feeling a little behind the plane on this flight.  I should have brought a CFI or a safety pilot with me to check me and help me regain my proficiency.
Pilot reported entering restricted airspace and referenced lack of flying as a contributing factor.