In his first two years in office, as the wars in Iraq and Afghanistan raged and there were many wounded, Mr. Obama’s trips to Walter Reed were three- and four-hour slogs during which he donned fresh hospital gowns and gloves outside every fifth room to see patients clinging to life days or weeks after being blown apart. He returned to the White House visibly drained, aides said.

More recently, he has done push-ups and other exercises with newly minted civilians who, instead of struggling to live, are trying to find ways of coping without arms, legs or equilibrium months and years after being wounded.

“The first term, our visits would last for hours because there would be 25, 50, 75 folks that we’d be seeing, going room to room, many with devastating injuries,” Michelle Obama, who has made her own trips to Walter Reed, said recently. “And now, today, just last week he went to visit, and he was there for 30 minutes because there are fewer of our men and women who are being injured in war.”

The afternoon excursions from the White House have served in many ways as the counterpoint to Mr. Obama’s 15 trips offering condolences after mass shootings, when he has openly grieved with families, tears on his face. At Walter Reed, his goal has been to thank and uplift the wounded and their families, whose sacrifices he sees as almost holy, and among whom expressions of grief are often unwelcome.

“If you are coming into this room with sorrow or to feel sorry for my wounds, go elsewhere,” read one handwritten sign outside a soldier’s door, now framed and installed on the soldiers ward.

Reggie Love, a former aide to Mr. Obama who accompanied him on nearly all of his trips to military hospitals in the first three years of his administration, said the president was good at reading the rooms he entered. Not everyone wanted an upbeat message.