setMark command not working


#1

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.


#2

Hi Wfk,

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.


#3

Hi Rakesh,

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…’.

Thanks, Wfk


#4

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)

#5

Ok, thanks. How/where to implement this code (Linux/Python newbie here…)


#6

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,

./slushengine/build/lib/Slush/Motor.py
./slushengine/Slush/Motor.py

Use a Text Editor, search for method def setMark(self, value), and make the appropriate changes to the lines of code in ./slushengine/Slush/Motor.py

Go to the directory of ./slushengine and run the following command to install the modified package:

$ sudo python3 setup.py install


#7

Yes, that worked!
I think it’s useful to also put this line in:
if value == 0: value = self.getPosition()


#8

Great!

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.