# How to constrain movement on z.axis in Moveit!

I want my end effector to stay above the table and not higher than 50cm.
How can I do this? I tried this, but it's not working:

moveit_msgs::Constraints constraints;
moveit_msgs::PositionConstraint pcm;