Main Page
Namespaces
Classes
Files
File List
scripts
rov_pid_controller.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# Copyright (c) 2016-2019 The UUV Simulator Authors.
3
# All rights reserved.
4
#
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
# you may not use this file except in compliance with the License.
7
# You may obtain a copy of the License at
8
#
9
# http://www.apache.org/licenses/LICENSE-2.0
10
#
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
16
import
rospy
17
import
numpy
as
np
18
from
uuv_control_interfaces
import
DPPIDControllerBase
19
20
21
class
ROV_PIDController
(DPPIDControllerBase):
22
"""PID controller for the dynamic positioning of ROVs."""
23
24
_LABEL =
'PID'
25
def
__init__
(self):
26
self.
_tau
= np.zeros(6)
27
DPPIDControllerBase.__init__(self,
False
)
28
self.
_is_init
=
True
29
30
def
update_controller
(self):
31
if
not
self.
_is_init
:
32
return
False
33
# Update PID control action
34
self.
_tau
= self.update_pid()
35
self.publish_control_wrench(self.
_tau
)
36
return
True
37
38
if
__name__ ==
'__main__'
:
39
print(
'Starting PID'
)
40
rospy.init_node(
'rov_pid_controller'
)
41
42
try
:
43
node =
ROV_PIDController
()
44
rospy.spin()
45
except
rospy.ROSInterruptException:
46
print(
'caught exception'
)
47
print(
'exiting'
)
rov_pid_controller.ROV_PIDController._is_init
_is_init
Definition:
rov_pid_controller.py:28
rov_pid_controller.ROV_PIDController
Definition:
rov_pid_controller.py:21
rov_pid_controller.ROV_PIDController.__init__
def __init__(self)
Definition:
rov_pid_controller.py:25
rov_pid_controller.ROV_PIDController._tau
_tau
Definition:
rov_pid_controller.py:26
rov_pid_controller.ROV_PIDController.update_controller
def update_controller(self)
Definition:
rov_pid_controller.py:30
uuv_trajectory_control
Author(s):
autogenerated on Thu Jun 18 2020 03:28:42