ros-drivers / axis_camera Goto Github PK
View Code? Open in Web Editor NEWContains basic Python drivers for accessing an Axis camera's MJPG stream. Also provides control for PTZ cameras.
License: BSD 3-Clause "New" or "Revised" License
Contains basic Python drivers for accessing an Axis camera's MJPG stream. Also provides control for PTZ cameras.
License: BSD 3-Clause "New" or "Revised" License
The driver publishes sensor_msgs/CompressedCameraimages on the
compressed` topic.
To work properly with image_transport
and image_proc
, that topic should be named image_raw/compressed
.
I am thinking of writing a Python camera_info_manager
module, with a subset of the full C++ implementation.
With that, the camera driver would use a standard camera_info_url
parameter to access calibration information for the appropriate device.
Would it be possible to add a parameter for choosing camera or maybe a parameter for a string to append to the URL parameters?
Now I did in axis.py:
def formURL(self):
self.url = 'http://%s/mjpg/video.mjpg' % self.axis.hostname
self.url += "?fps=0&resolultion=%dx%d" % (self.axis.width,
self.axis.height)
self.url += "&camera=2"
rospy.logdebug('opening ' + str(self.axis))
axis.py tries to import: import urllib2
but since python 3 that library is broken into parts and cannot be imported that way:
https://stackoverflow.com/a/2792652
Python 2 is no longer supported as of January 2020
Could you please work for this?
I need this change. #38
Hello,
I am running into an issue where I cannot view the published Axis camera images using the image_view package. I run rosrun axis_camera axis.py
where the default host name is 192.168.0.90
and I get the warning that the publisher should be created with an explicit keyword argument 'queue_size'
. When I run image_view to view the raw image stream, the axis camera node prints out the warning
[WARN] [WallTime: 1456299554.224392] Error opening URL http://192.168.0.90/mjpg/video.mjpg?fps=0&resolution=640x480Possible timeout. Looping until camera appears
which doesn't make sense because I can go to my web browser and type in 192.168.0.90
and I'm able to view the live stream and command the PTZ.
I've even tried removing the axis_camera package and using the latest tagged release version and I still get the same error.
Any help would be appreciated!
bug in axis.py
line 128:
cimsg.header.stamp = msg.header.stamp // (exception is thrown here!)
should read
cimsg.header.stamp = self.msg.header.stamp
Include README.rst and CHANGELOG.rst, as well.
https://github.com/pal-robotics-forks/axis_rqt_plugin
Maybe someone is interested in this plugin. You have an image view of the camera and if you click on it you move the camera, if you scroll in it you zoom (if the camera has the corresponding dynamic reconfigure for it). It's not very fast, but it works.
This provides a convenient way for users to update parameters while the driver is running.
The default tests should verify that the scripts can all be loaded and invoked, even when there is no actual device attached. These tests can run on the build farm.
Under CMake variable control: enable conditional tests that verify basic device function with various real cameras attached.
Make modules in src/ with code common to the various nodes.
Move the nodes themselves into scripts/ (standard location). Each one should just import and then invoke an appropriate module function.
I have ros melodic and axisip3935-lr camera. I cloned the github and catkin_make done. Then i tried to launch the node. But, the terminal showed error "import camera_info_manager ModuleNotFoundError: No module named 'camera_info_manager'". How can i rectify it.
Hello,
Currently the change 3 months ago to fix the error in teleop.py is not being tracked on ros-melodic-axis-camera. Would it be possible to fix this? I have an implementation that I would like to be fully supported by the axis_camera package without needing replacement of the teleop.py node.
Thanks,
Grant
The authentication doesn't work when the axis camera only accept authentication with encrypted password. It would be nice to handle this kind of authentication.
Hi.
If I want to control ptz, what should I do after executing the command below?
rosrun axis_camera axis_ptz.py _hostname:=IP_ADDRESS_OF_YOUR_CAMERA
Thanks!
Is there a way to force the PTZ operation to happen more smoothly? I wrote my own teleop procedure for the camera, and currently it seems to execute a pan or tilt operation once every second to a few seconds. It also is buffering commands a bit even though the subscribed queue size is 1 (from axis_ptz.py), so I'm guessing the camera is imposing some buffer. Is this slow delay a function of the camera hardware or the web interface used to send commands?
Thanks!
The apt version of axis_camera is at 0.3.2
but it's broken for python3 due to the urllib2
issue.
Can we get a new release for the buildfarm of the noetic-devel
branch?
Greetings,
Thanks for the ros pkg guys! I have tested the noetic devel branch with the M5525-E model and it is working fine after all the fixes with the python3 rosdep and the recomendation of this guy: NVlabs/Deep_Object_Pose#167 (comment)
Also in order to get the image from the camera you must set the ecrypted_password=true
Thanks again you can add this axis model to the tested list as well.
CMake Error at /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:72 (find_package):
Could not find a package configuration file provided by
"camera_info_manager_py" with any of the following names:
camera_info_manager_pyConfig.cmake
camera_info_manager_py-config.cmake
Add the installation prefix of "camera_info_manager_py" to
CMAKE_PREFIX_PATH or set "camera_info_manager_py_DIR" to a directory
containing one of the above files. If "camera_info_manager_py" provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
axis_camera/CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
Invoking "cmake" failed
Implied in this would be publishing a TF for the current orientation of the pan-tilt.
I'm having trouble viewing images from the axis driver, and I'm just trying to cover all issues.
When I launch:
roslaunch axis_camera axis.launch hostname:=axis_camera_hostname
I get the error:
/home/cholloway/workspace/axis_camera/src/axis_camera/nodes/axis.py:156: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
self.pub = rospy.Publisher("image_raw/compressed", CompressedImage, self)
thanks in advance !!!!
Not sure if this is related to the driver itself. Axis node stops publishing, however it's still running.
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/home/devex/catkin_ws/src/axis_camera/nodes/axis.py", line 24, in run
self.stream()
File "/home/devex/catkin_ws/src/axis_camera/nodes/axis.py", line 30, in stream
if self.openURL():
File "/home/devex/catkin_ws/src/axis_camera/nodes/axis.py", line 62, in openURL
self.fp = urllib2.urlopen(self.url, timeout=self.timeoutSeconds)
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 406, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 438, in error
result = self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 890, in http_error_401
url, req, headers)
File "/usr/lib/python2.7/urllib2.py", line 865, in http_error_auth_reqed
response = self.retry_http_basic_auth(host, req, realm)
File "/usr/lib/python2.7/urllib2.py", line 878, in retry_http_basic_auth
return self.parent.open(req, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1180, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib/python2.7/httplib.py", line 1038, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 371, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
timeout: timed out
My launch file:
<node pkg="axis_camera" type="axis.py" name="axis">
<param name="username" value="$(arg username)" />
<param name="password" value="$(arg password)" />
</node>
<node pkg="image_transport" type="republish" name="republish" args="compressed in:=image_raw/ raw out:=image_raw" />
<!-- Rectifying the image_raw -->
<node pkg="image_proc" type="image_proc" name="image_proc" />
Hi,
Apparently there is no package "ros-melodic-axis-camera" for Ubuntu (18.04.03 LTS).
Also it is not listed at http://wiki.ros.org/axis_camera
Is it planned to bring axis camera to Melodic?
Thanks!
In axis.py line 31, there a traceback.print_exc()
.
That causes trouble when the node is running unattended, making problems hard to debug.
A better solution is:
rospy.logerr(traceback.format_exc())
Hi everyone,
I'm currently working on a complete acquisition of several AXIS cameras linked to a F44 switch unit.
I managed to run the driver and publish successfully the raw images in the topic /axis/image_raw/compressed and now I'd like to retrieve the images of each camera in different topics simultaneosly to save it into rosbag afterwards.
Do you know I could achieve that ? I know that i have to use the url but it seems like the attributes of the axis object are not updated which means the 'camera' attribute remains at 0...
Since axis_camera has not yet been released to either of those ROS distributions, we might as well convert it to catkin, first. The main dependency, camera_info_manager_py, is already converted and available on both Groovy and Hydro.
Just for information, because python is sometimes introducing huge delay (like 4-5 seconds!), I was investigating another option to get the camera video stream.
Using gstreamer and gscam seems to work but uses a lot of CPU if it does the decoding itself. The patch below to gscam allows publishing the jpeg stream, same as the axis_driver.
ros-drivers/gscam#11
This looks like a good alternative on the kingfisher, although I haven't found yet how to tell gstreamer to use additional parameter in the get request (like resolution, fps, image size).
My camera is camera Axis M10XX, not a ptz type .
I meet a error like follwing.
File "/home/robot/axisM10/src/axis_camera/nodes/axis.py", line 13, in
import camera_info_manager
ImportError: No module named camera_info_manager
my ros version is indigo, I have installed camera-info-manager pkg use apt tool,
but this error still exist.
can you tell me how to solve this problem?
Thank you sincerely
According to http://wiki.ros.org/axis_camera, axis_camera is under the BSD license, which says
Alas, there are multiple variants of the BSD license out there and it's not obvious to me which one applies. Could you add a copy of the license with copyright notice on top to the axis_camera repo to save distributors from having to figure it out?
Even better if individual source files have a short notice [1] so the license information is easy to track down even out of context.
Thanks,
Jonathan
[1] like this one: https://go.googlesource.com/go/+/master/src/go/ast/ast.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
image_view
, which ought not be a dependency of the driver, itself.axis.launch
is not compatible with the current driver parameters and topic names.axis_ptz.launch
seems to have similar issues.If the camera is unavailable on the network when the driver starts, it should initiate a slow poll waiting for it to respond.
Similarly, if the device stops sending images, the driver should wait in a slow poll loop until access is recovered and the camera reconnected.
The driver should provide ROS diagnostic information on the status and availability of the camera.
@k-okada, I noticed this was marked as orphaned, @civerachb-cpr and/or myself would be interesting in helping out as we deal with these cameras often.
When using multiple cameras, we need to define different TF frame identifiers for each device.
I propose to do that by adding a frame_id
parameter, with a default value of "axis_camera". I don't think the published frame identifier is supposed to include the "_optical" suffix.
When launched the axis_camera node fills the row.log file with this error:
[[31m[ERROR] [1423596401.252559513]: Compressed Depth Image Transport - Compression requires single-channel 32bit-floating point or 16bit raw depth images (input format is: bgr8)
The test conditions are an Axis M1013 camera set to 640x480, with enable_theora=1. The node doesn't crash and I do get an image, so this is more of a question about whether this is a problem (aside from filling the log file with junk).
Hello, I would like to know whether the related drivers of axis camera support work under ubuntu 20.04+ros noetic or ubuntu20.04+ros2 foxy version? I try to run under ubuntu20.04+ros noetic, but when I execute roslaunch axis_camera axis.launch, no error is reported, but at the same time I can't see the camera image using rviz, but I can see it clearly using rostopic list The topic to the camera is indeed released, but there is no data, I don’t know why, I hope you can help me, thank you~
I'm writing this as the maintainer of the package. When I inherited this project, the package was already released using degree for the pan
and tilt
positions in the Axis
messages. Obviously the ROS standard is to use radians.
I'm hesitant to change the units used by the package simply because it's been released and used in its current state for years. But the fact that the message uses non-standard units makes interoperability with other ROS packages less convenient.
My initial proposal is to add a new rosparam
option to the PTZ node to specify the units:
<node pkg="axis_camera" type="teleop.py" name="teleop" if="$(arg enable_ptz_teleop)">
<param name="use_degrees" value="1" />
<param name="enable_button" value="1" />
<param name="scale_pan_deg" value="25" />
<param name="scale_tilt_deg" value="25" />
<remap from="joy" to="/joy" />
</node>
I'd like to use radians by default, as this is the ROS standard. But initially the default may remain degrees so as not to break anything that depends on this package.
Before I implement any of this work, I'm going to leave this issue open to solicit feedback from the wider community. If you have opinions on this proposal, please leave them below!
The Axis M5525 appears to be Axis' replacement for the P-series PTZ cameras. While the driver is able to stream MJPEG data from the camera just fine, a continuous stream of warning messages are also generated while the image stream is accessed. The message is as follows, with the number of bytes varying somewhat between messages:
Corrupt JPEG data: 651 extraneous bytes before marker 0xd9
These messages are a nuisance!
Hi guys,
I am using an AXIS M5525-E PTZ Dome camera and I am trying to connect it with ROS. I am able to get the image stream and control pan/tilt and zoom. However, I am not able to control the brightness. I can publish the desired brightness value, but it doesn't change in the system status and also the image brightness is not changing. Since it remains set to 0, the images suddenly become dark.
Do you have any hint?
The current driver always prompts for the username and password, even when they were specified as parameters.
I think that is happening under the covers inside urllib.urlopen()
. There seem to be ways to provide the authentication information automatically, either by overloading the prompt_user_passwd()
method, or by migrating to urllib2
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.