Just tried to install my Pan Tilt HAT using the one liner, the library installs fine, but none of the examples appear where they should.
Here’s the output from my terminal if that helps.
Looking at it, it seems to have failed to create the folder, do I need to run it as sudo?
This script will install everything needed to use
the Pimoroni Pan-Tilt HAT
Always be careful when running scripts and commands
copied from the internet. Ensure they are from a
trusted source.
If you want to see what this script does before
running it, you should run:
\curl -sS https://get.pimoroni.com/pantilthat
Note: Pan-Tilt HAT requires I2C communication
Do you wish to continue? [y/N] y
Checking environment...
Updating apt indexes...
.........
Reading package lists...
.........
Checking hardware requirements...
I2C already enabled
Checking packages required by I2C interface...
smbus installed and up-to-date
Pan-Tilt HAT comes with examples and documentation that you may wish to install.
Performing a full install will ensure those resources are installed,
along with all required dependencies. It may however take a while!
Do you wish to perform a full install? [y/N] y
mkdir: cannot create directory ‘/home/pi/Pimoroni/pantilthat’: Permission denied
Checking install requirements...
Checking for dependencies...
Installing python-pantilthat_0.0.1_all.deb...
dpkg: error processing archive /tmp/pimoroni.bw2KMu/python-pantilthat_0.0.1_all.deb (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
/tmp/pimoroni.bw2KMu/python-pantilthat_0.0.1_all.deb
python-pantilthat_0.0.1_all.deb is required
Installing python3-pantilthat_0.0.1_all.deb...
dpkg: error processing archive /tmp/pimoroni.DOcDMN/python3-pantilthat_0.0.1_all.deb (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
/tmp/pimoroni.DOcDMN/python3-pantilthat_0.0.1_all.deb
python3-pantilthat_0.0.1_all.deb is required
Installing Pan-Tilt HAT library for Python 2...
Requirement already up-to-date: pantilthat in /usr/local/lib/python2.7/dist-packages
Cleaning up...
Installing Pan-Tilt HAT library for Python 3...
Requirement already up-to-date: pantilthat in /usr/local/lib/python3.4/dist-packages
Cleaning up...
Checking for additional software...
Downloading examples and documentation...
Cloning into 'pantilt-hat'...
remote: Counting objects: 49, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 49 (delta 4), reused 35 (delta 2), pack-reused 0
Unpacking objects: 100% (49/49), done.
Checking connectivity... done.
bash: line 897: cd: /home/pi/Pimoroni/pantilthat: No such file or directory
Resources for your Pan-Tilt HAT were copied to
/home/pi/Pimoroni/pantilthat
All done!
Enjoy your Pan-Tilt HAT!
possibly. Could it be you passed it to bash with sudo at an earlier time (this one or another script)? this would have created the parent directory with restricted permissions with subsequent failure to populate it.
Yeah, I have a Pi setup script which does a lot of installing, pulling of git repos and Pimoroni one-liners. I suspect I ran that with sudo at some point. Cheers for the help.
@RogueM My next question is then, how smooth should the motion be? Running the smooth example the movement seems very jittery?
Upon further inspection, tilting in 1 degree increments back and forth seems ok, but panning in 1 degree increments, there seems to be big ‘skips’. Especially when it moves through the 45 degree point, it pauses, then skips forward to catch up. :S
Things seem to have improved now I’m using a 2.5A official supply instead of my supposed 3A USB hub ports.
Still getting the occassional judder when panning through 45 degrees (-90 is far left). Tho’ running a script which just has it panning to random positions it seems OK, so might just be an oddity with smooth.py. Would be interesting to know what other people’s experience has been?
Tho it does appear that tilting to -90 causes it to sit there vibrating, I imagine it’s going a little bit too far?
My test setup also moves buttery smooth, what version of the Pi are you running it on?
I’ve made some changes to the lib in GitHub that time-out the servo drive signal by default, so no more jitter when you hit the extremes of the servo range. It also includes tweaks to the range thanks to @stuartiannaylor.
Are you comfortable grabbing and installing a library from GitHub?
I think I need to make some changes to the range of the pan servo, the practical limit of its range is perhaps -80 to +80 but since these servos vary slightly it’s difficult to pin down.
I’m not sure if yours is a case of a faulty servo, or just being driven into the top of the Pan servo and being physically unable to move further.
With the code in GitHub, by default it shoudn’t sit vibrating for more than 2 seconds before the servo is shut off.
Thanks. Will take another look at it tonight and see whether it does indeed shut off. Physically it goes from pointing directly up to directly down so that’s fine - I’ll just have to remember that my tilt range is more like -65 to 90.
I wonder where 0 would put it? I will investigate.
Can’t seem to see any noticeable difference with the timeout stuff. It sits there vibrating regardless of what I do.
I tweaked servo_pulse_min to 800 for servo 2 (tilt) and that lets me enter tilt(-90) without any of the vibrations. Curiously it seems I can go a up to about 2450 at the other end. That puts tilt(0) at perfectly vertical.
Is this the sign of a defective servo?
Curiously the timeout stuff does seem to work on the pan servo?