GithubHelp home page GithubHelp logo

moof-src / arducamfocus Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 6.0 5.48 MB

repository for ArduCamFocus octoprint plugin. Control an ArduCam focus from octoprint on an octopi.

Python 80.35% JavaScript 9.95% Jinja 9.70%

arducamfocus's People

Contributors

jneilliii avatar moof-src avatar rogeliodh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

arducamfocus's Issues

Unable to adjust focus with GUI

ArduCamFocus
When installing ArduCamFocus (0.0.5) in OctoPrint; there is now a control visible for ArduCam Focus with a value of 100, and two arrows, a disabled one [<] and an enabled one [>] pushing the [>] button generates the following error message.

2021-02-24 04:35:34,864 - octoprint.plugins.ArduCamFocus - INFO - setting FOCUS to 110 2021-02-24 04:35:34,866 - octoprint.util.comm - ERROR - Error while processing hook ArduCamFocus for phase queuing and command ARDUCAMFOCUS: Traceback (most recent call last): File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 4605, in _process_atcommand_phase hook(self, phase, atcommand, parameters, tags=tags) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/__init__.py", line 1890, in wrapper return f(*args, **kwargs) File "/home/pi/oprint/local/lib/python2.7/site-packages/ArduCamFocus/__init__.py", line 98, in processAtCommand self.focus(self.current_focus + int(parameters)) File "/home/pi/oprint/local/lib/python2.7/site-packages/ArduCamFocus/__init__.py", line 85, in focus self.bus.write_byte_data(0xc, data1, data2) IOError: [Errno 121] Remote I/O error

What am I missing to figure this out?

doesn't apply focus setting automatically on startup

First of all, Fantastic plugin! because of this plugin, I switched from picam v2 to Ardunio cam and it's so much better. My only gripe is that I don't leave my raspberry PI on and when I first turn it back on and switch to the control tab, the previous focus I had set isn't being applied. I have to hit either left or right one time before it applies the focus setting (even though the previous setting is still there). I'm using the latest Multicam plugin so I don't know if that's a problem.

More info about my octoprint.
browser.user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
connectivity.connection_check: 1.1.1.1:53
connectivity.connection_ok: true
connectivity.enabled: true
connectivity.online: true
connectivity.resolution_check: octoprint.org
connectivity.resolution_ok: true
env.hardware.cores: 4
env.hardware.freq: 1500
env.hardware.ram: 3959291904
env.os.bits: 32
env.os.id: linux
env.os.platform: linux
env.plugins.pi_support.model: Raspberry Pi 4 Model B Rev 1.2
env.plugins.pi_support.octopi_version: 0.17.0
env.plugins.pi_support.throttle_state: 0x0
env.python.pip: 21.0
env.python.version: 3.7.3
env.python.virtualenv: true
octoprint.safe_mode: false
octoprint.version: 1.6.0rc1
printer.firmware: Marlin bugfix-2.0.x (Mar 26 2021 05:52:09)
systeminfo.generator: systemapi

octoprint-systeminfo-20210412104947.zip
https://bundleviewer.octoprint.org/

Plugin does not work with rPi4.

I know AllaboutJay has a newer plugin for the arducam focus, but I don't like it as much as it has some problems. number 1 it has too much junk on the interface for just a focus camera that does not have ptz (even tho I hacked that plugin to remove everything but the focus slider on my rig). Also it does not save/report the current setting. everytime you pull up the webpage the focus slider is set all the way to the right...so it is hard to tweak.

rPi4 has arducam i2c interface on device 10 instead of device 0. I changed my code to point to dev10.
Here is the problem area:

__init__.py
	def on_after_startup(self):
		try: 
			self.bus = smbus.SMBus(10)  <------changed to 10.
		except:
			self._plugin_manager.send_plugin_message(self._identifier, dict(error="Unable to open SMBUS"))
		self.current_focus = self._settings.get_int(["FOCUS"])

However, I wanted to make the plugin autodetect the pi model but not sure how to do this. That data is available in octoprint but not sure how to reference it..something like this:

	def on_after_startup(self):
		try: 
                        if self.env.plugins.pi_support.model.find("Pi 4") > -1:
			    self.bus = smbus.SMBus(10)
                        else:
			    self.bus = smbus.SMBus(0)
		except:
			self._plugin_manager.send_plugin_message(self._identifier, dict(error="Unable to open SMBUS"))
		self.current_focus = self._settings.get_int(["FOCUS"])

but I am not sure how to get that data (from the system info) into the plugin. I suspect that it is supposed to use self._settings.get(), but the paths don't seem to be documented anywhere.

I2C adding access denied

I am trying to add an arducam to my octopi setup and I'm having a confusing issue and don't know how to proceed.

I am entering the

if ! grep -Fxq "^#ArduCamFocus$" /boot/config.txt; then
sudo cat << end_of_file >> /boot/config.txt
#ArduCamFocus
dtparam=i2c_vc=on
dtparam=i2c_arm=on
end_of_file
fi

