mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 07:13:34 +08:00
camera_trigger : rename Seagull MAP2 interface
This commit is contained in:
committed by
Lorenz Meier
parent
3dee42b5ca
commit
c06d1a9dbe
@@ -38,7 +38,7 @@ px4_add_module(
|
|||||||
SRCS
|
SRCS
|
||||||
camera_trigger.cpp
|
camera_trigger.cpp
|
||||||
interfaces/src/camera_interface.cpp
|
interfaces/src/camera_interface.cpp
|
||||||
interfaces/src/pwm.cpp
|
interfaces/src/seagull_map2.cpp
|
||||||
interfaces/src/gpio.cpp
|
interfaces/src/gpio.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
platforms__common
|
platforms__common
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2016 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2015-2017 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -34,11 +34,10 @@
|
|||||||
/**
|
/**
|
||||||
* @file camera_trigger.cpp
|
* @file camera_trigger.cpp
|
||||||
*
|
*
|
||||||
* External camera-IMU synchronisation and triggering via FMU auxiliary pins.
|
* External camera-IMU synchronisation and triggering, and support for
|
||||||
|
* camera manipulation using PWM signals over FMU auxillary pins.
|
||||||
*
|
*
|
||||||
* Support for camera manipulation via PWM signal over servo pins.
|
* @author Mohammed Kabir <kabir@uasys.io>
|
||||||
*
|
|
||||||
* @author Mohammed Kabir <mhkabir98@gmail.com>
|
|
||||||
* @author Kelly Steich <kelly.steich@wingtra.com>
|
* @author Kelly Steich <kelly.steich@wingtra.com>
|
||||||
* @author Andreas Bircher <andreas@wingtra.com>
|
* @author Andreas Bircher <andreas@wingtra.com>
|
||||||
*/
|
*/
|
||||||
@@ -66,7 +65,7 @@
|
|||||||
#include <board_config.h>
|
#include <board_config.h>
|
||||||
|
|
||||||
#include "interfaces/src/camera_interface.h"
|
#include "interfaces/src/camera_interface.h"
|
||||||
#include "interfaces/src/pwm.h"
|
#include "interfaces/src/seagull_map2.h"
|
||||||
#include "interfaces/src/gpio.h"
|
#include "interfaces/src/gpio.h"
|
||||||
|
|
||||||
#define TRIGGER_PIN_DEFAULT 1
|
#define TRIGGER_PIN_DEFAULT 1
|
||||||
@@ -257,7 +256,7 @@ CameraTrigger::CameraTrigger() :
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CAMERA_INTERFACE_MODE_SEAGULL_MAP2_PWM:
|
case CAMERA_INTERFACE_MODE_SEAGULL_MAP2_PWM:
|
||||||
_camera_interface = new CameraInterfacePWM();
|
_camera_interface = new CameraInterfaceSeagull();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-10
@@ -4,9 +4,9 @@
|
|||||||
#include <lib/mathlib/mathlib.h>
|
#include <lib/mathlib/mathlib.h>
|
||||||
|
|
||||||
#include "drivers/drv_pwm_trigger.h"
|
#include "drivers/drv_pwm_trigger.h"
|
||||||
#include "pwm.h"
|
#include "seagull_map2.h"
|
||||||
|
|
||||||
// PWM levels of the interface to seagull MAP converter to
|
// PWM levels of the interface to Seagull MAP 2 converter to
|
||||||
// Multiport (http://www.seagulluav.com/manuals/Seagull_MAP2-Manual.pdf)
|
// Multiport (http://www.seagulluav.com/manuals/Seagull_MAP2-Manual.pdf)
|
||||||
#define PWM_CAMERA_DISARMED 900
|
#define PWM_CAMERA_DISARMED 900
|
||||||
#define PWM_CAMERA_ON 1100
|
#define PWM_CAMERA_ON 1100
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
#define PWM_2_CAMERA_KEEP_ALIVE 1700
|
#define PWM_2_CAMERA_KEEP_ALIVE 1700
|
||||||
#define PWM_2_CAMERA_ON_OFF 1900
|
#define PWM_2_CAMERA_ON_OFF 1900
|
||||||
|
|
||||||
CameraInterfacePWM::CameraInterfacePWM():
|
CameraInterfaceSeagull::CameraInterfaceSeagull():
|
||||||
CameraInterface(),
|
CameraInterface(),
|
||||||
_camera_is_on(false)
|
_camera_is_on(false)
|
||||||
{
|
{
|
||||||
@@ -49,13 +49,13 @@ CameraInterfacePWM::CameraInterfacePWM():
|
|||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraInterfacePWM::~CameraInterfacePWM()
|
CameraInterfaceSeagull::~CameraInterfaceSeagull()
|
||||||
{
|
{
|
||||||
// Deinitialise pwm channels
|
// Deinitialise pwm channels
|
||||||
up_pwm_trigger_deinit();
|
up_pwm_trigger_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraInterfacePWM::setup()
|
void CameraInterfaceSeagull::setup()
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < sizeof(_pins) / sizeof(_pins[0]); i = i + 2) {
|
for (unsigned i = 0; i < sizeof(_pins) / sizeof(_pins[0]); i = i + 2) {
|
||||||
if (_pins[i] >= 0 && _pins[i + 1] >= 0) {
|
if (_pins[i] >= 0 && _pins[i + 1] >= 0) {
|
||||||
@@ -67,7 +67,7 @@ void CameraInterfacePWM::setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraInterfacePWM::trigger(bool enable)
|
void CameraInterfaceSeagull::trigger(bool enable)
|
||||||
{
|
{
|
||||||
// This only starts working upon prearming
|
// This only starts working upon prearming
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ void CameraInterfacePWM::trigger(bool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraInterfacePWM::keep_alive(bool signal_on)
|
void CameraInterfaceSeagull::keep_alive(bool signal_on)
|
||||||
{
|
{
|
||||||
// This should alternate between signal_on and !signal_on to keep the camera alive
|
// This should alternate between signal_on and !signal_on to keep the camera alive
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ void CameraInterfacePWM::keep_alive(bool signal_on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraInterfacePWM::turn_on_off(bool enable)
|
void CameraInterfaceSeagull::turn_on_off(bool enable)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (unsigned i = 0; i < sizeof(_pins) / sizeof(_pins[0]); i = i + 2) {
|
for (unsigned i = 0; i < sizeof(_pins) / sizeof(_pins[0]); i = i + 2) {
|
||||||
@@ -113,9 +113,9 @@ void CameraInterfacePWM::turn_on_off(bool enable)
|
|||||||
if (!enable) { _camera_is_on = !_camera_is_on; }
|
if (!enable) { _camera_is_on = !_camera_is_on; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraInterfacePWM::info()
|
void CameraInterfaceSeagull::info()
|
||||||
{
|
{
|
||||||
PX4_INFO("PWM trigger mode, pins enabled : [%d][%d][%d][%d][%d][%d]",
|
PX4_INFO("PWM trigger mode (Seagull MAP2) , pins enabled : [%d][%d][%d][%d][%d][%d]",
|
||||||
_pins[5], _pins[4], _pins[3], _pins[2], _pins[1], _pins[0]);
|
_pins[5], _pins[4], _pins[3], _pins[2], _pins[1], _pins[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
+5
-5
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file pwm.h
|
* @file seagull_map2.h
|
||||||
*
|
*
|
||||||
* Interface with cameras via pwm.
|
* Interface supported cameras using a Seagull MAP2 interface.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -15,11 +15,11 @@
|
|||||||
#include <uORB/topics/vehicle_status.h>
|
#include <uORB/topics/vehicle_status.h>
|
||||||
#include "camera_interface.h"
|
#include "camera_interface.h"
|
||||||
|
|
||||||
class CameraInterfacePWM : public CameraInterface
|
class CameraInterfaceSeagull : public CameraInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CameraInterfacePWM();
|
CameraInterfaceSeagull();
|
||||||
virtual ~CameraInterfacePWM();
|
virtual ~CameraInterfaceSeagull();
|
||||||
|
|
||||||
void trigger(bool enable);
|
void trigger(bool enable);
|
||||||
void keep_alive(bool signal_on);
|
void keep_alive(bool signal_on);
|
||||||
Reference in New Issue
Block a user