Skip to content

Commit

Permalink
Improve auth support, add Q62 Series feature support (#75)
Browse files Browse the repository at this point in the history
* Update the python files to be python-3 compliant.  Fix some bugs in the image data parsing needed as part of this update

* Revert "Remove README.rst; no point in maintaining 2 READMEs"

This reverts commit fd18a57.

* upgraded cmakelist and package.xml, and setup.py for noetic (#70)

* Update changelog ahead of release

* 0.4.0

* Fix the #! lines to use python3, decode the utf8 bytes into a string to suppress a warning when parsing the camera position

* Update the changelog ahead of release

* 0.4.1

* Explicitly use Python3 in shebang for teleop nodes; remove unnecessary shebang in setup.py (#72)

* Update changelog ahead of release

* 0.4.2

* Add frames-per-second (fps) as a configurable option

* Reverting package change as it happens automatically

* Update changelog ahead of release

* 0.4.3

* Start adding support for the Q6215 IR mode and wiper

* Fix a couple of copy/paste errors in the launch file, set the internal IR/wiper state

* IR on/off is now working with the demo unit on my desk

* Implement the wiper service. The wiper requires a fixed duration; it can't operate continuously. Run the wiper for 10s intervals

* Add support for the Q6215's defogger. Ensure that wiper, defog, IR modes are all disabled on startup

* Add a launch argument to expose the encrypted password option

* Add a timeout to the axis-cgi calls, make sure the HTTP response is 200 (otherwise raise an exception)

* Expand the readme with details on usage, supported devices, available topics & services

* Small code cleanup, remove the default password. Add support for basic auth if the encrypted password flag isn't set

* Add support for authentication to the PTZ node

* Update the readme

* Enable password encryption in view_axis.launch

* Don't bother loading the custom calibration in the view_axis test launch

* Add python3-requests as a dependendency

* Fix the pan direction in the readme

* Fix a bug where the PTZ brightness wasn't being reported correctly. Add support for the autoiris feature available on some cameras. Update the list of tested camera series.

---------

Co-authored-by: jmastrangelo-cpr <[email protected]>
Co-authored-by: Joey Yang <[email protected]>
Co-authored-by: Jason Higgins <[email protected]>
Co-authored-by: Tony Baltovski <[email protected]>
  • Loading branch information
5 people authored Mar 17, 2023
1 parent 5b97c57 commit efa20df
Show file tree
Hide file tree
Showing 14 changed files with 517 additions and 105 deletions.
39 changes: 37 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
Change history
==============

0.4.3 (2022-08-22)
------------------
* Merge pull request `#73 <https://github.com/ros-drivers/axis_camera/issues/73>`_ from jhiggins-cpr/noetic-devel
Add frames-per-second (fps) as a configurable option
* Reverting package change as it happens automatically
* Add frames-per-second (fps) as a configurable option
* Contributors: Jason Higgins, Tony Baltovski

0.4.2 (2022-07-29)
------------------
* Explicitly use Python3 in shebang for teleop nodes; remove unnecessary shebang in setup.py (`#72 <https://github.com/ros-drivers/axis_camera/issues/72>`_)
* Contributors: Joey Yang

0.4.1 (2022-06-16)
------------------
* Fix the #! lines to use python3, decode the utf8 bytes into a string to suppress a warning when parsing the camera position
* Contributors: Chris Iverach-Brereton

0.4.0 (2021-11-29)
------------------
* upgraded cmakelist and package.xml, and setup.py for noetic (`#70 <https://github.com/ros-drivers/axis_camera/issues/70>`_)
* Update the python files to be python-3 compliant. Fix some bugs in the image data parsing needed as part of this update
* Merge pull request `#55 <https://github.com/ros-drivers/axis_camera/issues/55>`_ from sgemme-csa/master
KeyError in publishCameraState when camera is not ready on PTZ camera
* Merge branch 'master' of github.com:ros-drivers/axis_camera
* Expose the height & width parameters as arguments in the launch file
* Merge pull request `#56 <https://github.com/ros-drivers/axis_camera/issues/56>`_ from jeff-o/patch-1
Update axis.launch
* Revert "Fix up the main scripts to be python-3 compliant"
This reverts commit 569e4b22415edee653914fa387a689d2e85e2879.
* Fix up the main scripts to be python-3 compliant
* Merge branch 'master' of github.com:ros-drivers/axis_camera

0.3.2 (2021-05-21)
------------------
* Improve support for the F34 and F44 multi-camera controllers by adding default values for the camera index (1-4). Change the camera arg in view_axis to camera_name, change its default IP address to better-match with the main axis.launch file
Expand All @@ -22,10 +55,11 @@ Change history
* Remove the html_static directory from conf.py; it doesn't exist anyway and is just creating a warning that's causing Jenkins to see the build as unstable
* Fix Python 3 syntax error
`#52 <https://github.com/ros-drivers/axis_camera/issues/52>`_ again
* Remove the :: leftover from the .rst
* Copy the README contents to the .md so they show up on the github main page
* Update the maintainer now that Clearpath is officially maintaining this package again
* Merge pull request `#54 <https://github.com/ros-drivers/axis_camera/issues/54>`_ from k-okada/add_travis
update travis.yml
* update travis.yml
* add support for quad video
* Update axis.launch
Adds the "camera" param to the launch file. Helps launch the driver cleanly when used with other drivers that also use "camera" as a param name.
Expand All @@ -35,8 +69,9 @@ Change history
* Merge remote-tracking branch 'github/master' into develop
* Merge branch 'develop' of git+ssh://liberty/data/git/ros/axis_camera into develop
* Fixing camera telemetry where accessing its telemetry before a certain time after startup would causes a KeyError because the fields in the response were not present. Now catching the KeyError exception to fix the problem.
* Fixing camera telemetry where accessing its telemetr before a certain time after startup would cause a KeyError because the fiels in the response were not present, now catchin the KeyError exception to fix the problem
* Fixing connection problem which was causing the telemetry to stall
* Contributors: Chris I-B, Christian Clauss, Howell, Jeff Schmidt, Kei Okada, Sebastien Gemme, Tony Baltovski
* Contributors: Chris I-B, Christian Clauss, Howell, Jeff Schmidt, Kei Okada, Sebastien Gemme, jmastrangelo-cpr

0.3.0 (2018-05-25)
------------------
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.0.2)
project(axis_camera)

find_package(catkin REQUIRED
Expand All @@ -17,7 +17,7 @@ generate_dynamic_reconfigure_options(cfg/PTZ.cfg)

catkin_package()

install(PROGRAMS
catkin_install_python(PROGRAMS
nodes/axis.py
nodes/axis_ptz.py
nodes/publish_axis_tf.py
Expand Down
145 changes: 145 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,148 @@ There is no released code API.
Each official release is tagged in the repository. The
[change history](https://github.com/clearpathrobotics/axis_camera/blob/master/CHANGELOG.rst) describes every version.


Supported Cameras
------------------

The following is a list of cameras that have been tested with this driver and are known to work. Other cameras may
also be usable, but have not been tested by the developers/maintainers of this package.

If you have used this driver with a specific model of camera not listed below, please submit a PR so we can keep this
list up-to-date.

- [F Series](https://www.axis.com/products/axis-f-series)
- [M30 Series](https://www.axis.com/products/axis-m30-series)
- [P55 Series](https://www.axis.com/products/axis-p55-series)
- [Q62 Series](https://www.axis.com/products/axis-q62-series)



Camera Preparation
-------------------

Before using the ROS driver you should ensure your camera is properly connected to the PC and powered as-per the
manufacturer's specifications.

We recommend configuring the camera to use a static IP address on your robot's internal wired LAN, rather than DHCP.
Because the driver addresses the camera by hostname or IP address it's easier if the address is constant.

HTTP Authentication and Anonymous Control
------------------------------------------

By default most Axis cameras require HTTP authentication to view the camera data & to send PTZ (or other) commands.

There are two solutions to this:

1. Log into the camera's web GUI and enable `Anomymous Viewers` and `Anonymous PTZ Operators`. These options can usually
be found under settings > Users
2. Configure the launch file to use a valid Axis user's username and password. This is done with the `username` and
`password` arguments to `axis.launch`. Some cameras require HTTP Digest authentication instead of basic
authentication. If this is the case for your camera, make sure to also set the `encrypt_password` argument im
`axis.launch`. (The Q62 series cameras are known to require digest authentication.)

Usage Examples
---------------

Once the camera is configured, simply launch the driver:

```bash
roslaunch axis_camera axis.launch hostname:=192.168.0.90 username:=root password:=password
```

If your camera requires digest authentication instead of basic authentication, set the `encrypt_password` argument:

```bash
roslaunch axis_camera axis.launch hostname:=192.168.0.90 username:=root password:=password encrypted:=true
```

If your camera supports PTZ control, you can enable it with

```bash
roslaunch axis_camera axis.launch hostname:=192.168.0.90 username:=root password:=password enable_ptz:=true
```

In the case of the F Series cameras, multiple cameras can be connected to a single controller box. In this case, launch
the driver once for each physical camera, specifying the camera name & ID number. The ID number corresponds to the
physical port in the e.g. F34 controller (1-4).

```bash
roslaunch axis_camera axis.launch hostname:=192.168.0.90 username:=root password:=password camera_name:=front_camera camera:=1

roslaunch axis_camera axis.launch hostname:=192.168.0.90 username:=root password:=password camera_name:=rear_camera camera:=2
```

The Q62 Series cameras also feature a night-vision mode (adds and IR illuminator and disables the IR filter), a lens
wiper, and a defogger in addition to the normal PTZ control. To enable all of this camera's supported features, use

```bash
roslaunch axis_camera axis.launch hostname:=192.168.0.90 username:=root password:=password encrypt_password:=true enable_ptz:=true enable_ir:=true enable_defog:=true enable_wiper:=true
```

Topics and Services
--------------------

The camera's main image data is published on `/camera_name/image_raw/compressed` as a `sensor_msgs/CompressedImage`.

If the `enable_theora` argument is `true` then additional image topics are available in the `/camera_name/image_raw_out`
namespace, including `/camera_name/image_raw_out/theora` as `theora_image_transport/Packet` messages.

PTZ control (if enabled) uses the `axis_camera/Axis.msg` type:

```
float32 pan
float32 tilt
float32 zoom
float32 focus
float32 brightness
float32 iris
bool autofocus
bool autoiris
```

To write to the camera, use

```bash
rostopic pub /camera_name/cmd axis_camera/Axis "{pan: 45.0, tilt: 20.0, zoom: 1000.0, focus: 0.0, brightness: 1.0, iris: 1.0, autofocus: true, autoiris: true}" -1
```

All writable camera properties are set simultaneously. It is recommended to read the camera's current state from
`/camera_name/state`, copy the `focus`, `autofocus`, `brightness`, and `iris` parameters, and then set the `pan`,
`tilt` and `zoom` fields as desired. Failure to set the `brightness` field may result in a very dark image.

`pan` and `tilt` are expressed in degrees (for ease of use with Axis' REST API) with positive tilt being upwards and
positive pan being clockwise.

`zoom` is a value from 1 to 10000, with higher numbers indicating a narrower field of view.

The Q62 Series' IR mode can be toggled by running

```bash
rosservice call /camera_name/set_ir_on "data: true" # or "data: false"
```

When IR mode is on the IR illuminator will be turned on and the IR filter turned off. The current state of the IR
mode can be read from `/camera_name/ir_on` as a `std_msgs/Bool`.

To enable the defogger, run

```bash
rosservice call /camera_name/set_defog_on "data: true" # or "data: false"
```

The current state of the defogger can be read from `/camera_name/defog_on` as a `std_msgs/Bool`.

To start the lens wiper, run

```bash
rosservice call /camera_name/set_wiper_on "data: true"
```

The wiper will run for 10s and stop automatically. You can stop the wiper early by running

```bash
rosservice call /camera_name/set_wiper_on "data: false"
```

The current state of the wiper can be read from `/camera_name/wiper_on` as a `std_msgs/Bool`.
16 changes: 8 additions & 8 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
master_doc = 'index'

# General information about the project.
project = u'axis_camera'
copyright = u'2012, Ryan Gariepy'
project = 'axis_camera'
copyright = '2012, Ryan Gariepy'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -187,8 +187,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'axis_camera.tex', u'ROS Axis camera driver.',
u'Ryan Gariepy', 'manual'),
('index', 'axis_camera.tex', 'ROS Axis camera driver.',
'Ryan Gariepy', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -217,8 +217,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'axis_camera', u'ROS Python Axis camera driver.',
[u'Ryan Gariepy'], 1)
('index', 'axis_camera', 'ROS Python Axis camera driver.',
['Ryan Gariepy'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -231,8 +231,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'axis_camera', u'axis_camera Documentation',
u'Ryan Gariepy', 'axis_camera', 'ROS Axis camera driver.',
('index', 'axis_camera', 'axis_camera Documentation',
'Ryan Gariepy', 'axis_camera', 'ROS Axis camera driver.',
'Miscellaneous'),
]

Expand Down
15 changes: 15 additions & 0 deletions launch/axis.launch
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
<launch>
<arg name="camera_name" default="axis" />
<arg name="hostname" default="192.168.0.90" />
<arg name="username" default="root" />
<arg name="password" default="" />
<arg name="encrypt_password" default="false" />

<arg name="enable_theora" default="0" />
<arg name="enable_ptz" default="0" />
<arg name="enable_ptz_teleop" default="0" />
<arg name="enable_defog" default="0" />
<arg name="enable_ir" default="0" />
<arg name="enable_wiper" default="0" />
<arg name="width" default="640" />
<arg name="height" default="480" />
<arg name="camera" default="1" />

<group ns="$(arg camera_name)">
<param name="hostname" value="$(arg hostname)" />
<param name="username" value="$(arg username)" />
<param name="password" value="$(arg password)" />
<param name="use_encrypted_password" value="$(arg encrypt_password)" />
<param name="width" value="$(arg width)" />
<param name="height" value="$(arg height)" />
<param name="camera" value="$(arg camera)" />
<param name="frame_id" value="$(arg camera_name)" />
<param name="wiper" value="$(arg enable_wiper)" />
<param name="defog" value="$(arg enable_defog)" />
<param name="ir" value="$(arg enable_ir)" />

<node pkg="axis_camera" type="axis.py" name="axis" />
<node pkg="axis_camera" type="axis_ptz.py" name="axis_ptz" if="$(arg enable_ptz)" />

Expand Down
1 change: 1 addition & 0 deletions msg/Axis.msg
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ float32 focus
float32 brightness
float32 iris
bool autofocus
bool autoiris
Loading

0 comments on commit efa20df

Please sign in to comment.