set of commands to set up the camera and all I'm getting back is:

-bash: /boot/config.txt: Permission denied

I know this will be some stupid, simple issue but I'm sshing into my pi as user "pi" with my password, but don't see why it's not working. If you can point me in a direction that can help me proceed with this, I would be very grateful. Thank you for creating this!

Cannot get this to work

I followed directions, ssh in, the commands did not work so sudo nano /boot/config.txt and added the i2c commands. Went into raspi-config and enabled i2c then rebooted. I then rebooted the pi and all I get is the Arducam Focus with two small grayed out arrow boxes underneath it. Nothing like what is shown.

Octoprint Plugin Manager installing non Python 3 version

I upgraded to python 3, and I noticed that the plugin manager keeps installing the version that does not support python 3.
I've uninstalled it, and reinstalled via the plugin manager, but still getting the issue.

Name Actions
ArduCamFocus (0.0.4)  Homepage  moofChange pi camera Focus AGPLv3  Python >=2.7,<3

can't set focus while the stream is active

For some reason I can't set the focus while the camera is streaming. Not with your plugin and not with the sample scripts from ArduCam. If I stop the webcamd service I can control the focus.

Here's the error I'm seeing in the octoprint log:

2020-12-29 08:11:29,924 - octoprint.plugins.ArduCamFocus - INFO - setting FOCUS to 110
2020-12-29 08:11:29,925 - octoprint.util.comm - ERROR - Error while processing hook ArduCamFocus for phase queuing and command ARDUCAMFOCUS:
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4605, in _process_atcommand_phase
    hook(self, phase, atcommand, parameters, tags=tags)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1890, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/ArduCamFocus/__init__.py", line 98, in processAtCommand
    self.focus(self.current_focus + int(parameters))
  File "/home/pi/oprint/lib/python3.7/site-packages/ArduCamFocus/__init__.py", line 85, in focus
    self.bus.write_byte_data(0xc, data1, data2)
OSError: [Errno 121] Remote I/O error

And here's the error I'm getting from Motorized_Focus_Camera_Preview.py:

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

need releases on github for software update to work

In order for the Software Update hook to function properly you must add releases in github that match the version number identified in the setup.py. So if you merge my PR, something like this for the next stable release.

image

Then if you create a new branch named rc in your repo and push testing changes to it, when you do the release like the below (important parts highlighted) anyone with Release Candidate enabled for the plugin in Software Update settings will get an update notice.

image

"Unable to use SMBus/I2C

Hello,
I do apologize in advance, I am very much a newbie with it comes to raspberry pi's and Linux.

I purchased this camera with the hope that I could utilize it in Octoprint to focus on the actual bed and object being worked on.
Jneilliii, and others have been extremely helpful in pointing me in the right direction (https://community.octoprint.org/t/arducam-auto-focus-camera/21511/10), but I've run into this fault and I've not been able to find much about it.

I'm sure it's probably something very simple, but again, very very very new to this stuff.

Thank you.

Greetings from Arducam

Hello,

We leave a message here to express our heartfelt thanks for your help!

We have developed a plug-in for the Arducam PTZ camera.
Give you a brief introduction to the control menu:
This control supports the calibrated focus control of the camera. At the same time, it supports the rotation and pitch control of the pan/tilt lens. The user can complete the mechanical setting of the lens through the ZOOM control, and adjust the focal length through the Focus component. The ptz-til-pan control can control the pitch and rotation of the pan/tilt lens, the step is 0~180°, and the step speed can be adjusted to 5°/10°/20°. Switch the infrared filter by controlling the IRCut button control.

Interested parties can click on the link to learn more: https://www.arducam.com/docs/cameras-for-raspberry-pi/native-raspberry-pi-cameras/how-to-use-arducam-ptz-camera-with-octopi-to-monitor-3d-printers/

Most importantly, Arducam would like to give you a PTZ camera. If possible, send us your shipping address.

Our contact information is as follows:
[email protected]
Skype: arducam
Phone: +86 153 0159 8405
Linda

Sincerely
Xin

Can't focus using GUI or terminal

I have installed all prerequisites, but in logfile I still see the same errors:

OSError: [Errno 121] Remote I/O error
2021-02-04 19:41:34,743 - octoprint.plugins.ArduCamFocus - INFO - setting FOCUS to 110
2021-02-04 19:41:34,744 - octoprint.util.comm - ERROR - Error while processing hook ArduCamFocus for phase queuing and command ARDUCAMFOCUS:
Traceback (most recent call last):
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4605, in _process_atcommand_phase
hook(self, phase, atcommand, parameters, tags=tags)
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/init.py", line 1890, in wrapper
return f(*args, **kwargs)
File "/home/pi/oprint/lib/python3.7/site-packages/ArduCamFocus/init.py", line 98, in processAtCommand
self.focus(self.current_focus + int(parameters))
File "/home/pi/oprint/lib/python3.7/site-packages/ArduCamFocus/init.py", line 85, in focus
self.bus.write_byte_data(0xc, data1, data2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.