My young mare is fantastic with her speed and barrel racing but when she is being lazy she runs my shins into the barrels no matter how hard I try turning her away, but when she is in a good mood she is a angel.
There's many different things that could be going wrong in your barrel run to be causing this, and it is hard to guess without seeing a video. Would you have a video of one of your runs for us to see?
Most of the time, it is rider error that causes a knocked barrel. What are you doing in your approach to the barrel? What are you doing with your hands? Legs? Seat? Where are you looking with your eyes?
Make sure you are not leaning in the turn and make sure you are not looking at the barrel. You horse will go where you are looking. Therefore, you should be looking at the spot on the ground that you want your horse to go to. Because if you look at the barrel, guess where you horse is going to go: INTO the barrel.
Also, are you cueing her too soon for the turn? If you don't give her a large enough pocket, she's going to have to cut a corner somewhere or else come out wide.
Is she dropping her shoulder coming into the turn? You as the rider have to keep her shoulder elevated and her body position proper, coming into the turn. Chances are, if you are trying that hard to turn her away (most riders automatically grab the outside rein and pull the nose to the outside) you are making her shoulder in even worse. You've gotta use your inside leg to push her off the barrel. If you can't do that at speed, you'll have to slow your runs back down to a trot to get her to understand wha tyou want.
Again, it would be easier to guess what could be going on if we could see a video.