Whitman, as a stretcher bearer and nurse, certainly saw enough of battles and non-battle activities to understand the effects of war on all who participated, whether fighting for the North or South. Originally entitled "The Veteran's Vision," "The Artilleryman's Vision" is perhaps a more appropriate title because it centers on the remembrance of an artilleryman or artillery observer:
The chief gunner ranges and sights his piece, and selects a fuse of the right time;/After firing, I see him stand aside, and look eagerly off to note the effect. . . . (ll. 15-16)
Clearly, only someone standing with the artillery could be close enough to see the techniques involved in sighting an artillery piece and understand that fuses had to be chosen based on their time increments. More important, perhaps, is that the speaker, as an artilleryman, is somewhat physically detached from the infantry, and the detachment allows him to observe the carnage rather than be a part of it.
Although Whitman is a pacifist, he is a part of the military machinery, and in several of his poems--for example, "Cavalry Crossing a Ford" and "Bivouac on a Mountainside" (and, one can argue, in "Artilleryman")--he is an observer who, like many veterans of many wars, understands that war, paradoxically, carries an appeal that its participants never quite get over. True, anyone who has been in battle doesn't want to back there, but battle can have a weird kind of beauty that one doesn't forget:
And ever the sound of the cannon, far or near, (rousing, even in dreams, a devilish exultation, and all the old mad joy, in the depths of my soul. . . . (ll. 25-26)
Even though, in the preceding lines, the speaker acknowledges "the gaps cut by the enemy's volleys," his overriding recollection is the "mad joy" he experienced in the midst of the carnage, a sentiment that is repeated by many combatants from many wars. As General W. T. Sherman said, war "is hell," but most veterans would also say that there is a perverse beauty in war that stays with them as long as the horror.
Lines 18-22 carry pure observation rather than commentary on war's good or evil. The speaker recounts a very typical infantry engagement in which a colonel, who usually commands a regiment, leads an infantry unit into battle, with the result of mass casualties and smoke that blots out everyone's vision. Whitman's goal in this poem, which is masterfully framed by the peaceful scene at the poem's beginning and the last vision of beauty and violence--"at night the varicolor'd rockets"--is to show us that war, despite its horrors, has an attraction that is undeniable.