I can’t get the setMark() command to work. It seems to not accept any argument. A google search showed there was a thread here on this topic before, but I can’t find it.
There’s a method called
def setMark(self, value): which you can use to set the absolute position in the range from -2^21 to +2^21-1. Once the mark has been set, you can then call method
def goMark(self): which will produce a motion to the marked position.
I’ve seen both methods, but I found that ‘Motor.setMark(0)’ doesn’t work. I don’t have the exact error message handy, but it was something like ‘argument cannot be a tuple, it must be an integer or…’.
I understand the issue now. The correct coding for setMark() in Motor.py should be,
def setMark(self, value): if value > 0x3fffff: value = 0x3fffff if value < -0x3fffff: value = -0x3fffff self.setParam(LReg.MARK, value)
Ok, thanks. How/where to implement this code (Linux/Python newbie here…)
Run the following command in the Terminal window, to find Motor.py file,
$ sudo find . -name Motor.py
The output should print something similar to this,
Use a Text Editor, search for method
def setMark(self, value), and make the appropriate changes to the lines of code in
Go to the directory of
./slushengine and run the following command to install the modified package:
$ sudo python3 setup.py install
Yes, that worked!
I think it’s useful to also put this line in:
if value == 0: value = self.getPosition()
There’s no harm in inserting that line too.
By the way, the error message relating to
argument cannot be a tuple, it must be an integer or… -
setMark() was trying to pass an array into
self.xfer(), which only accepts an integer value.