I've never heard of setting rattraps for woodpeckers, or shooting them. I do have an acquaintance who had his garage door torn up by a buck's rubbing. Also in grooves of the siding.
They hammer to stake out their territory. If they are looking for food they'll select a rotten spot on trees where there are worms to get. But when they start on power poles and houses, that is a territorial thing.
A 22 with bird shot works pretty well. Once they start on a house, they wont quit till they either get chased away by another wookpecker or they are done in.
A pileated sounds just like someone chopping with an ax. A yellow hammer (flicker) sounds like a air hammer going. I have seen them both drive a hole nearly right through a power pole. If you put tin over it, they'll just pound on the tin.
We have lots of woodpeckers at our feeders, but fortunately our house is aluminum sided, and they usually leave it alone. From time to time we've had a problem with one of them hammering away at our aluminum chimney cap. The din coming down the chimney would just about wake the dead, but there's no real damage. One of the folks at our local nature center told me that this hammering is part of the mating ritual of the male woodpecker. Since it is always of limited duration, I've assumed this is correct. Fortunately, there are plenty of potential mates here in our woods, so presumably our noisy fellow gets distracted by other activities. (We have Downy, Hairy, and Red-Bellied Woodpeckers, as well as Flickers and rarely, a Pileated Woodpecker).