The question is: How is publishing code as open source of advantage to you?
The question is: What are you selling? Hardware or software?
If the software is the product, then close it obviously. There's money to be had from support contracts, but that's more of a pathway for monetising an existing free software project than for setting up a new business.
If the hardware is the product, then open the software. In doing so you effectively recruit every university doing research in the field, since they will all have tweaks and improvements. They publish their research, along with the software used (copyleft is good for that) and you either modify your own default software, or add the code to a repository for special purpose software. Your code is continuously improved and supports an increasingly wide range of applications.
Your competitor can adapt the results to their product as well, of course, but first of all they've got to port it. Meanwhile the number of applications for your sensor with custom software from third parties is going to grow and grow...
... probably. I don't want to sound too dogmatic when I only have a sketchy outline of the situation. But that's the way I'd look at it.