In reference to the patent: WO2015002635A1
Is it ok to write a word like ''substantially'' in claims?
In general words like "substantially" or "approximately" should be avoided in claims. That does not mean that the claims will be invalid automatically but it is an invitation for scrutiny. As long a person having ordinary skill in the art would understand what substantially meant, it is acceptable. MPEP 2173.02 provides the criteria for determining if a claim in definite.
However, if you are worried about protecting similar embodiments in an invention, the doctrine of equivalents (expalined below) should suffice and the word substantially is not necessary in the claims.
The Doctrine of Equivalents is a test for infringement that if the product "performs substantially the same task in substantially the same way to arrive at the same result". See: Graver Tank & Manufacturing Co. v. Linde Air Products Co., 339 U.S. 605 (1950)
Words like "substantially" and "about" are heavily used in U.S. claims. A quick search of the USPTO's patent search database shows that close to 11% of all patents assigned to Apple, Inc., at issue, have "substantially" in a claim. That includes 4 of the 31 utility patents issued to them July 31, 2018.
Yes, those words can come back to bite you, as can every single word in a claim. This is particularly true of claims written by someone inexperienced in the seeming illogical and often-changing art of claim drafting.
Please note that many such words are effectively banned from claims in some countries.