mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-23 23:12:04 +08:00
Merge branch 'devel-staging' of https://github.com/commaai/openpilot into devel
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@ selfdrive/sensord/_gpsd
|
||||
selfdrive/sensord/_sensord
|
||||
selfdrive/camerad/camerad
|
||||
selfdrive/modeld/_modeld
|
||||
selfdrive/modeld/_monitoringd
|
||||
selfdrive/modeld/_dmonitoringmodeld
|
||||
/src/
|
||||
|
||||
one
|
||||
|
||||
@@ -29,3 +29,12 @@ Code is automatically check for style by travis as part of the automated tests.
|
||||
We've released a [Model Port guide](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) for porting to Toyota/Lexus models.
|
||||
|
||||
If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84). You might also be eligible for a bounty. See our bounties at [comma.ai/bounties.html](https://comma.ai/bounties.html)
|
||||
|
||||
## Pull Requests
|
||||
|
||||
Pull requests should be against the master branch. Before running master on in-car hardware, you'll need to run
|
||||
```
|
||||
git submodule init
|
||||
git submodule update
|
||||
```
|
||||
in order to pull down the submodules, such as `panda` and `opendbc`.
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
autoconf \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
ffmpeg \
|
||||
git \
|
||||
libarchive-dev \
|
||||
libbz2-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libeigen3-dev \
|
||||
libffi-dev \
|
||||
libglew-dev \
|
||||
libgles2-mesa-dev \
|
||||
libglfw3-dev \
|
||||
libglib2.0-0 \
|
||||
liblzma-dev \
|
||||
libmysqlclient-dev \
|
||||
libomp-dev \
|
||||
libopencv-dev \
|
||||
libssl-dev \
|
||||
libsqlite3-dev \
|
||||
libtool \
|
||||
libusb-1.0-0-dev \
|
||||
libzmq5-dev \
|
||||
locales \
|
||||
ocl-icd-libopencl1 \
|
||||
ocl-icd-opencl-dev \
|
||||
opencl-headers \
|
||||
python-dev \
|
||||
python-pip \
|
||||
screen \
|
||||
sudo \
|
||||
vim \
|
||||
wget
|
||||
|
||||
|
||||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
|
||||
|
||||
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"
|
||||
RUN pyenv install 3.7.3
|
||||
RUN pyenv global 3.7.3
|
||||
RUN pyenv rehash
|
||||
|
||||
RUN pip install pipenv==2018.11.26
|
||||
|
||||
COPY Pipfile /tmp/
|
||||
COPY Pipfile.lock /tmp/
|
||||
|
||||
RUN python --version
|
||||
RUN cd /tmp && pipenv install --system --deploy
|
||||
|
||||
# Install subset of dev dependencies needed for CI
|
||||
RUN pip install matplotlib==3.1.1 dictdiffer==0.8.0 fastcluster==1.1.25 aenum==2.2.1 scipy==1.3.1 lru-dict==1.1.6 tenacity==5.1.1 azure-common==1.1.23 azure-nspkg==3.0.2 azure-storage-blob==2.1.0 azure-storage-common==2.1.0 azure-storage-nspkg==3.1.0 pycurl==7.43.0.3
|
||||
|
||||
COPY phonelibs/install_capnp.sh /tmp/install_capnp.sh
|
||||
RUN /tmp/install_capnp.sh
|
||||
|
||||
RUN git clone --branch v0.7 https://github.com/commaai/openpilot-tools.git /tmp/openpilot/tools
|
||||
|
||||
ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH}
|
||||
COPY ./.pylintrc /tmp/openpilot/.pylintrc
|
||||
COPY ./common /tmp/openpilot/common
|
||||
COPY ./cereal /tmp/openpilot/cereal
|
||||
COPY ./opendbc /tmp/openpilot/opendbc
|
||||
COPY ./selfdrive /tmp/openpilot/selfdrive
|
||||
COPY ./phonelibs /tmp/openpilot/phonelibs
|
||||
COPY ./pyextra /tmp/openpilot/pyextra
|
||||
COPY ./panda /tmp/openpilot/panda
|
||||
|
||||
COPY SConstruct /tmp/openpilot/SConstruct
|
||||
|
||||
RUN mkdir -p /tmp/openpilot/selfdrive/test/out
|
||||
RUN cd /tmp/openpilot && scons -j$(nproc)
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
code_dir := $(shell pwd)
|
||||
|
||||
# TODO: Add a global build system
|
||||
|
||||
.PHONY: all
|
||||
all:
|
||||
cd selfdrive && PYTHONPATH=$(code_dir) PREPAREONLY=1 ./manager.py
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
opencv-python= "==3.4.2.17"
|
||||
PyQt5 = "*"
|
||||
ipython = "*"
|
||||
networkx = "==2.3"
|
||||
azure-core = "==1.1.1"
|
||||
azure-common = "==1.1.24"
|
||||
azure-nspkg = "==3.0.2"
|
||||
azure-storage-blob = "==2.1.0"
|
||||
azure-storage-common = "==2.1.0"
|
||||
azure-storage-nspkg = "==3.1.0"
|
||||
boto = "*"
|
||||
"boto3" = "*"
|
||||
control = "*"
|
||||
datadog = "*"
|
||||
dlib = "*"
|
||||
elasticsearch = "*"
|
||||
future = "*"
|
||||
futures = "*"
|
||||
pycocotools = {git = "https://github.com/cocodataset/cocoapi.git",subdirectory = "PythonAPI"}
|
||||
gunicorn = "*"
|
||||
"h5py" = "*"
|
||||
hexdump = "*"
|
||||
"html5lib" = "*"
|
||||
imageio = "*"
|
||||
ipykernel = "*"
|
||||
joblib = "*"
|
||||
json-logging-py = "*"
|
||||
jupyter = "*"
|
||||
libarchive = "*"
|
||||
lru-dict = "*"
|
||||
"mpld3" = "*"
|
||||
msgpack-python = "*"
|
||||
nbstripout = "*"
|
||||
numpy = "*"
|
||||
osmium = "*"
|
||||
pbr = "*"
|
||||
percache = "*"
|
||||
pprofile = "*"
|
||||
pycurl = "*"
|
||||
git-pylint-commit-hook = "*"
|
||||
pymongo = "*"
|
||||
"pynmea2" = "*"
|
||||
pypolyline = "*"
|
||||
python-logstash = "*"
|
||||
redis = "*"
|
||||
"s2sphere" = "*"
|
||||
scikit-image = "*"
|
||||
"subprocess32" = "*"
|
||||
tenacity = "*"
|
||||
tensorflow-gpu = ""
|
||||
PyJWT = "==1.4.1"
|
||||
PyMySQL = "==0.9.2"
|
||||
Werkzeug = "*"
|
||||
"backports.lzma" = "*"
|
||||
Flask-Cors = "*"
|
||||
Flask-SocketIO = "*"
|
||||
"GeoAlchemy2" = "*"
|
||||
Pygments = "*"
|
||||
PyNaCl = "*"
|
||||
"PySDL2" = "*"
|
||||
reverse_geocoder = "*"
|
||||
Shapely = "*"
|
||||
SQLAlchemy = "*"
|
||||
scipy = "*"
|
||||
fastcluster = "*"
|
||||
backports-abc = "*"
|
||||
pygame = "*"
|
||||
simplejson = "*"
|
||||
python-logstash-async = "*"
|
||||
seaborn = "*"
|
||||
pyproj = "*"
|
||||
mock = "*"
|
||||
matplotlib = "*"
|
||||
dictdiffer = "*"
|
||||
aenum = "*"
|
||||
coverage = "*"
|
||||
azure-cli-core = "*"
|
||||
|
||||
[packages]
|
||||
overpy = {git = "https://github.com/commaai/python-overpy.git",ref = "f86529af402d4642e1faeb146671c40284007323"}
|
||||
atomicwrites = "*"
|
||||
cffi = "*"
|
||||
crcmod = "*"
|
||||
hexdump = "*"
|
||||
libusb1 = "*"
|
||||
numpy = "*"
|
||||
psutil = "*"
|
||||
pycapnp = "*"
|
||||
cryptography = "*"
|
||||
pyserial = "*"
|
||||
python-dateutil = "*"
|
||||
pyzmq = "*"
|
||||
raven = "*"
|
||||
requests = "*"
|
||||
setproctitle = "*"
|
||||
six = "*"
|
||||
smbus2 = "*"
|
||||
sympy = "*"
|
||||
tqdm = "*"
|
||||
Cython = "*"
|
||||
PyYAML = "*"
|
||||
websocket_client = "*"
|
||||
Logentries = {git = "https://github.com/commaai/le_python.git",ref = "feaeacb48f7f4bdb02c0a8fc092326d4e101b7f2"}
|
||||
urllib3 = "*"
|
||||
chardet = "*"
|
||||
idna = "*"
|
||||
gunicorn = "*"
|
||||
utm = "*"
|
||||
json-rpc = "*"
|
||||
Flask = "*"
|
||||
PyJWT = "*"
|
||||
"Jinja2" = "*"
|
||||
nose = "*"
|
||||
flake8 = "*"
|
||||
pylint = "*"
|
||||
pycryptodome = "*"
|
||||
pillow = "*"
|
||||
scons = "*"
|
||||
cysignals = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7.3"
|
||||
Generated
-2895
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
[](#)
|
||||
[](#)
|
||||
|
||||
Table of Contents
|
||||
=======================
|
||||
@@ -68,12 +68,12 @@ Supported Cars
|
||||
| Acura | RDX 2016-18 | AcuraWatch Plus | openpilot | 25mph<sup>5</sup> | 12mph |
|
||||
| Chrysler | Pacifica 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph |
|
||||
| Chrysler | Pacifica Hybrid 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph |
|
||||
| Chrysler | Pacifica Hybrid 2019 | Adaptive Cruise | Stock | 0mph | 39mph |
|
||||
| Chrysler | Pacifica Hybrid 2019-20 | Adaptive Cruise | Stock | 0mph | 39mph |
|
||||
| Honda | Accord 2018-19 | All | Stock | 0mph | 3mph |
|
||||
| Honda | Accord Hybrid 2018-19 | All | Stock | 0mph | 3mph |
|
||||
| Honda | Civic Hatchback 2017-19 | Honda Sensing | Stock | 0mph | 12mph |
|
||||
| Honda | Civic Sedan/Coupe 2016-18 | Honda Sensing | openpilot | 0mph | 12mph |
|
||||
| Honda | Civic Sedan/Coupe 2019 | Honda Sensing | Stock | 0mph | 2mph |
|
||||
| Honda | Civic Hatchback 2017-19 | Honda Sensing | Stock | 0mph | 12mph |
|
||||
| Honda | CR-V 2015-16 | Touring | openpilot | 25mph<sup>5</sup> | 12mph |
|
||||
| Honda | CR-V 2017-19 | Honda Sensing | Stock | 0mph | 12mph |
|
||||
| Honda | CR-V Hybrid 2017-2019 | Honda Sensing | Stock | 0mph | 12mph |
|
||||
@@ -83,19 +83,22 @@ Supported Cars
|
||||
| Honda | Pilot 2016-18 | Honda Sensing | openpilot | 25mph<sup>5</sup> | 12mph |
|
||||
| Honda | Pilot 2019 | All | openpilot | 25mph<sup>5</sup> | 12mph |
|
||||
| Honda | Ridgeline 2017-19 | Honda Sensing | openpilot | 25mph<sup>5</sup> | 12mph |
|
||||
| Hyundai | Santa Fe 2019<sup>1</sup> | All | Stock | 0mph | 0mph |
|
||||
| Hyundai | Elantra 2017-19<sup>1</sup> | SCC + LKAS | Stock | 19mph | 34mph |
|
||||
| Hyundai | Genesis 2018<sup>1</sup> | All | Stock | 19mph | 34mph |
|
||||
| Hyundai | Santa Fe 2019<sup>1</sup> | All | Stock | 0mph | 0mph |
|
||||
| Jeep | Grand Cherokee 2016-18 | Adaptive Cruise | Stock | 0mph | 9mph |
|
||||
| Jeep | Grand Cherokee 2019 | Adaptive Cruise | Stock | 0mph | 39mph |
|
||||
| Kia | Optima 2019<sup>1</sup> | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Sorento 2018<sup>1</sup> | All | Stock | 0mph | 0mph |
|
||||
| Kia | Stinger 2018<sup>1</sup> | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Lexus | CT Hybrid 2017-18 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Lexus | ES 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | ES Hybrid 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | RX Hybrid 2016-19 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Lexus | IS 2017-2019 | All | Stock | 22mph | 0mph |
|
||||
| Lexus | IS Hybrid 2017 | All | Stock | 0mph | 0mph |
|
||||
| Lexus | RX 2016-17 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Lexus | RX 2020 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | RX Hybrid 2016-19 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Subaru | Crosstrek 2018-19 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Subaru | Impreza 2019-20 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Toyota | Avalon 2016 | TSS-P | Stock<sup>4</sup>| 20mph<sup>5</sup> | 0mph |
|
||||
@@ -106,7 +109,7 @@ Supported Cars
|
||||
| Toyota | C-HR Hybrid 2017-19 | All | Stock | 0mph | 0mph |
|
||||
| Toyota | Corolla 2017-19 | All | Stock<sup>4</sup>| 20mph<sup>5</sup> | 0mph |
|
||||
| Toyota | Corolla 2020 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Corolla Hatchback 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Corolla Hatchback 2019-20 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Corolla Hybrid 2020 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Highlander 2017-19 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Toyota | Highlander Hybrid 2017-19 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
@@ -118,6 +121,7 @@ Supported Cars
|
||||
| Toyota | Rav4 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Rav4 Hybrid 2016 | TSS-P | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Toyota | Rav4 Hybrid 2017-18 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Toyota | Rav4 Hybrid 2019-20 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Sienna 2018 | All | Stock<sup>4</sup>| 0mph | 0mph |
|
||||
| Volkswagen| Golf 2016-19<sup>3</sup> | Driver Assistance | Stock | 0mph | 0mph |
|
||||
|
||||
@@ -131,9 +135,9 @@ Community Maintained Cars and Features
|
||||
| Make | Model (US Market Reference) | Supported Package | ACC | No ACC accel below | No ALC below |
|
||||
| ----------| ------------------------------| ------------------| -----------------| -------------------| -------------|
|
||||
| Buick | Regal 2018<sup>6</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Cadillac | ATS 2018<sup>6</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Chevrolet | Malibu 2017<sup>6</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Chevrolet | Volt 2017-18<sup>6</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Cadillac | ATS 2018<sup>6</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| GMC | Acadia Denali 2018<sup>6</sup>| Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Holden | Astra 2017<sup>6</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
|
||||
@@ -242,7 +246,7 @@ Safety and Testing
|
||||
Testing on PC
|
||||
------
|
||||
|
||||
Check out [openpilot-tools](https://github.com/commaai/openpilot-tools): lots of tools you can use to replay driving data, test and develop openpilot from your pc.
|
||||
Check out the tools directory in master: lots of tools you can use to replay driving data, test and develop openpilot from your pc.
|
||||
|
||||
Community and Contributing
|
||||
------
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
Version 0.7.2 (2020-02-07)
|
||||
========================
|
||||
* ECU firmware version based fingerprinting for Honda & Toyota
|
||||
* New driving model: improved path prediction during turns and lane changes and better lead speed tracking
|
||||
* Improve driver monitoring under extreme lighting and add low accuracy alert
|
||||
* Support for 2019 Rav4 Hybrid thanks to illumiN8i!
|
||||
* Support for 2016, 2017 and 2020 Lexus RX thanks to illumiN8i!
|
||||
* Support for 2020 Chrysler Pacifica Hybrid thanks to adhintz!
|
||||
|
||||
Version 0.7.1 (2020-01-20)
|
||||
========================
|
||||
* comma two support!
|
||||
|
||||
+34
-16
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import platform
|
||||
|
||||
AddOption('--test',
|
||||
action='store_true',
|
||||
@@ -11,6 +12,8 @@ AddOption('--asan',
|
||||
help='turn on ASAN')
|
||||
|
||||
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
||||
if platform.system() == "Darwin":
|
||||
arch = "Darwin"
|
||||
|
||||
if arch == "aarch64":
|
||||
lenv = {
|
||||
@@ -48,20 +51,33 @@ else:
|
||||
"#phonelibs/zmq/x64/include",
|
||||
"#external/tensorflow/include",
|
||||
]
|
||||
libpath = [
|
||||
"#phonelibs/capnp-cpp/x64/lib",
|
||||
"#phonelibs/capnp-c/x64/lib",
|
||||
"#phonelibs/yaml-cpp/x64/lib",
|
||||
"#phonelibs/snpe/x86_64-linux-clang",
|
||||
"#phonelibs/zmq/x64/lib",
|
||||
"#phonelibs/libyuv/x64/lib",
|
||||
"#external/zmq/lib",
|
||||
"#external/tensorflow/lib",
|
||||
"#cereal",
|
||||
"#selfdrive/common",
|
||||
"/usr/lib",
|
||||
"/usr/local/lib",
|
||||
]
|
||||
|
||||
if arch == "Darwin":
|
||||
libpath = [
|
||||
"#phonelibs/capnp-cpp/mac/lib",
|
||||
"#phonelibs/capnp-c/mac/lib",
|
||||
"#phonelibs/yaml-cpp/mac/lib",
|
||||
"#phonelibs/libyuv/mac/lib",
|
||||
"#cereal",
|
||||
"#selfdrive/common",
|
||||
"/usr/local/lib",
|
||||
"/System/Library/Frameworks/OpenGL.framework/Libraries",
|
||||
]
|
||||
else:
|
||||
libpath = [
|
||||
"#phonelibs/capnp-cpp/x64/lib",
|
||||
"#phonelibs/capnp-c/x64/lib",
|
||||
"#phonelibs/yaml-cpp/x64/lib",
|
||||
"#phonelibs/snpe/x86_64-linux-clang",
|
||||
"#phonelibs/zmq/x64/lib",
|
||||
"#phonelibs/libyuv/x64/lib",
|
||||
"#external/zmq/lib",
|
||||
"#external/tensorflow/lib",
|
||||
"#cereal",
|
||||
"#selfdrive/common",
|
||||
"/usr/lib",
|
||||
"/usr/local/lib",
|
||||
]
|
||||
|
||||
rpath = ["phonelibs/capnp-cpp/x64/lib",
|
||||
"external/tensorflow/lib",
|
||||
@@ -195,8 +211,10 @@ SConscript(['common/SConscript'])
|
||||
SConscript(['common/kalman/SConscript'])
|
||||
SConscript(['phonelibs/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/modeld/SConscript'])
|
||||
SConscript(['selfdrive/camerad/SConscript'])
|
||||
if arch != "Darwin":
|
||||
SConscript(['selfdrive/camerad/SConscript'])
|
||||
SConscript(['selfdrive/modeld/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/controls/lib/cluster/SConscript'])
|
||||
SConscript(['selfdrive/controls/lib/lateral_mpc/SConscript'])
|
||||
SConscript(['selfdrive/controls/lib/longitudinal_mpc/SConscript'])
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+20
-7
@@ -90,14 +90,15 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
ldw @65;
|
||||
carUnrecognized @66;
|
||||
radarCommIssue @67;
|
||||
driverMonitorLowAcc @68;
|
||||
# dragonpilot
|
||||
manualSteeringRequired @68;
|
||||
manualSteeringRequiredBlinkersOn @69;
|
||||
leadCarMoving @70;
|
||||
leadCarDetected @71;
|
||||
preAutoLaneChangeLeft @72;
|
||||
preAutoLaneChangeRight @73;
|
||||
autoLaneChange @74;
|
||||
manualSteeringRequired @69;
|
||||
manualSteeringRequiredBlinkersOn @70;
|
||||
leadCarMoving @71;
|
||||
leadCarDetected @72;
|
||||
preAutoLaneChangeLeft @73;
|
||||
preAutoLaneChangeRight @74;
|
||||
autoLaneChange @75;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,6 +354,7 @@ struct CarParams {
|
||||
tireStiffnessRear @24 :Float32; # [N/rad] rear tire coeff of stiff
|
||||
|
||||
longitudinalTuning @25 :LongitudinalPIDTuning;
|
||||
lateralParams @48 :LateralParams;
|
||||
lateralTuning :union {
|
||||
pid @26 :LateralPIDTuning;
|
||||
indi @27 :LateralINDITuning;
|
||||
@@ -379,6 +381,12 @@ struct CarParams {
|
||||
carFw @44 :List(CarFw);
|
||||
radarTimeStep @45: Float32 = 0.05; # time delta between radar updates, 20Hz is very standard
|
||||
communityFeature @46: Bool; # true if a community maintained feature is detected
|
||||
fingerprintSource @49: FingerprintSource;
|
||||
|
||||
struct LateralParams {
|
||||
torqueBP @0 :List(Int32);
|
||||
torqueV @1 :List(Int32);
|
||||
}
|
||||
|
||||
struct LateralPIDTuning {
|
||||
kpBP @0 :List(Float32);
|
||||
@@ -473,4 +481,9 @@ struct CarParams {
|
||||
dsu @6;
|
||||
apgs @7;
|
||||
}
|
||||
|
||||
enum FingerprintSource {
|
||||
can @0;
|
||||
fw @1;
|
||||
}
|
||||
}
|
||||
|
||||
+32
-2
@@ -279,6 +279,7 @@ struct ThermalData {
|
||||
batteryCurrent @15 :Int32;
|
||||
batteryVoltage @16 :Int32;
|
||||
usbOnline @12 :Bool;
|
||||
networkType @22 :NetworkType;
|
||||
|
||||
fanSpeed @10 :UInt16;
|
||||
started @11 :Bool;
|
||||
@@ -299,6 +300,15 @@ struct ThermalData {
|
||||
red @2; # no engage, will disengage
|
||||
danger @3; # immediate process shutdown
|
||||
}
|
||||
|
||||
enum NetworkType {
|
||||
none @0;
|
||||
wifi @1;
|
||||
cell2G @2;
|
||||
cell3G @3;
|
||||
cell4G @4;
|
||||
cell5G @5;
|
||||
}
|
||||
}
|
||||
|
||||
struct HealthData {
|
||||
@@ -1758,7 +1768,7 @@ struct OrbKeyFrame {
|
||||
descriptors @3 :Data;
|
||||
}
|
||||
|
||||
struct DriverMonitoring {
|
||||
struct DriverState {
|
||||
frameId @0 :UInt32;
|
||||
descriptorDEPRECATED @1 :List(Float32);
|
||||
stdDEPRECATED @2 :Float32;
|
||||
@@ -1774,6 +1784,25 @@ struct DriverMonitoring {
|
||||
facePositionStd @12 :List(Float32);
|
||||
}
|
||||
|
||||
struct DMonitoringState {
|
||||
# TODO: deprecate old fields in controlsState
|
||||
events @0 :List(Car.CarEvent);
|
||||
faceDetected @1 :Bool;
|
||||
isDistracted @2 :Bool;
|
||||
awarenessStatus @3 :Float32;
|
||||
isRHD @4 :Bool;
|
||||
rhdChecked @5 :Bool;
|
||||
posePitchOffset @6 :Float32;
|
||||
posePitchValidCount @7 :UInt32;
|
||||
poseYawOffset @8 :Float32;
|
||||
poseYawValidCount @9 :UInt32;
|
||||
stepChange @10 :Float32;
|
||||
awarenessActive @11 :Float32;
|
||||
awarenessPassive @12 :Float32;
|
||||
isLowStd @13 :Bool;
|
||||
hiStdCount @14 :UInt32;
|
||||
}
|
||||
|
||||
struct Boot {
|
||||
wallTimeNanos @0 :UInt64;
|
||||
lastKmsg @1 :Data;
|
||||
@@ -1893,7 +1922,7 @@ struct Event {
|
||||
orbKeyFrame @56 :OrbKeyFrame;
|
||||
uiLayoutState @57 :UiLayoutState;
|
||||
orbFeaturesSummary @58 :OrbFeaturesSummary;
|
||||
driverMonitoring @59 :DriverMonitoring;
|
||||
driverState @59 :DriverState;
|
||||
boot @60 :Boot;
|
||||
liveParameters @61 :LiveParametersData;
|
||||
liveMapData @62 :LiveMapData;
|
||||
@@ -1904,5 +1933,6 @@ struct Event {
|
||||
carEvents @68: List(Car.CarEvent);
|
||||
carParams @69: Car.CarParams;
|
||||
frontFrame @70: FrameData;
|
||||
dMonitoringState @71: DMonitoringState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,16 +65,17 @@ orbKeyFrame: [8059, true, 0.]
|
||||
uiLayoutState: [8060, true, 0.]
|
||||
frontEncodeIdx: [8061, true, 5.]
|
||||
orbFeaturesSummary: [8062, true, 0.]
|
||||
driverMonitoring: [8063, true, 5., 1]
|
||||
driverState: [8063, true, 5., 1]
|
||||
liveParameters: [8064, true, 10.]
|
||||
liveMapData: [8065, true, 0.]
|
||||
cameraOdometry: [8066, true, 20.]
|
||||
cameraOdometry: [8066, true, 20., 5]
|
||||
pathPlan: [8067, true, 20.]
|
||||
kalmanOdometry: [8068, true, 0.]
|
||||
thumbnail: [8069, true, 0.2, 1]
|
||||
carEvents: [8070, true, 1., 1]
|
||||
carParams: [8071, true, 0.02, 1]
|
||||
frontFrame: [8072, true, 10.]
|
||||
dMonitoringState: [8073, true, 5., 1]
|
||||
|
||||
testModel: [8040, false, 0.]
|
||||
testLiveLocation: [8045, false, 0.]
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Only pyflakes checks (--select=F)
|
||||
flake8 --select=F $(find . -iname "*.py" | grep -vi "^\./pyextra.*" | grep -vi "^\./panda")
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
pylint $(find . -iname "*.py" | grep -vi "^\./pyextra.*" | grep -vi "^\./panda")
|
||||
RESULT=$? & 3
|
||||
fi
|
||||
|
||||
[ $RESULT -ne 0 ] && exit 1
|
||||
exit 0
|
||||
@@ -5,6 +5,9 @@ import re
|
||||
import struct
|
||||
import subprocess
|
||||
import random
|
||||
from cereal import log
|
||||
|
||||
NetworkType = log.ThermalData.NetworkType
|
||||
|
||||
ANDROID = os.path.isfile('/EON')
|
||||
|
||||
@@ -89,3 +92,39 @@ def parse_service_call_bytes(ret):
|
||||
return r
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def get_network_type():
|
||||
if not ANDROID:
|
||||
return NetworkType.none
|
||||
|
||||
wifi_check = parse_service_call_string(service_call(["connectivity", "2"]))
|
||||
if wifi_check is None:
|
||||
return NetworkType.none
|
||||
elif 'WIFI' in wifi_check:
|
||||
return NetworkType.wifi
|
||||
else:
|
||||
cell_check = parse_service_call_unpack(service_call(['phone', '59']), ">q")
|
||||
# from TelephonyManager.java
|
||||
cell_networks = {
|
||||
0: NetworkType.none,
|
||||
1: NetworkType.cell2G,
|
||||
2: NetworkType.cell2G,
|
||||
3: NetworkType.cell3G,
|
||||
4: NetworkType.cell2G,
|
||||
5: NetworkType.cell3G,
|
||||
6: NetworkType.cell3G,
|
||||
7: NetworkType.cell3G,
|
||||
8: NetworkType.cell3G,
|
||||
9: NetworkType.cell3G,
|
||||
10: NetworkType.cell3G,
|
||||
11: NetworkType.cell2G,
|
||||
12: NetworkType.cell3G,
|
||||
13: NetworkType.cell4G,
|
||||
14: NetworkType.cell4G,
|
||||
15: NetworkType.cell3G,
|
||||
16: NetworkType.cell2G,
|
||||
17: NetworkType.cell3G,
|
||||
18: NetworkType.cell4G,
|
||||
19: NetworkType.cell4G
|
||||
}
|
||||
return cell_networks.get(cell_check, NetworkType.none)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import jwt
|
||||
import requests
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from common.basedir import PERSIST
|
||||
from selfdrive.version import version
|
||||
|
||||
class Api():
|
||||
def __init__(self, dongle_id):
|
||||
self.dongle_id = dongle_id
|
||||
with open('/persist/comma/id_rsa') as f:
|
||||
with open(PERSIST+'/comma/id_rsa') as f:
|
||||
self.private_key = f.read()
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import os
|
||||
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))
|
||||
|
||||
from common.android import ANDROID
|
||||
if ANDROID:
|
||||
PERSIST = "/persist"
|
||||
PARAMS = "/data/params"
|
||||
else:
|
||||
PERSIST = os.path.join(BASEDIR, "persist")
|
||||
PARAMS = os.path.join(BASEDIR, "persist", "params")
|
||||
|
||||
|
||||
+15
-9
@@ -1,16 +1,22 @@
|
||||
from posix.time cimport clock_gettime, timespec, CLOCK_BOOTTIME, CLOCK_MONOTONIC_RAW
|
||||
from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t
|
||||
|
||||
cdef double readclock(int clock_id):
|
||||
cdef timespec ts
|
||||
cdef double current
|
||||
IF UNAME_SYSNAME == "Darwin":
|
||||
# Darwin doesn't have a CLOCK_BOOTTIME
|
||||
CLOCK_BOOTTIME = CLOCK_MONOTONIC_RAW
|
||||
ELSE:
|
||||
from posix.time cimport CLOCK_BOOTTIME
|
||||
|
||||
clock_gettime(clock_id, &ts)
|
||||
current = ts.tv_sec + (ts.tv_nsec / 1000000000.)
|
||||
return current
|
||||
cdef double readclock(clockid_t clock_id):
|
||||
cdef timespec ts
|
||||
cdef double current
|
||||
|
||||
clock_gettime(clock_id, &ts)
|
||||
current = ts.tv_sec + (ts.tv_nsec / 1000000000.)
|
||||
return current
|
||||
|
||||
def monotonic_time():
|
||||
return readclock(CLOCK_MONOTONIC_RAW)
|
||||
return readclock(CLOCK_MONOTONIC_RAW)
|
||||
|
||||
def sec_since_boot():
|
||||
return readclock(CLOCK_BOOTTIME)
|
||||
return readclock(CLOCK_BOOTTIME)
|
||||
|
||||
|
||||
@@ -2,8 +2,14 @@ import os
|
||||
import sys
|
||||
import fcntl
|
||||
import hashlib
|
||||
import platform
|
||||
from cffi import FFI
|
||||
|
||||
def suffix():
|
||||
if platform.system() == "Darwin":
|
||||
return ".dylib"
|
||||
else:
|
||||
return ".so"
|
||||
|
||||
def ffi_wrap(name, c_code, c_header, tmpdir="/tmp/ccache", cflags="", libraries=None):
|
||||
if libraries is None:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import copy
|
||||
import json
|
||||
import socket
|
||||
import logging
|
||||
import traceback
|
||||
from threading import local
|
||||
from collections import OrderedDict
|
||||
from contextlib import contextmanager
|
||||
@@ -118,6 +120,42 @@ class SwagLogger(logging.Logger):
|
||||
else:
|
||||
self.info(evt)
|
||||
|
||||
def findCaller(self, stack_info=False, stacklevel=1):
|
||||
"""
|
||||
Find the stack frame of the caller so that we can note the source
|
||||
file name, line number and function name.
|
||||
"""
|
||||
f = sys._getframe(3)
|
||||
#On some versions of IronPython, currentframe() returns None if
|
||||
#IronPython isn't run with -X:Frames.
|
||||
if f is not None:
|
||||
f = f.f_back
|
||||
orig_f = f
|
||||
while f and stacklevel > 1:
|
||||
f = f.f_back
|
||||
stacklevel -= 1
|
||||
if not f:
|
||||
f = orig_f
|
||||
rv = "(unknown file)", 0, "(unknown function)", None
|
||||
while hasattr(f, "f_code"):
|
||||
co = f.f_code
|
||||
filename = os.path.normcase(co.co_filename)
|
||||
if filename == _srcfile:
|
||||
f = f.f_back
|
||||
continue
|
||||
sinfo = None
|
||||
if stack_info:
|
||||
sio = io.StringIO()
|
||||
sio.write('Stack (most recent call last):\n')
|
||||
traceback.print_stack(f, file=sio)
|
||||
sinfo = sio.getvalue()
|
||||
if sinfo[-1] == '\n':
|
||||
sinfo = sinfo[:-1]
|
||||
sio.close()
|
||||
rv = (co.co_filename, f.f_lineno, co.co_name, sinfo)
|
||||
break
|
||||
return rv
|
||||
|
||||
if __name__ == "__main__":
|
||||
log = SwagLogger()
|
||||
|
||||
|
||||
+8
-2
@@ -29,7 +29,7 @@ import fcntl
|
||||
import tempfile
|
||||
import threading
|
||||
from enum import Enum
|
||||
|
||||
from common.basedir import PARAMS
|
||||
|
||||
def mkdirs_exists_ok(path):
|
||||
try:
|
||||
@@ -54,6 +54,7 @@ keys = {
|
||||
"AthenadPid": [TxType.PERSISTENT],
|
||||
"CalibrationParams": [TxType.PERSISTENT],
|
||||
"CarParams": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"CarParamsCache": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"CarVin": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"CommunityFeaturesToggle": [TxType.PERSISTENT],
|
||||
"CompletedTrainingVersion": [TxType.PERSISTENT],
|
||||
@@ -383,7 +384,7 @@ def write_db(params_path, key, value):
|
||||
lock.release()
|
||||
|
||||
class Params():
|
||||
def __init__(self, db='/data/params'):
|
||||
def __init__(self, db=PARAMS):
|
||||
self.db = db
|
||||
|
||||
# create the database if it doesn't exist...
|
||||
@@ -391,6 +392,11 @@ class Params():
|
||||
with self.transaction(write=True):
|
||||
pass
|
||||
|
||||
def clear_all(self):
|
||||
shutil.rmtree(self.db, ignore_errors=True)
|
||||
with self.transaction(write=True):
|
||||
pass
|
||||
|
||||
def transaction(self, write=False):
|
||||
if write:
|
||||
return DBWriter(self.db)
|
||||
|
||||
@@ -131,37 +131,6 @@ def img_from_device(pt_device):
|
||||
return pt_img.reshape(input_shape)[:,:2]
|
||||
|
||||
|
||||
#TODO please use generic img transform below
|
||||
def rotate_img(img, eulers, crop=None, intrinsics=eon_intrinsics):
|
||||
import cv2 # pylint: disable=import-error
|
||||
|
||||
size = img.shape[:2]
|
||||
rot = orient.rot_from_euler(eulers)
|
||||
quadrangle = np.array([[0, 0],
|
||||
[size[1]-1, 0],
|
||||
[0, size[0]-1],
|
||||
[size[1]-1, size[0]-1]], dtype=np.float32)
|
||||
quadrangle_norm = np.hstack((normalize(quadrangle, intrinsics=intrinsics), np.ones((4,1))))
|
||||
warped_quadrangle_full = np.einsum('ij, kj->ki', intrinsics.dot(rot), quadrangle_norm)
|
||||
warped_quadrangle = np.column_stack((warped_quadrangle_full[:,0]/warped_quadrangle_full[:,2],
|
||||
warped_quadrangle_full[:,1]/warped_quadrangle_full[:,2])).astype(np.float32)
|
||||
if crop:
|
||||
W_border = (size[1] - crop[0])//2
|
||||
H_border = (size[0] - crop[1])//2
|
||||
outside_crop = (((warped_quadrangle[:,0] < W_border) |
|
||||
(warped_quadrangle[:,0] >= size[1] - W_border)) &
|
||||
((warped_quadrangle[:,1] < H_border) |
|
||||
(warped_quadrangle[:,1] >= size[0] - H_border)))
|
||||
if not outside_crop.all():
|
||||
raise ValueError("warped image not contained inside crop")
|
||||
else:
|
||||
H_border, W_border = 0, 0
|
||||
M = cv2.getPerspectiveTransform(quadrangle, warped_quadrangle)
|
||||
img_warped = cv2.warpPerspective(img, M, size[::-1])
|
||||
return img_warped[H_border: size[0] - H_border,
|
||||
W_border: size[1] - W_border]
|
||||
|
||||
|
||||
def get_camera_frame_from_calib_frame(camera_frame_from_road_frame):
|
||||
camera_frame_from_ground = camera_frame_from_road_frame[:, (0, 1, 3)]
|
||||
calib_frame_from_ground = np.dot(eon_intrinsics,
|
||||
|
||||
@@ -155,8 +155,6 @@ struct Updater {
|
||||
TouchState touch;
|
||||
|
||||
int fb_w, fb_h;
|
||||
EGLDisplay display;
|
||||
EGLSurface surface;
|
||||
|
||||
FramebufferState *fb = NULL;
|
||||
NVGcontext *vg = NULL;
|
||||
@@ -198,7 +196,7 @@ struct Updater {
|
||||
touch_init(&touch);
|
||||
|
||||
fb = framebuffer_init("updater", 0x00001000, false,
|
||||
&display, &surface, &fb_w, &fb_h);
|
||||
&fb_w, &fb_h);
|
||||
assert(fb);
|
||||
|
||||
vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG);
|
||||
@@ -708,7 +706,7 @@ struct Updater {
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
eglSwapBuffers(display, surface);
|
||||
framebuffer_swap(fb);
|
||||
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -16,6 +16,9 @@ Wondering what's the DBC file format? [Here](http://www.socialledge.com/sjsu/ind
|
||||
|
||||
Use [panda](https://github.com/commaai/panda) to connect your car to a computer.
|
||||
|
||||
### How to use reverse engineered DBC
|
||||
To create custom CAN simulations or send reverse engineered signals back to the car you can use [CANdevStudio](https://github.com/GENIVI/CANdevStudio) project.
|
||||
|
||||
### DBC file preprocessor
|
||||
|
||||
DBC files for different models of the same brand have a lot of overlap. Therefore, we wrote a preprocessor to create DBC files from a brand DBC file and a model specific DBC file. The source DBC files can be found in the generator folder. After changing one of the files run the generator.py script to regenerate the output files. These output files will be placed in the root of the opendbc repository and are suffixed by _generated.
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
CM_ "IMPORT _honda_2017.dbc"
|
||||
CM_ "IMPORT _comma.dbc"
|
||||
|
||||
BO_ 342 STEERING_SENSORS: 6 EPS
|
||||
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
|
||||
SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON
|
||||
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 399 STEER_STATUS: 6 EPS
|
||||
SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON
|
||||
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON
|
||||
SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON
|
||||
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 419 GEARBOX: 8 PCM
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON
|
||||
SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON
|
||||
|
||||
BO_ 404 STEERING_CONTROL: 4 EON
|
||||
SG_ STEER_TORQUE : 7|12@0- (1,0) [-768|768] "" EPS
|
||||
SG_ SET_ME_X00 : 11|4@0+ (1,0) [0|15] "" EPS
|
||||
SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS
|
||||
SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS
|
||||
SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS
|
||||
|
||||
BO_ 422 SCM_BUTTONS: 8 SCM
|
||||
SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON
|
||||
SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 487 BRAKE_PRESSURE: 4 VSA
|
||||
SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON
|
||||
SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON
|
||||
SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EON
|
||||
SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 660 SCM_FEEDBACK: 8 SCM
|
||||
SG_ RIGHT_BLINKER : 6|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 891 WIPERS: 8 XXX
|
||||
SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
|
||||
VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ;
|
||||
VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ;
|
||||
VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;
|
||||
VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
|
||||
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
|
||||
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
|
||||
|
||||
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";
|
||||
@@ -0,0 +1,176 @@
|
||||
VERSION ""
|
||||
|
||||
|
||||
NS_ :
|
||||
NS_DESC_
|
||||
CM_
|
||||
BA_DEF_
|
||||
BA_
|
||||
VAL_
|
||||
CAT_DEF_
|
||||
CAT_
|
||||
FILTER
|
||||
BA_DEF_DEF_
|
||||
EV_DATA_
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
SIG_GROUP_
|
||||
SIG_VALTYPE_
|
||||
SIGTYPE_VALTYPE_
|
||||
BO_TX_BU_
|
||||
BA_DEF_REL_
|
||||
BA_REL_
|
||||
BA_DEF_DEF_REL_
|
||||
BU_SG_REL_
|
||||
BU_EV_REL_
|
||||
BU_BO_REL_
|
||||
SG_MUL_VAL_
|
||||
|
||||
BS_:
|
||||
BU_: K16_BECM K114B_HPCM T18_BatteryCharger
|
||||
|
||||
BO_ 512 Battery_Module_1: 8 K16_BECM
|
||||
SG_ Voltage_1_0_A m0 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_0_B m0 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_0_C m0 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_1_A m1 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_1_B m1 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_1_C m1 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_2_A m2 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_2_B m2 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_2_C m2 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_3_A m3 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_3_B m3 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_3_C m3 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_4_A m4 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_4_B m4 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_4_C m4 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_5_A m5 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_5_B m5 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_5_C m5 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_6_A m6 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_6_B m6 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_6_C m6 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_7_A m7 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_7_B m7 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_1_7_C m7 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Cell_Bank_Number_1 M : 53|7@1+ (1,0) [0|0] "" K16_BECM
|
||||
|
||||
BO_ 514 Battery_Module_2: 8 K16_BECM
|
||||
SG_ Voltage_2_0_A m0 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_0_B m0 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_0_C m0 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_1_A m1 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_1_B m1 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_1_C m1 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_2_A m2 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_2_B m2 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_2_C m2 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_3_A m3 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_3_B m3 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_3_C m3 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_4_A m4 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_4_B m4 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_4_C m4 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_5_A m5 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_5_B m5 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_5_C m5 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_6_A m6 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_6_B m6 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_6_C m6 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_7_A m7 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_7_B m7 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_2_7_C m7 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Cell_Bank_Number_2 M : 53|7@1+ (1,0) [0|0] "" K16_BECM
|
||||
|
||||
BO_ 516 Battery_Module_3: 8 K16_BECM
|
||||
SG_ Voltage_3_0_A m0 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_0_B m0 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_0_C m0 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_1_A m1 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_1_B m1 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_1_C m1 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_2_A m2 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_2_B m2 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_2_C m2 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_3_A m3 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_3_B m3 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_3_C m3 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_4_A m4 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_4_B m4 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_4_C m4 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_5_A m5 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_5_B m5 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_5_C m5 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_6_A m6 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_6_B m6 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_6_C m6 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_7_A m7 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_7_B m7 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_3_7_C m7 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Cell_Bank_Number_3 M : 53|7@1+ (1,0) [0|0] "" K16_BECM
|
||||
|
||||
BO_ 518 Battery_Module_4: 8 K16_BECM
|
||||
SG_ Voltage_4_0_A m0 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_0_B m0 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_0_C m0 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_1_A m1 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_1_B m1 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_1_C m1 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_2_A m2 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_2_B m2 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_2_C m2 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_3_A m3 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_3_B m3 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_3_C m3 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_4_A m4 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_4_B m4 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_4_C m4 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_5_A m5 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_5_B m5 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_5_C m5 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_6_A m6 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_6_B m6 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_6_C m6 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_7_A m7 : 4|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_7_B m7 : 20|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Voltage_4_7_C m7 : 36|12@1+ (0.00125,0) [0|0] "V" K16_BECM
|
||||
SG_ Cell_Bank_Number_4 M : 53|7@1+ (1,0) [0|0] "" K16_BECM
|
||||
|
||||
BO_ 528 Pack_Stats: 8 K16_BECM
|
||||
SG_ Pack_Voltage : 7|12@0+ (0.125,0) [0|0] "V" K16_BECM
|
||||
SG_ Pack_Amps : 9|10@0+ (0.1,0) [0|0] "" K16_BECM
|
||||
SG_ Pack_Amps2 : 28|12@0+ (0.05,0) [0|0] "" K16_BECM
|
||||
|
||||
BO_ 530 Charger_stats: 6 T18_BatteryCharger
|
||||
SG_ Charger_HV_Current : 0|13@1+ (0.05,0) [0|0] "A" K16_BECM
|
||||
SG_ HV_Voltage : 13|10@1+ (0.5,0) [0|0] "V" K16_BECM
|
||||
SG_ LV_Current : 23|8@1+ (0.2,0) [0|0] "A" K16_BECM
|
||||
SG_ LV_Voltage : 31|10@1- (0.025,0) [0|0] "V" K16_BECM
|
||||
|
||||
BO_ 770 Battery_temp: 8 K16_BECM
|
||||
SG_ Temp_A m0 : 8|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_B m0 : 16|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_C m0 : 24|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_D m0 : 32|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_E m0 : 40|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_F m0 : 48|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_G m1 : 8|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_H m1 : 16|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Temp_I m1 : 24|8@1+ (0.5,-40) [0|0] "C" K16_BECM
|
||||
SG_ Switch M : 2|1@1+ (1,0) [0|0] "" K16_BECM
|
||||
|
||||
BA_DEF_ BO_ "GenMsgBackgroundColor" STRING ;
|
||||
BA_DEF_ BO_ "GenMsgForegroundColor" STRING ;
|
||||
BA_DEF_ BO_ "isj1939dbc" INT 0 0;
|
||||
BA_DEF_DEF_ "GenMsgBackgroundColor" "#ffffff";
|
||||
BA_DEF_DEF_ "GenMsgForegroundColor" "#000000";
|
||||
BA_DEF_DEF_ "isj1939dbc" 0;
|
||||
CM_ BU_ K16_BECM "Battery Energy Control Module";
|
||||
CM_ BU_ K114B_HPCM "Hybrid Powertrain Control Module";
|
||||
CM_ BU_ T18_BatteryCharger "Battery Charger";
|
||||
@@ -0,0 +1,319 @@
|
||||
CM_ "AUTOGENERATED FILE, DO NOT EDIT"
|
||||
|
||||
|
||||
CM_ "Imported file _comma.dbc starts here"
|
||||
BO_ 512 GAS_COMMAND: 6 EON
|
||||
SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR
|
||||
SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR
|
||||
SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR
|
||||
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR
|
||||
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR
|
||||
|
||||
BO_ 513 GAS_SENSOR: 6 INTERCEPTOR
|
||||
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON
|
||||
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON
|
||||
SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON
|
||||
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON
|
||||
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON
|
||||
|
||||
VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;
|
||||
|
||||
|
||||
CM_ "Imported file _honda_2017.dbc starts here"
|
||||
VERSION ""
|
||||
|
||||
|
||||
NS_ :
|
||||
NS_DESC_
|
||||
CM_
|
||||
BA_DEF_
|
||||
BA_
|
||||
VAL_
|
||||
CAT_DEF_
|
||||
CAT_
|
||||
FILTER
|
||||
BA_DEF_DEF_
|
||||
EV_DATA_
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
SIG_GROUP_
|
||||
SIG_VALTYPE_
|
||||
SIGTYPE_VALTYPE_
|
||||
BO_TX_BU_
|
||||
BA_DEF_REL_
|
||||
BA_REL_
|
||||
BA_DEF_DEF_REL_
|
||||
BU_SG_REL_
|
||||
BU_EV_REL_
|
||||
BU_BO_REL_
|
||||
SG_MUL_VAL_
|
||||
|
||||
BU_: EBCM ADAS PCM EPS VSA SCM BDY XXX EPB EON
|
||||
|
||||
BO_ 344 ENGINE_DATA: 8 PCM
|
||||
SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON
|
||||
SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 380 POWERTRAIN_DATA: 8 PCM
|
||||
SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON
|
||||
SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "rpm" EON
|
||||
SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "rpm" EON
|
||||
SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "rpm" EON
|
||||
SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "rpm" EON
|
||||
SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 420 VSA_STATUS: 8 VSA
|
||||
SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON
|
||||
SG_ COMPUTER_BRAKING : 23|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
|
||||
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
|
||||
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 432 STANDSTILL: 7 VSA
|
||||
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 464 WHEEL_SPEEDS: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 490 VEHICLE_DYNAMICS: 8 VSA
|
||||
SG_ LONG_ACCEL : 23|16@0- (0.0015384,0) [-20|20] "m/s2" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 506 BRAKE_COMMAND: 8 ADAS
|
||||
SG_ COMPUTER_BRAKE : 7|10@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ SET_ME_X00 : 13|5@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ BRAKE_PUMP_REQUEST : 8|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ SET_ME_X00_2 : 23|3@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ SET_ME_X00_3 : 19|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ COMPUTER_BRAKE_REQUEST : 16|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ SET_ME_1 : 31|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ AEB_REQ_1 : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ AEB_REQ_2 : 26|3@0+ (1,0) [0|7] "" XXX
|
||||
SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_STATES : 38|7@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM
|
||||
SG_ SET_ME_X00_4 : 44|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ FCW : 43|2@0+ (1,0) [0|3] "" EBCM
|
||||
SG_ AEB_STATUS : 41|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ SET_ME_X00_5 : 55|8@0+ (1,0) [0|0] "" EBCM
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EBCM
|
||||
|
||||
BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON
|
||||
SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON
|
||||
SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON
|
||||
SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON
|
||||
SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 773 SEATBELT_STATUS: 7 BDY
|
||||
SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 777 LOCK_STATUS: 8 XXX
|
||||
SG_ DOORS_UNLOCKED : 54|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ DOORS_LOCKED : 55|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 780 ACC_HUD: 8 ADAS
|
||||
SG_ PCM_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" BDY
|
||||
SG_ PCM_GAS : 23|8@0+ (1,0) [0|127] "" BDY
|
||||
SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY
|
||||
SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ FCM_OFF_2 : 35|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ SET_ME_X01_2 : 55|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ IMPERIAL_UNIT : 54|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ CHIME : 51|3@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SET_ME_X01 : 48|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ICONS : 63|2@0+ (1,0) [0|1] "" BDY
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY
|
||||
|
||||
BO_ 804 CRUISE: 8 PCM
|
||||
SG_ HUD_SPEED_KPH : 7|8@0+ (1,0) [0|255] "kph" EON
|
||||
SG_ HUD_SPEED_MPH : 15|8@0+ (1,0) [0|255] "mph" EON
|
||||
SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON
|
||||
SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ BOH2 : 47|8@0- (1,0) [0|255] "" EON
|
||||
SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 829 LKAS_HUD: 5 ADAS
|
||||
SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY
|
||||
SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY
|
||||
SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY
|
||||
SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
|
||||
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY
|
||||
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY
|
||||
|
||||
BO_ 892 CRUISE_PARAMS: 8 PCM
|
||||
SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 1029 DOORS_STATUS: 8 BDY
|
||||
SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ TRUNK_OPEN : 41|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping";
|
||||
CM_ SG_ 506 AEB_REQ_1 "set for duration of suspected AEB event";
|
||||
CM_ SG_ 773 PASS_AIRBAG_ON "Might just be indicator light";
|
||||
CM_ SG_ 773 PASS_AIRBAG_OFF "Might just be indicator light";
|
||||
CM_ SG_ 780 CRUISE_SPEED "255 = no speed";
|
||||
CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed";
|
||||
CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc...";
|
||||
|
||||
|
||||
VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw" ;
|
||||
VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime" ;
|
||||
VAL_ 506 AEB_STATUS 3 "aeb_prepare" 2 "aeb_ready" 1 "aeb_braking" 0 "no_aeb" ;
|
||||
VAL_ 780 CRUISE_SPEED 255 "no_speed" 252 "stopped" ;
|
||||
VAL_ 780 HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car" ;
|
||||
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
|
||||
|
||||
CM_ "honda_crv_executive_2016_can.dbc starts here"
|
||||
|
||||
|
||||
|
||||
BO_ 342 STEERING_SENSORS: 6 EPS
|
||||
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
|
||||
SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON
|
||||
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 399 STEER_STATUS: 6 EPS
|
||||
SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON
|
||||
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON
|
||||
SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON
|
||||
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 419 GEARBOX: 8 PCM
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON
|
||||
SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON
|
||||
|
||||
BO_ 404 STEERING_CONTROL: 4 EON
|
||||
SG_ STEER_TORQUE : 7|12@0- (1,0) [-768|768] "" EPS
|
||||
SG_ SET_ME_X00 : 11|4@0+ (1,0) [0|15] "" EPS
|
||||
SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS
|
||||
SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS
|
||||
SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS
|
||||
|
||||
BO_ 422 SCM_BUTTONS: 8 SCM
|
||||
SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON
|
||||
SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 487 BRAKE_PRESSURE: 4 VSA
|
||||
SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON
|
||||
SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON
|
||||
SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EON
|
||||
SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EON
|
||||
|
||||
BO_ 660 SCM_FEEDBACK: 8 SCM
|
||||
SG_ RIGHT_BLINKER : 6|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 891 WIPERS: 8 XXX
|
||||
SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
|
||||
VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ;
|
||||
VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ;
|
||||
VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;
|
||||
VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
|
||||
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
|
||||
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
|
||||
|
||||
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";
|
||||
@@ -792,7 +792,7 @@ BO_ 1362 SNV11: 4 SNV
|
||||
SG_ CF_Snv_IRLampControl : 10|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU,HUD
|
||||
|
||||
BO_ 593 MDPS12: 8 MDPS
|
||||
SG_ CR_Mdps_StrColTq : 0|11@1+ (0.0078125,-8.0) [-8.0|7.9921875] "Nm" LDWS_LKAS
|
||||
SG_ CR_Mdps_StrColTq : 0|11@1+ (1.0,-1024.0) [-1024.0|1024.0] "" LDWS_LKAS
|
||||
SG_ CF_Mdps_Def : 11|1@1+ (1.0,0.0) [0.0|1.0] "" ESC
|
||||
SG_ CF_Mdps_ToiUnavail : 12|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS
|
||||
SG_ CF_Mdps_ToiActive : 13|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS
|
||||
@@ -1444,3 +1444,5 @@ BO_ 905 SCC14: 8 SCC
|
||||
SG_ JerkLowerLimit : 19|7@1+ (0.1,0) [0|12.7] "m/s^3" ESC
|
||||
SG_ SCCMode : 32|3@1+ (1,0) [0|7] "" ESC
|
||||
|
||||
BO_ 882 ELECT_GEAR: 8 XXX
|
||||
SG_ Elect_Gear_Shifter : 16|3@1+ (1,0) [0|7] "" CLU
|
||||
|
||||
@@ -110,6 +110,8 @@ BO_ 281 Steering_Torque: 8 XXX
|
||||
SG_ Steer_Torque_Sensor : 16|11@1- (-1,0) [0|3] "" XXX
|
||||
SG_ Steering_Angle : 32|16@1- (-0.0217,0) [0|255] "" X
|
||||
SG_ Steer_Torque_Output : 48|11@1- (-1,0) [0|31] "" XXX
|
||||
SG_ Steer_Error_1 : 12|1@0+ (1,0) [0|7] "" XXX
|
||||
SG_ Steer_Error_2 : 28|1@1+ (1,0) [0|3] "" XXX
|
||||
|
||||
BO_ 312 Brake_Pressure_L_R: 8 XXX
|
||||
SG_ Checksum : 0|8@1+ (1,0) [0|31] "" XXX
|
||||
|
||||
@@ -122,7 +122,12 @@ int get_bit_message(char *out, CAN_FIFOMailBox_TypeDef *to_bang) {
|
||||
return len;
|
||||
}
|
||||
|
||||
void TIM4_IRQ_Handler(void);
|
||||
|
||||
void setup_timer4(void) {
|
||||
// register interrupt
|
||||
REGISTER_INTERRUPT(TIM4_IRQn, TIM4_IRQ_Handler, 40000U, FAULT_INTERRUPT_RATE_GMLAN)
|
||||
|
||||
// setup
|
||||
register_set(&(TIM4->PSC), (48-1), 0xFFFFU); // Tick on 1 us
|
||||
register_set(&(TIM4->CR1), TIM_CR1_CEN, 0x3FU); // Enable
|
||||
@@ -236,7 +241,6 @@ void TIM4_IRQ_Handler(void) {
|
||||
gmlan_sendmax = -1; // exit
|
||||
}
|
||||
}
|
||||
TIM4->SR = 0;
|
||||
} else if (gmlan_alt_mode == GPIO_SWITCH) {
|
||||
if ((TIM4->SR & TIM_SR_UIF) && (gmlan_switch_below_timeout != -1)) {
|
||||
if ((can_timeout_counter == 0) && gmlan_switch_timeout_enable) {
|
||||
@@ -259,10 +263,10 @@ void TIM4_IRQ_Handler(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
TIM4->SR = 0;
|
||||
} else {
|
||||
puts("invalid gmlan_alt_mode\n");
|
||||
// Invalid GMLAN mode. Do not put a print statement here, way too fast to keep up with
|
||||
}
|
||||
TIM4->SR = 0;
|
||||
}
|
||||
|
||||
bool bitbang_gmlan(CAN_FIFOMailBox_TypeDef *to_bang) {
|
||||
@@ -280,7 +284,6 @@ bool bitbang_gmlan(CAN_FIFOMailBox_TypeDef *to_bang) {
|
||||
set_gpio_mode(GPIOB, 13, MODE_OUTPUT);
|
||||
|
||||
// 33kbps
|
||||
REGISTER_INTERRUPT(TIM4_IRQn, TIM4_IRQ_Handler, 40000U, FAULT_INTERRUPT_RATE_GMLAN)
|
||||
setup_timer4();
|
||||
}
|
||||
return gmlan_send_ok;
|
||||
|
||||
+6
-10
@@ -294,19 +294,11 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
|
||||
break;
|
||||
// **** 0xb0: set IR power
|
||||
case 0xb0:
|
||||
if(power_save_status == POWER_SAVE_STATUS_DISABLED){
|
||||
current_board->set_ir_power(setup->b.wValue.w);
|
||||
} else {
|
||||
puts("Setting IR power not allowed in power saving mode\n");
|
||||
}
|
||||
current_board->set_ir_power(setup->b.wValue.w);
|
||||
break;
|
||||
// **** 0xb1: set fan power
|
||||
case 0xb1:
|
||||
if(power_save_status == POWER_SAVE_STATUS_DISABLED){
|
||||
current_board->set_fan_power(setup->b.wValue.w);
|
||||
} else {
|
||||
puts("Setting fan power not allowed in power saving mode\n");
|
||||
}
|
||||
current_board->set_fan_power(setup->b.wValue.w);
|
||||
break;
|
||||
// **** 0xb2: get fan rpm
|
||||
case 0xb2:
|
||||
@@ -716,6 +708,10 @@ void TIM1_BRK_TIM9_IRQ_Handler(void) {
|
||||
if (power_save_status != POWER_SAVE_STATUS_ENABLED) {
|
||||
set_power_save_state(POWER_SAVE_STATUS_ENABLED);
|
||||
}
|
||||
|
||||
// Also disable fan and IR when the heartbeat goes missing
|
||||
current_board->set_fan_power(0U);
|
||||
current_board->set_ir_power(0U);
|
||||
}
|
||||
|
||||
// enter CDP mode when car starts to ensure we are charging a turned off EON
|
||||
|
||||
@@ -49,10 +49,9 @@ void set_power_save_state(int state) {
|
||||
set_gpio_output(GPIOA, 14, enable);
|
||||
}
|
||||
|
||||
// Switch off IR and fan when in power saving
|
||||
// Switch off IR when in power saving
|
||||
if(!enable){
|
||||
current_board->set_ir_power(0U);
|
||||
current_board->set_fan_power(0U);
|
||||
}
|
||||
|
||||
power_save_status = state;
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
3. The end-user documentation included with the
|
||||
redistribution, if any, must include the following
|
||||
acknowledgment:
|
||||
|
||||
"This product includes software developed by the
|
||||
University of Chicago, as Operator of Argonne National
|
||||
Laboratory.
|
||||
|
||||
Alternately, this acknowledgment may appear in the software
|
||||
itself, if and wherever such third-party acknowledgments
|
||||
normally appear.
|
||||
|
||||
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
|
||||
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
|
||||
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
|
||||
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
|
||||
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
|
||||
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
|
||||
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
|
||||
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
|
||||
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
|
||||
BE CORRECTED.
|
||||
|
||||
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
|
||||
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
|
||||
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
|
||||
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
|
||||
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
|
||||
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
|
||||
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
|
||||
POSSIBILITY OF SUCH LOSS OR DAMAGES.
|
||||
|
||||
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
3. The end-user documentation included with the
|
||||
redistribution, if any, must include the following
|
||||
acknowledgment:
|
||||
|
||||
"This product includes software developed by the
|
||||
University of Chicago, as Operator of Argonne National
|
||||
Laboratory.
|
||||
|
||||
Alternately, this acknowledgment may appear in the software
|
||||
itself, if and wherever such third-party acknowledgments
|
||||
normally appear.
|
||||
|
||||
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
|
||||
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
|
||||
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
|
||||
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
|
||||
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
|
||||
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
|
||||
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
|
||||
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
|
||||
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
|
||||
BE CORRECTED.
|
||||
|
||||
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
|
||||
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
|
||||
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
|
||||
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
|
||||
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
|
||||
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
|
||||
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
|
||||
POSSIBILITY OF SUCH LOSS OR DAMAGES.
|
||||
|
||||
|
||||
+34089
-34089
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,247 +0,0 @@
|
||||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_STDINT_H_ // [
|
||||
#define _MSC_STDINT_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
||||
#ifndef _W64
|
||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
# define _W64 __w64
|
||||
# else
|
||||
# define _W64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
|
||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
||||
// realize that, e.g. char has the same size as __int8
|
||||
// so we give up on __intX for them.
|
||||
#if (_MSC_VER < 1300)
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
typedef signed __int8 int8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef signed __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef _W64 signed int intptr_t;
|
||||
typedef _W64 unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
|
||||
#endif // _MSC_STDINT_H_ ]
|
||||
Binary file not shown.
@@ -1,42 +0,0 @@
|
||||
set -e
|
||||
echo "Installing capnp"
|
||||
|
||||
cd /tmp
|
||||
VERSION=0.6.1
|
||||
wget https://capnproto.org/capnproto-c++-${VERSION}.tar.gz
|
||||
tar xvf capnproto-c++-${VERSION}.tar.gz
|
||||
cd capnproto-c++-${VERSION}
|
||||
CXXFLAGS="-fPIC" ./configure
|
||||
|
||||
make -j4
|
||||
make install
|
||||
|
||||
# manually build binaries statically
|
||||
g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread
|
||||
|
||||
g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread
|
||||
|
||||
g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread
|
||||
|
||||
cp .libs/capnp /usr/local/bin/
|
||||
rm /usr/local/bin/capnpc
|
||||
ln -s /usr/local/bin/capnp /usr/local/bin/capnpc
|
||||
cp .libs/capnpc-c++ /usr/local/bin/
|
||||
cp .libs/capnpc-capnp /usr/local/bin/
|
||||
cp .libs/*.a /usr/local/lib
|
||||
|
||||
cd /tmp
|
||||
echo "Installing c-capnp"
|
||||
git clone https://github.com/commaai/c-capnproto.git
|
||||
cd c-capnproto
|
||||
git submodule update --init --recursive
|
||||
autoreconf -f -i -s
|
||||
CXXFLAGS="-fPIC" ./configure
|
||||
make -j4
|
||||
make install
|
||||
|
||||
# manually build binaries statically
|
||||
gcc -fPIC -o .libs/capnpc-c compiler/capnpc-c.o compiler/schema.capnp.o compiler/str.o ./.libs/libcapnp_c.a
|
||||
|
||||
cp .libs/capnpc-c /usr/local/bin/
|
||||
cp .libs/*.a /usr/local/lib
|
||||
@@ -1,29 +0,0 @@
|
||||
Copyright 2011 The LibYuv Project Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,29 +0,0 @@
|
||||
Copyright 2011 The LibYuv Project Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,4 +0,0 @@
|
||||
git clone https://chromium.googlesource.com/libyuv/libyuv
|
||||
cd libyuv
|
||||
git reset --hard 4a14cb2e81235ecd656e799aecaaf139db8ce4a2
|
||||
cmake .
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
../include
|
||||
Binary file not shown.
@@ -1,189 +1,189 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Bounds.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the Bounds class designed to manage working sets of
|
||||
* bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_BOUNDS_HPP
|
||||
#define QPOASES_BOUNDS_HPP
|
||||
|
||||
|
||||
#include <SubjectTo.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class manages working sets of bounds by storing
|
||||
* index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class Bounds : public SubjectTo
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
Bounds( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
Bounds( const Bounds& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~Bounds( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
Bounds& operator=( const Bounds& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor takes the number of bounds.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int n /**< Number of bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds number of a new (i.e. not yet in the list) bound to
|
||||
* given index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue setupBound( int _number, /**< Number of new bound. */
|
||||
SubjectToStatus _status /**< Status of new bound. */
|
||||
);
|
||||
|
||||
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
|
||||
* to the index set of free bounds; the order depends on the SujectToType
|
||||
* of each index.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED */
|
||||
returnValue setupAllFree( );
|
||||
|
||||
|
||||
/** Moves index of a bound from index list of fixed to that of free bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue moveFixedToFree( int _number /**< Number of bound to be freed. */
|
||||
);
|
||||
|
||||
/** Moves index of a bound from index list of free to that of fixed bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue moveFreeToFixed( int _number, /**< Number of bound to be fixed. */
|
||||
SubjectToStatus _status /**< Status of bound to be fixed. */
|
||||
);
|
||||
|
||||
/** Swaps the indices of two free bounds within the index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SWAPINDEX_FAILED */
|
||||
returnValue swapFree( int number1, /**< Number of first constraint or bound. */
|
||||
int number2 /**< Number of second constraint or bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns number of variables.
|
||||
* \return Number of variables. */
|
||||
inline int getNV( ) const;
|
||||
|
||||
/** Returns number of implicitly fixed variables.
|
||||
* \return Number of implicitly fixed variables. */
|
||||
inline int getNFV( ) const;
|
||||
|
||||
/** Returns number of bounded (but possibly free) variables.
|
||||
* \return Number of bounded (but possibly free) variables. */
|
||||
inline int getNBV( ) const;
|
||||
|
||||
/** Returns number of unbounded variables.
|
||||
* \return Number of unbounded variables. */
|
||||
inline int getNUV( ) const;
|
||||
|
||||
|
||||
/** Sets number of implicitly fixed variables.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNFV( int n /**< Number of implicitly fixed variables. */
|
||||
);
|
||||
|
||||
/** Sets number of bounded (but possibly free) variables.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNBV( int n /**< Number of bounded (but possibly free) variables. */
|
||||
);
|
||||
|
||||
/** Sets number of unbounded variables.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNUV( int n /**< Number of unbounded variables */
|
||||
);
|
||||
|
||||
|
||||
/** Returns number of free variables.
|
||||
* \return Number of free variables. */
|
||||
inline int getNFR( );
|
||||
|
||||
/** Returns number of fixed variables.
|
||||
* \return Number of fixed variables. */
|
||||
inline int getNFX( );
|
||||
|
||||
|
||||
/** Returns a pointer to free variables index list.
|
||||
* \return Pointer to free variables index list. */
|
||||
inline Indexlist* getFree( );
|
||||
|
||||
/** Returns a pointer to fixed variables index list.
|
||||
* \return Pointer to fixed variables index list. */
|
||||
inline Indexlist* getFixed( );
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int nV; /**< Number of variables (nV = nFV + nBV + nUV). */
|
||||
int nFV; /**< Number of implicitly fixed variables. */
|
||||
int nBV; /**< Number of bounded (but possibly free) variables. */
|
||||
int nUV; /**< Number of unbounded variables. */
|
||||
|
||||
Indexlist free; /**< Index list of free variables. */
|
||||
Indexlist fixed; /**< Index list of fixed variables. */
|
||||
};
|
||||
|
||||
#include <Bounds.ipp>
|
||||
|
||||
#endif /* QPOASES_BOUNDS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Bounds.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the Bounds class designed to manage working sets of
|
||||
* bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_BOUNDS_HPP
|
||||
#define QPOASES_BOUNDS_HPP
|
||||
|
||||
|
||||
#include <SubjectTo.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class manages working sets of bounds by storing
|
||||
* index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class Bounds : public SubjectTo
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
Bounds( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
Bounds( const Bounds& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~Bounds( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
Bounds& operator=( const Bounds& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor takes the number of bounds.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int n /**< Number of bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds number of a new (i.e. not yet in the list) bound to
|
||||
* given index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue setupBound( int _number, /**< Number of new bound. */
|
||||
SubjectToStatus _status /**< Status of new bound. */
|
||||
);
|
||||
|
||||
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
|
||||
* to the index set of free bounds; the order depends on the SujectToType
|
||||
* of each index.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED */
|
||||
returnValue setupAllFree( );
|
||||
|
||||
|
||||
/** Moves index of a bound from index list of fixed to that of free bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue moveFixedToFree( int _number /**< Number of bound to be freed. */
|
||||
);
|
||||
|
||||
/** Moves index of a bound from index list of free to that of fixed bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue moveFreeToFixed( int _number, /**< Number of bound to be fixed. */
|
||||
SubjectToStatus _status /**< Status of bound to be fixed. */
|
||||
);
|
||||
|
||||
/** Swaps the indices of two free bounds within the index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SWAPINDEX_FAILED */
|
||||
returnValue swapFree( int number1, /**< Number of first constraint or bound. */
|
||||
int number2 /**< Number of second constraint or bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns number of variables.
|
||||
* \return Number of variables. */
|
||||
inline int getNV( ) const;
|
||||
|
||||
/** Returns number of implicitly fixed variables.
|
||||
* \return Number of implicitly fixed variables. */
|
||||
inline int getNFV( ) const;
|
||||
|
||||
/** Returns number of bounded (but possibly free) variables.
|
||||
* \return Number of bounded (but possibly free) variables. */
|
||||
inline int getNBV( ) const;
|
||||
|
||||
/** Returns number of unbounded variables.
|
||||
* \return Number of unbounded variables. */
|
||||
inline int getNUV( ) const;
|
||||
|
||||
|
||||
/** Sets number of implicitly fixed variables.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNFV( int n /**< Number of implicitly fixed variables. */
|
||||
);
|
||||
|
||||
/** Sets number of bounded (but possibly free) variables.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNBV( int n /**< Number of bounded (but possibly free) variables. */
|
||||
);
|
||||
|
||||
/** Sets number of unbounded variables.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNUV( int n /**< Number of unbounded variables */
|
||||
);
|
||||
|
||||
|
||||
/** Returns number of free variables.
|
||||
* \return Number of free variables. */
|
||||
inline int getNFR( );
|
||||
|
||||
/** Returns number of fixed variables.
|
||||
* \return Number of fixed variables. */
|
||||
inline int getNFX( );
|
||||
|
||||
|
||||
/** Returns a pointer to free variables index list.
|
||||
* \return Pointer to free variables index list. */
|
||||
inline Indexlist* getFree( );
|
||||
|
||||
/** Returns a pointer to fixed variables index list.
|
||||
* \return Pointer to fixed variables index list. */
|
||||
inline Indexlist* getFixed( );
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int nV; /**< Number of variables (nV = nFV + nBV + nUV). */
|
||||
int nFV; /**< Number of implicitly fixed variables. */
|
||||
int nBV; /**< Number of bounded (but possibly free) variables. */
|
||||
int nUV; /**< Number of unbounded variables. */
|
||||
|
||||
Indexlist free; /**< Index list of free variables. */
|
||||
Indexlist fixed; /**< Index list of fixed variables. */
|
||||
};
|
||||
|
||||
#include <Bounds.ipp>
|
||||
|
||||
#endif /* QPOASES_BOUNDS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,108 +1,108 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Constants.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2008
|
||||
*
|
||||
* Definition of all global constants.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CONSTANTS_HPP
|
||||
#define QPOASES_CONSTANTS_HPP
|
||||
|
||||
#ifndef QPOASES_CUSTOM_INTERFACE
|
||||
#include "acado_qpoases_interface.hpp"
|
||||
#else
|
||||
#define XSTR(x) #x
|
||||
#define STR(x) XSTR(x)
|
||||
#include STR(QPOASES_CUSTOM_INTERFACE)
|
||||
#endif
|
||||
|
||||
/** Maximum number of variables within a QP formulation.
|
||||
Note: this value has to be positive! */
|
||||
const int NVMAX = QPOASES_NVMAX;
|
||||
|
||||
/** Maximum number of constraints within a QP formulation.
|
||||
Note: this value has to be positive! */
|
||||
const int NCMAX = QPOASES_NCMAX;
|
||||
|
||||
/** Redefinition of NCMAX used for memory allocation, to avoid zero sized arrays
|
||||
and compiler errors. */
|
||||
const int NCMAX_ALLOC = (NCMAX == 0) ? 1 : NCMAX;
|
||||
|
||||
/**< Maximum number of working set recalculations.
|
||||
Note: this value has to be positive! */
|
||||
const int NWSRMAX = QPOASES_NWSRMAX;
|
||||
|
||||
/** Desired KKT tolerance of QP solution; a warning RET_INACCURATE_SOLUTION is
|
||||
* issued if this tolerance is not met.
|
||||
* Note: this value has to be positive! */
|
||||
const real_t DESIREDACCURACY = (real_t) 1.0e-3;
|
||||
|
||||
/** Critical KKT tolerance of QP solution; an error is issued if this
|
||||
* tolerance is not met.
|
||||
* Note: this value has to be positive! */
|
||||
const real_t CRITICALACCURACY = (real_t) 1.0e-2;
|
||||
|
||||
|
||||
|
||||
/** Numerical value of machine precision (min eps, s.t. 1+eps > 1).
|
||||
Note: this value has to be positive! */
|
||||
const real_t EPS = (real_t) QPOASES_EPS;
|
||||
|
||||
/** Numerical value of zero (for situations in which it would be
|
||||
* unreasonable to compare with 0.0).
|
||||
* Note: this value has to be positive! */
|
||||
const real_t ZERO = (real_t) 1.0e-50;
|
||||
|
||||
/** Numerical value of infinity (e.g. for non-existing bounds).
|
||||
* Note: this value has to be positive! */
|
||||
const real_t INFTY = (real_t) 1.0e12;
|
||||
|
||||
|
||||
/** Lower/upper (constraints') bound tolerance (an inequality constraint
|
||||
* whose lower and upper bound differ by less than BOUNDTOL is regarded
|
||||
* to be an equality constraint).
|
||||
* Note: this value has to be positive! */
|
||||
const real_t BOUNDTOL = (real_t) 1.0e-10;
|
||||
|
||||
/** Offset for relaxing (constraints') bounds at beginning of an initial homotopy.
|
||||
* Note: this value has to be positive! */
|
||||
const real_t BOUNDRELAXATION = (real_t) 1.0e3;
|
||||
|
||||
|
||||
/** Factor that determines physical lengths of index lists.
|
||||
* Note: this value has to be greater than 1! */
|
||||
const int INDEXLISTFACTOR = 5;
|
||||
|
||||
|
||||
#endif /* QPOASES_CONSTANTS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Constants.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2008
|
||||
*
|
||||
* Definition of all global constants.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CONSTANTS_HPP
|
||||
#define QPOASES_CONSTANTS_HPP
|
||||
|
||||
#ifndef QPOASES_CUSTOM_INTERFACE
|
||||
#include "acado_qpoases_interface.hpp"
|
||||
#else
|
||||
#define XSTR(x) #x
|
||||
#define STR(x) XSTR(x)
|
||||
#include STR(QPOASES_CUSTOM_INTERFACE)
|
||||
#endif
|
||||
|
||||
/** Maximum number of variables within a QP formulation.
|
||||
Note: this value has to be positive! */
|
||||
const int NVMAX = QPOASES_NVMAX;
|
||||
|
||||
/** Maximum number of constraints within a QP formulation.
|
||||
Note: this value has to be positive! */
|
||||
const int NCMAX = QPOASES_NCMAX;
|
||||
|
||||
/** Redefinition of NCMAX used for memory allocation, to avoid zero sized arrays
|
||||
and compiler errors. */
|
||||
const int NCMAX_ALLOC = (NCMAX == 0) ? 1 : NCMAX;
|
||||
|
||||
/**< Maximum number of working set recalculations.
|
||||
Note: this value has to be positive! */
|
||||
const int NWSRMAX = QPOASES_NWSRMAX;
|
||||
|
||||
/** Desired KKT tolerance of QP solution; a warning RET_INACCURATE_SOLUTION is
|
||||
* issued if this tolerance is not met.
|
||||
* Note: this value has to be positive! */
|
||||
const real_t DESIREDACCURACY = (real_t) 1.0e-3;
|
||||
|
||||
/** Critical KKT tolerance of QP solution; an error is issued if this
|
||||
* tolerance is not met.
|
||||
* Note: this value has to be positive! */
|
||||
const real_t CRITICALACCURACY = (real_t) 1.0e-2;
|
||||
|
||||
|
||||
|
||||
/** Numerical value of machine precision (min eps, s.t. 1+eps > 1).
|
||||
Note: this value has to be positive! */
|
||||
const real_t EPS = (real_t) QPOASES_EPS;
|
||||
|
||||
/** Numerical value of zero (for situations in which it would be
|
||||
* unreasonable to compare with 0.0).
|
||||
* Note: this value has to be positive! */
|
||||
const real_t ZERO = (real_t) 1.0e-50;
|
||||
|
||||
/** Numerical value of infinity (e.g. for non-existing bounds).
|
||||
* Note: this value has to be positive! */
|
||||
const real_t INFTY = (real_t) 1.0e12;
|
||||
|
||||
|
||||
/** Lower/upper (constraints') bound tolerance (an inequality constraint
|
||||
* whose lower and upper bound differ by less than BOUNDTOL is regarded
|
||||
* to be an equality constraint).
|
||||
* Note: this value has to be positive! */
|
||||
const real_t BOUNDTOL = (real_t) 1.0e-10;
|
||||
|
||||
/** Offset for relaxing (constraints') bounds at beginning of an initial homotopy.
|
||||
* Note: this value has to be positive! */
|
||||
const real_t BOUNDRELAXATION = (real_t) 1.0e3;
|
||||
|
||||
|
||||
/** Factor that determines physical lengths of index lists.
|
||||
* Note: this value has to be greater than 1! */
|
||||
const int INDEXLISTFACTOR = 5;
|
||||
|
||||
|
||||
#endif /* QPOASES_CONSTANTS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,181 +1,181 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Constraints.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the Constraints class designed to manage working sets of
|
||||
* constraints within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CONSTRAINTS_HPP
|
||||
#define QPOASES_CONSTRAINTS_HPP
|
||||
|
||||
|
||||
#include <SubjectTo.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class manages working sets of constraints by storing
|
||||
* index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class Constraints : public SubjectTo
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
Constraints( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
Constraints( const Constraints& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~Constraints( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
Constraints& operator=( const Constraints& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor takes the number of constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int n /**< Number of constraints. */
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds number of a new (i.e. not yet in the list) constraint to
|
||||
* a given index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue setupConstraint( int _number, /**< Number of new constraint. */
|
||||
SubjectToStatus _status /**< Status of new constraint. */
|
||||
);
|
||||
|
||||
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
|
||||
* to the index set of inactive constraints; the order depends on the SujectToType
|
||||
* of each index. Only disabled constraints are added to index set of disabled constraints!
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED */
|
||||
returnValue setupAllInactive( );
|
||||
|
||||
|
||||
/** Moves index of a constraint from index list of active to that of inactive constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_CONSTRAINT_FAILED */
|
||||
returnValue moveActiveToInactive( int _number /**< Number of constraint to become inactive. */
|
||||
);
|
||||
|
||||
/** Moves index of a constraint from index list of inactive to that of active constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_CONSTRAINT_FAILED */
|
||||
returnValue moveInactiveToActive( int _number, /**< Number of constraint to become active. */
|
||||
SubjectToStatus _status /**< Status of constraint to become active. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns the number of constraints.
|
||||
* \return Number of constraints. */
|
||||
inline int getNC( ) const;
|
||||
|
||||
/** Returns the number of implicit equality constraints.
|
||||
* \return Number of implicit equality constraints. */
|
||||
inline int getNEC( ) const;
|
||||
|
||||
/** Returns the number of "real" inequality constraints.
|
||||
* \return Number of "real" inequality constraints. */
|
||||
inline int getNIC( ) const;
|
||||
|
||||
/** Returns the number of unbounded constraints (i.e. without any bounds).
|
||||
* \return Number of unbounded constraints (i.e. without any bounds). */
|
||||
inline int getNUC( ) const;
|
||||
|
||||
|
||||
/** Sets number of implicit equality constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNEC( int n /**< Number of implicit equality constraints. */
|
||||
);
|
||||
|
||||
/** Sets number of "real" inequality constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNIC( int n /**< Number of "real" inequality constraints. */
|
||||
);
|
||||
|
||||
/** Sets number of unbounded constraints (i.e. without any bounds).
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNUC( int n /**< Number of unbounded constraints (i.e. without any bounds). */
|
||||
);
|
||||
|
||||
|
||||
/** Returns the number of active constraints.
|
||||
* \return Number of constraints. */
|
||||
inline int getNAC( );
|
||||
|
||||
/** Returns the number of inactive constraints.
|
||||
* \return Number of constraints. */
|
||||
inline int getNIAC( );
|
||||
|
||||
|
||||
/** Returns a pointer to active constraints index list.
|
||||
* \return Pointer to active constraints index list. */
|
||||
inline Indexlist* getActive( );
|
||||
|
||||
/** Returns a pointer to inactive constraints index list.
|
||||
* \return Pointer to inactive constraints index list. */
|
||||
inline Indexlist* getInactive( );
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int nC; /**< Number of constraints (nC = nEC + nIC + nUC). */
|
||||
int nEC; /**< Number of implicit equality constraints. */
|
||||
int nIC; /**< Number of "real" inequality constraints. */
|
||||
int nUC; /**< Number of unbounded constraints (i.e. without any bounds). */
|
||||
|
||||
Indexlist active; /**< Index list of active constraints. */
|
||||
Indexlist inactive; /**< Index list of inactive constraints. */
|
||||
};
|
||||
|
||||
|
||||
#include <Constraints.ipp>
|
||||
|
||||
#endif /* QPOASES_CONSTRAINTS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Constraints.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the Constraints class designed to manage working sets of
|
||||
* constraints within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CONSTRAINTS_HPP
|
||||
#define QPOASES_CONSTRAINTS_HPP
|
||||
|
||||
|
||||
#include <SubjectTo.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class manages working sets of constraints by storing
|
||||
* index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class Constraints : public SubjectTo
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
Constraints( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
Constraints( const Constraints& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~Constraints( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
Constraints& operator=( const Constraints& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor takes the number of constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int n /**< Number of constraints. */
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds number of a new (i.e. not yet in the list) constraint to
|
||||
* a given index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue setupConstraint( int _number, /**< Number of new constraint. */
|
||||
SubjectToStatus _status /**< Status of new constraint. */
|
||||
);
|
||||
|
||||
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
|
||||
* to the index set of inactive constraints; the order depends on the SujectToType
|
||||
* of each index. Only disabled constraints are added to index set of disabled constraints!
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED */
|
||||
returnValue setupAllInactive( );
|
||||
|
||||
|
||||
/** Moves index of a constraint from index list of active to that of inactive constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_CONSTRAINT_FAILED */
|
||||
returnValue moveActiveToInactive( int _number /**< Number of constraint to become inactive. */
|
||||
);
|
||||
|
||||
/** Moves index of a constraint from index list of inactive to that of active constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_CONSTRAINT_FAILED */
|
||||
returnValue moveInactiveToActive( int _number, /**< Number of constraint to become active. */
|
||||
SubjectToStatus _status /**< Status of constraint to become active. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns the number of constraints.
|
||||
* \return Number of constraints. */
|
||||
inline int getNC( ) const;
|
||||
|
||||
/** Returns the number of implicit equality constraints.
|
||||
* \return Number of implicit equality constraints. */
|
||||
inline int getNEC( ) const;
|
||||
|
||||
/** Returns the number of "real" inequality constraints.
|
||||
* \return Number of "real" inequality constraints. */
|
||||
inline int getNIC( ) const;
|
||||
|
||||
/** Returns the number of unbounded constraints (i.e. without any bounds).
|
||||
* \return Number of unbounded constraints (i.e. without any bounds). */
|
||||
inline int getNUC( ) const;
|
||||
|
||||
|
||||
/** Sets number of implicit equality constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNEC( int n /**< Number of implicit equality constraints. */
|
||||
);
|
||||
|
||||
/** Sets number of "real" inequality constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNIC( int n /**< Number of "real" inequality constraints. */
|
||||
);
|
||||
|
||||
/** Sets number of unbounded constraints (i.e. without any bounds).
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
inline returnValue setNUC( int n /**< Number of unbounded constraints (i.e. without any bounds). */
|
||||
);
|
||||
|
||||
|
||||
/** Returns the number of active constraints.
|
||||
* \return Number of constraints. */
|
||||
inline int getNAC( );
|
||||
|
||||
/** Returns the number of inactive constraints.
|
||||
* \return Number of constraints. */
|
||||
inline int getNIAC( );
|
||||
|
||||
|
||||
/** Returns a pointer to active constraints index list.
|
||||
* \return Pointer to active constraints index list. */
|
||||
inline Indexlist* getActive( );
|
||||
|
||||
/** Returns a pointer to inactive constraints index list.
|
||||
* \return Pointer to inactive constraints index list. */
|
||||
inline Indexlist* getInactive( );
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int nC; /**< Number of constraints (nC = nEC + nIC + nUC). */
|
||||
int nEC; /**< Number of implicit equality constraints. */
|
||||
int nIC; /**< Number of "real" inequality constraints. */
|
||||
int nUC; /**< Number of unbounded constraints (i.e. without any bounds). */
|
||||
|
||||
Indexlist active; /**< Index list of active constraints. */
|
||||
Indexlist inactive; /**< Index list of inactive constraints. */
|
||||
};
|
||||
|
||||
|
||||
#include <Constraints.ipp>
|
||||
|
||||
#endif /* QPOASES_CONSTRAINTS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,126 +1,126 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/CyclingManager.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the CyclingManager class designed to detect
|
||||
* and handle possible cycling during QP iterations.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CYCLINGMANAGER_HPP
|
||||
#define QPOASES_CYCLINGMANAGER_HPP
|
||||
|
||||
|
||||
#include <Utils.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class is intended to detect and handle possible cycling during QP iterations.
|
||||
* As cycling seems to occur quite rarely, this class is NOT FULLY IMPLEMENTED YET!
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class CyclingManager
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
CyclingManager( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
CyclingManager( const CyclingManager& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~CyclingManager( );
|
||||
|
||||
/** Copy asingment operator (deep copy). */
|
||||
CyclingManager& operator=( const CyclingManager& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor which takes the number of bounds/constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int _nV, /**< Number of bounds to be managed. */
|
||||
int _nC /**< Number of constraints to be managed. */
|
||||
);
|
||||
|
||||
|
||||
/** Stores index of a bound/constraint that might cause cycling.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue setCyclingStatus( int number, /**< Number of bound/constraint. */
|
||||
BooleanType isBound, /**< Flag that indicates if given number corresponds to a
|
||||
* bound (BT_TRUE) or a constraint (BT_FALSE). */
|
||||
CyclingStatus _status /**< Cycling status of bound/constraint. */
|
||||
);
|
||||
|
||||
/** Returns if bound/constraint might cause cycling.
|
||||
* \return BT_TRUE: bound/constraint might cause cycling \n
|
||||
BT_FALSE: otherwise */
|
||||
CyclingStatus getCyclingStatus( int number, /**< Number of bound/constraint. */
|
||||
BooleanType isBound /**< Flag that indicates if given number corresponds to
|
||||
* a bound (BT_TRUE) or a constraint (BT_FALSE). */
|
||||
) const;
|
||||
|
||||
|
||||
/** Clears all previous cycling information.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue clearCyclingData( );
|
||||
|
||||
|
||||
/** Returns if cycling was detected.
|
||||
* \return BT_TRUE iff cycling was detected. */
|
||||
inline BooleanType isCyclingDetected( ) const;
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int nV; /**< Number of managed bounds. */
|
||||
int nC; /**< Number of managed constraints. */
|
||||
|
||||
CyclingStatus status[NVMAX+NCMAX]; /**< Array to store cycling status of all bounds/constraints. */
|
||||
|
||||
BooleanType cyclingDetected; /**< Flag if cycling was detected. */
|
||||
};
|
||||
|
||||
|
||||
#include <CyclingManager.ipp>
|
||||
|
||||
#endif /* QPOASES_CYCLINGMANAGER_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/CyclingManager.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the CyclingManager class designed to detect
|
||||
* and handle possible cycling during QP iterations.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CYCLINGMANAGER_HPP
|
||||
#define QPOASES_CYCLINGMANAGER_HPP
|
||||
|
||||
|
||||
#include <Utils.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class is intended to detect and handle possible cycling during QP iterations.
|
||||
* As cycling seems to occur quite rarely, this class is NOT FULLY IMPLEMENTED YET!
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class CyclingManager
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
CyclingManager( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
CyclingManager( const CyclingManager& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~CyclingManager( );
|
||||
|
||||
/** Copy asingment operator (deep copy). */
|
||||
CyclingManager& operator=( const CyclingManager& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor which takes the number of bounds/constraints.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int _nV, /**< Number of bounds to be managed. */
|
||||
int _nC /**< Number of constraints to be managed. */
|
||||
);
|
||||
|
||||
|
||||
/** Stores index of a bound/constraint that might cause cycling.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue setCyclingStatus( int number, /**< Number of bound/constraint. */
|
||||
BooleanType isBound, /**< Flag that indicates if given number corresponds to a
|
||||
* bound (BT_TRUE) or a constraint (BT_FALSE). */
|
||||
CyclingStatus _status /**< Cycling status of bound/constraint. */
|
||||
);
|
||||
|
||||
/** Returns if bound/constraint might cause cycling.
|
||||
* \return BT_TRUE: bound/constraint might cause cycling \n
|
||||
BT_FALSE: otherwise */
|
||||
CyclingStatus getCyclingStatus( int number, /**< Number of bound/constraint. */
|
||||
BooleanType isBound /**< Flag that indicates if given number corresponds to
|
||||
* a bound (BT_TRUE) or a constraint (BT_FALSE). */
|
||||
) const;
|
||||
|
||||
|
||||
/** Clears all previous cycling information.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue clearCyclingData( );
|
||||
|
||||
|
||||
/** Returns if cycling was detected.
|
||||
* \return BT_TRUE iff cycling was detected. */
|
||||
inline BooleanType isCyclingDetected( ) const;
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int nV; /**< Number of managed bounds. */
|
||||
int nC; /**< Number of managed constraints. */
|
||||
|
||||
CyclingStatus status[NVMAX+NCMAX]; /**< Array to store cycling status of all bounds/constraints. */
|
||||
|
||||
BooleanType cyclingDetected; /**< Flag if cycling was detected. */
|
||||
};
|
||||
|
||||
|
||||
#include <CyclingManager.ipp>
|
||||
|
||||
#endif /* QPOASES_CYCLINGMANAGER_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,154 +1,154 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Indexlist.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the Indexlist class designed to manage index lists of
|
||||
* constraints and bounds within a SubjectTo object.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_INDEXLIST_HPP
|
||||
#define QPOASES_INDEXLIST_HPP
|
||||
|
||||
|
||||
#include <Utils.hpp>
|
||||
|
||||
|
||||
/** This class manages index lists.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class Indexlist
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
Indexlist( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
Indexlist( const Indexlist& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~Indexlist( );
|
||||
|
||||
/** Assingment operator (deep copy). */
|
||||
Indexlist& operator=( const Indexlist& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Pseudo-constructor.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( );
|
||||
|
||||
|
||||
/** Creates an array of all numbers within the index set in correct order.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_CORRUPTED */
|
||||
returnValue getNumberArray( int* const numberarray /**< Output: Array of numbers (NULL on error). */
|
||||
) const;
|
||||
|
||||
|
||||
/** Determines the index within the index list at with a given number is stored.
|
||||
* \return >= 0: Index of given number. \n
|
||||
-1: Number not found. */
|
||||
int getIndex( int givennumber /**< Number whose index shall be determined. */
|
||||
) const;
|
||||
|
||||
/** Determines the physical index within the index list at with a given number is stored.
|
||||
* \return >= 0: Index of given number. \n
|
||||
-1: Number not found. */
|
||||
int getPhysicalIndex( int givennumber /**< Number whose physical index shall be determined. */
|
||||
) const;
|
||||
|
||||
/** Returns the number stored at a given physical index.
|
||||
* \return >= 0: Number stored at given physical index. \n
|
||||
-RET_INDEXLIST_OUTOFBOUNDS */
|
||||
int getNumber( int physicalindex /**< Physical index of the number to be returned. */
|
||||
) const;
|
||||
|
||||
|
||||
/** Returns the current length of the index list.
|
||||
* \return Current length of the index list. */
|
||||
inline int getLength( );
|
||||
|
||||
/** Returns last number within the index list.
|
||||
* \return Last number within the index list. */
|
||||
inline int getLastNumber( ) const;
|
||||
|
||||
|
||||
/** Adds number to index list.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_MUST_BE_REORDERD \n
|
||||
RET_INDEXLIST_EXCEEDS_MAX_LENGTH */
|
||||
returnValue addNumber( int addnumber /**< Number to be added. */
|
||||
);
|
||||
|
||||
/** Removes number from index list.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue removeNumber( int removenumber /**< Number to be removed. */
|
||||
);
|
||||
|
||||
/** Swaps two numbers within index list.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue swapNumbers( int number1,/**< First number for swapping. */
|
||||
int number2 /**< Second number for swapping. */
|
||||
);
|
||||
|
||||
/** Determines if a given number is contained in the index set.
|
||||
* \return BT_TRUE iff number is contain in the index set */
|
||||
inline BooleanType isMember( int _number /**< Number to be tested for membership. */
|
||||
) const;
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int number[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store numbers of constraints or bounds. */
|
||||
int next[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of successor. */
|
||||
int previous[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of predecossor. */
|
||||
int length; /**< Length of index list. */
|
||||
int first; /**< Physical index of first element. */
|
||||
int last; /**< Physical index of last element. */
|
||||
int lastusedindex; /**< Physical index of last entry in index list. */
|
||||
int physicallength; /**< Physical length of index list. */
|
||||
};
|
||||
|
||||
|
||||
#include <Indexlist.ipp>
|
||||
|
||||
#endif /* QPOASES_INDEXLIST_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Indexlist.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the Indexlist class designed to manage index lists of
|
||||
* constraints and bounds within a SubjectTo object.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_INDEXLIST_HPP
|
||||
#define QPOASES_INDEXLIST_HPP
|
||||
|
||||
|
||||
#include <Utils.hpp>
|
||||
|
||||
|
||||
/** This class manages index lists.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class Indexlist
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
Indexlist( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
Indexlist( const Indexlist& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~Indexlist( );
|
||||
|
||||
/** Assingment operator (deep copy). */
|
||||
Indexlist& operator=( const Indexlist& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Pseudo-constructor.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( );
|
||||
|
||||
|
||||
/** Creates an array of all numbers within the index set in correct order.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_CORRUPTED */
|
||||
returnValue getNumberArray( int* const numberarray /**< Output: Array of numbers (NULL on error). */
|
||||
) const;
|
||||
|
||||
|
||||
/** Determines the index within the index list at with a given number is stored.
|
||||
* \return >= 0: Index of given number. \n
|
||||
-1: Number not found. */
|
||||
int getIndex( int givennumber /**< Number whose index shall be determined. */
|
||||
) const;
|
||||
|
||||
/** Determines the physical index within the index list at with a given number is stored.
|
||||
* \return >= 0: Index of given number. \n
|
||||
-1: Number not found. */
|
||||
int getPhysicalIndex( int givennumber /**< Number whose physical index shall be determined. */
|
||||
) const;
|
||||
|
||||
/** Returns the number stored at a given physical index.
|
||||
* \return >= 0: Number stored at given physical index. \n
|
||||
-RET_INDEXLIST_OUTOFBOUNDS */
|
||||
int getNumber( int physicalindex /**< Physical index of the number to be returned. */
|
||||
) const;
|
||||
|
||||
|
||||
/** Returns the current length of the index list.
|
||||
* \return Current length of the index list. */
|
||||
inline int getLength( );
|
||||
|
||||
/** Returns last number within the index list.
|
||||
* \return Last number within the index list. */
|
||||
inline int getLastNumber( ) const;
|
||||
|
||||
|
||||
/** Adds number to index list.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_MUST_BE_REORDERD \n
|
||||
RET_INDEXLIST_EXCEEDS_MAX_LENGTH */
|
||||
returnValue addNumber( int addnumber /**< Number to be added. */
|
||||
);
|
||||
|
||||
/** Removes number from index list.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue removeNumber( int removenumber /**< Number to be removed. */
|
||||
);
|
||||
|
||||
/** Swaps two numbers within index list.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue swapNumbers( int number1,/**< First number for swapping. */
|
||||
int number2 /**< Second number for swapping. */
|
||||
);
|
||||
|
||||
/** Determines if a given number is contained in the index set.
|
||||
* \return BT_TRUE iff number is contain in the index set */
|
||||
inline BooleanType isMember( int _number /**< Number to be tested for membership. */
|
||||
) const;
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
int number[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store numbers of constraints or bounds. */
|
||||
int next[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of successor. */
|
||||
int previous[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of predecossor. */
|
||||
int length; /**< Length of index list. */
|
||||
int first; /**< Physical index of first element. */
|
||||
int last; /**< Physical index of last element. */
|
||||
int lastusedindex; /**< Physical index of last entry in index list. */
|
||||
int physicallength; /**< Physical length of index list. */
|
||||
};
|
||||
|
||||
|
||||
#include <Indexlist.ipp>
|
||||
|
||||
#endif /* QPOASES_INDEXLIST_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,415 +1,415 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/MessageHandling.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the MessageHandling class including global return values.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_MESSAGEHANDLING_HPP
|
||||
#define QPOASES_MESSAGEHANDLING_HPP
|
||||
|
||||
// #define PC_DEBUG
|
||||
|
||||
#ifdef PC_DEBUG
|
||||
#include <stdio.h>
|
||||
|
||||
/** Defines an alias for FILE from stdio.h. */
|
||||
#define myFILE FILE
|
||||
/** Defines an alias for stderr from stdio.h. */
|
||||
#define myStderr stderr
|
||||
/** Defines an alias for stdout from stdio.h. */
|
||||
#define myStdout stdout
|
||||
#else
|
||||
/** Defines an alias for FILE from stdio.h. */
|
||||
#define myFILE int
|
||||
/** Defines an alias for stderr from stdio.h. */
|
||||
#define myStderr 0
|
||||
/** Defines an alias for stdout from stdio.h. */
|
||||
#define myStdout 0
|
||||
#endif
|
||||
|
||||
|
||||
#include <Types.hpp>
|
||||
#include <Constants.hpp>
|
||||
|
||||
|
||||
/** Defines symbols for global return values. \n
|
||||
* Important: All return values are assumed to be nonnegative! */
|
||||
enum returnValue
|
||||
{
|
||||
TERMINAL_LIST_ELEMENT = -1, /**< Terminal list element, internal usage only! */
|
||||
/* miscellaneous */
|
||||
SUCCESSFUL_RETURN = 0, /**< Successful return. */
|
||||
RET_DIV_BY_ZERO, /**< Division by zero. */
|
||||
RET_INDEX_OUT_OF_BOUNDS, /**< Index out of bounds. */
|
||||
RET_INVALID_ARGUMENTS, /**< At least one of the arguments is invalid. */
|
||||
RET_ERROR_UNDEFINED, /**< Error number undefined. */
|
||||
RET_WARNING_UNDEFINED, /**< Warning number undefined. */
|
||||
RET_INFO_UNDEFINED, /**< Info number undefined. */
|
||||
RET_EWI_UNDEFINED, /**< Error/warning/info number undefined. */
|
||||
RET_AVAILABLE_WITH_LINUX_ONLY, /**< This function is available under Linux only. */
|
||||
RET_UNKNOWN_BUG, /**< The error occured is not yet known. */
|
||||
RET_PRINTLEVEL_CHANGED, /**< 10 Print level changed. */
|
||||
RET_NOT_YET_IMPLEMENTED, /**< Requested function is not yet implemented in this version of qpOASES. */
|
||||
/* Indexlist */
|
||||
RET_INDEXLIST_MUST_BE_REORDERD, /**< Index list has to be reordered. */
|
||||
RET_INDEXLIST_EXCEEDS_MAX_LENGTH, /**< Index list exceeds its maximal physical length. */
|
||||
RET_INDEXLIST_CORRUPTED, /**< Index list corrupted. */
|
||||
RET_INDEXLIST_OUTOFBOUNDS, /**< Physical index is out of bounds. */
|
||||
RET_INDEXLIST_ADD_FAILED, /**< Adding indices from another index set failed. */
|
||||
RET_INDEXLIST_INTERSECT_FAILED, /**< Intersection with another index set failed. */
|
||||
/* SubjectTo / Bounds / Constraints */
|
||||
RET_INDEX_ALREADY_OF_DESIRED_STATUS, /**< Index is already of desired status. */
|
||||
RET_ADDINDEX_FAILED, /**< Cannot swap between different indexsets. */
|
||||
RET_SWAPINDEX_FAILED, /**< 20 Adding index to index set failed. */
|
||||
RET_NOTHING_TO_DO, /**< Nothing to do. */
|
||||
RET_SETUP_BOUND_FAILED, /**< Setting up bound index failed. */
|
||||
RET_SETUP_CONSTRAINT_FAILED, /**< Setting up constraint index failed. */
|
||||
RET_MOVING_BOUND_FAILED, /**< Moving bound between index sets failed. */
|
||||
RET_MOVING_CONSTRAINT_FAILED, /**< Moving constraint between index sets failed. */
|
||||
/* QProblem */
|
||||
RET_QP_ALREADY_INITIALISED, /**< QProblem has already been initialised. */
|
||||
RET_NO_INIT_WITH_STANDARD_SOLVER, /**< Initialisation via extern QP solver is not yet implemented. */
|
||||
RET_RESET_FAILED, /**< Reset failed. */
|
||||
RET_INIT_FAILED, /**< Initialisation failed. */
|
||||
RET_INIT_FAILED_TQ, /**< 30 Initialisation failed due to TQ factorisation. */
|
||||
RET_INIT_FAILED_CHOLESKY, /**< Initialisation failed due to Cholesky decomposition. */
|
||||
RET_INIT_FAILED_HOTSTART, /**< Initialisation failed! QP could not be solved! */
|
||||
RET_INIT_FAILED_INFEASIBILITY, /**< Initial QP could not be solved due to infeasibility! */
|
||||
RET_INIT_FAILED_UNBOUNDEDNESS, /**< Initial QP could not be solved due to unboundedness! */
|
||||
RET_INIT_SUCCESSFUL, /**< Initialisation done. */
|
||||
RET_OBTAINING_WORKINGSET_FAILED, /**< Failed to obtain working set for auxiliary QP. */
|
||||
RET_SETUP_WORKINGSET_FAILED, /**< Failed to setup working set for auxiliary QP. */
|
||||
RET_SETUP_AUXILIARYQP_FAILED, /**< Failed to setup auxiliary QP for initialised homotopy. */
|
||||
RET_NO_EXTERN_SOLVER, /**< No extern QP solver available. */
|
||||
RET_QP_UNBOUNDED, /**< 40 QP is unbounded. */
|
||||
RET_QP_INFEASIBLE, /**< QP is infeasible. */
|
||||
RET_QP_NOT_SOLVED, /**< Problems occured while solving QP with standard solver. */
|
||||
RET_QP_SOLVED, /**< QP successfully solved. */
|
||||
RET_UNABLE_TO_SOLVE_QP, /**< Problems occured while solving QP. */
|
||||
RET_INITIALISATION_STARTED, /**< Starting problem initialisation. */
|
||||
RET_HOTSTART_FAILED, /**< Unable to perform homotopy due to internal error. */
|
||||
RET_HOTSTART_FAILED_TO_INIT, /**< Unable to initialise problem. */
|
||||
RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, /**< Unable to perform homotopy as previous QP is not solved. */
|
||||
RET_ITERATION_STARTED, /**< Iteration... */
|
||||
RET_SHIFT_DETERMINATION_FAILED, /**< 50 Determination of shift of the QP data failed. */
|
||||
RET_STEPDIRECTION_DETERMINATION_FAILED, /**< Determination of step direction failed. */
|
||||
RET_STEPLENGTH_DETERMINATION_FAILED, /**< Determination of step direction failed. */
|
||||
RET_OPTIMAL_SOLUTION_FOUND, /**< Optimal solution of neighbouring QP found. */
|
||||
RET_HOMOTOPY_STEP_FAILED, /**< Unable to perform homotopy step. */
|
||||
RET_HOTSTART_STOPPED_INFEASIBILITY, /**< Premature homotopy termination because QP is infeasible. */
|
||||
RET_HOTSTART_STOPPED_UNBOUNDEDNESS, /**< Premature homotopy termination because QP is unbounded. */
|
||||
RET_WORKINGSET_UPDATE_FAILED, /**< Unable to update working sets according to initial guesses. */
|
||||
RET_MAX_NWSR_REACHED, /**< Maximum number of working set recalculations performed. */
|
||||
RET_CONSTRAINTS_NOT_SPECIFIED, /**< Problem does comprise constraints! You also have to specify new constraints' bounds. */
|
||||
RET_INVALID_FACTORISATION_FLAG, /**< 60 Invalid factorisation flag. */
|
||||
RET_UNABLE_TO_SAVE_QPDATA, /**< Unable to save QP data. */
|
||||
RET_STEPDIRECTION_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */
|
||||
RET_STEPDIRECTION_FAILED_CHOLESKY, /**< Abnormal termination due to Cholesky factorisation. */
|
||||
RET_CYCLING_DETECTED, /**< Cycling detected. */
|
||||
RET_CYCLING_NOT_RESOLVED, /**< Cycling cannot be resolved, QP probably infeasible. */
|
||||
RET_CYCLING_RESOLVED, /**< Cycling probably resolved. */
|
||||
RET_STEPSIZE, /**< For displaying performed stepsize. */
|
||||
RET_STEPSIZE_NONPOSITIVE, /**< For displaying non-positive stepsize. */
|
||||
RET_SETUPSUBJECTTOTYPE_FAILED, /**< Setup of SubjectToTypes failed. */
|
||||
RET_ADDCONSTRAINT_FAILED, /**< 70 Addition of constraint to working set failed. */
|
||||
RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, /**< Addition of constraint to working set failed (due to QP infeasibility). */
|
||||
RET_ADDBOUND_FAILED, /**< Addition of bound to working set failed. */
|
||||
RET_ADDBOUND_FAILED_INFEASIBILITY, /**< Addition of bound to working set failed (due to QP infeasibility). */
|
||||
RET_REMOVECONSTRAINT_FAILED, /**< Removal of constraint from working set failed. */
|
||||
RET_REMOVEBOUND_FAILED, /**< Removal of bound from working set failed. */
|
||||
RET_REMOVE_FROM_ACTIVESET, /**< Removing from active set... */
|
||||
RET_ADD_TO_ACTIVESET, /**< Adding to active set... */
|
||||
RET_REMOVE_FROM_ACTIVESET_FAILED, /**< Removing from active set failed. */
|
||||
RET_ADD_TO_ACTIVESET_FAILED, /**< Adding to active set failed. */
|
||||
RET_CONSTRAINT_ALREADY_ACTIVE, /**< 80 Constraint is already active. */
|
||||
RET_ALL_CONSTRAINTS_ACTIVE, /**< All constraints are active, no further constraint can be added. */
|
||||
RET_LINEARLY_DEPENDENT, /**< New bound/constraint is linearly dependent. */
|
||||
RET_LINEARLY_INDEPENDENT, /**< New bound/constraint is linearly independent. */
|
||||
RET_LI_RESOLVED, /**< Linear independence of active contraint matrix successfully resolved. */
|
||||
RET_ENSURELI_FAILED, /**< Failed to ensure linear indepence of active contraint matrix. */
|
||||
RET_ENSURELI_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */
|
||||
RET_ENSURELI_FAILED_NOINDEX, /**< No index found, QP probably infeasible. */
|
||||
RET_ENSURELI_FAILED_CYCLING, /**< Cycling detected, QP probably infeasible. */
|
||||
RET_BOUND_ALREADY_ACTIVE, /**< Bound is already active. */
|
||||
RET_ALL_BOUNDS_ACTIVE, /**< 90 All bounds are active, no further bound can be added. */
|
||||
RET_CONSTRAINT_NOT_ACTIVE, /**< Constraint is not active. */
|
||||
RET_BOUND_NOT_ACTIVE, /**< Bound is not active. */
|
||||
RET_HESSIAN_NOT_SPD, /**< Projected Hessian matrix not positive definite. */
|
||||
RET_MATRIX_SHIFT_FAILED, /**< Unable to update matrices or to transform vectors. */
|
||||
RET_MATRIX_FACTORISATION_FAILED, /**< Unable to calculate new matrix factorisations. */
|
||||
RET_PRINT_ITERATION_FAILED, /**< Unable to print information on current iteration. */
|
||||
RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, /**< No global message output file initialised. */
|
||||
/* Utils */
|
||||
RET_UNABLE_TO_OPEN_FILE, /**< Unable to open file. */
|
||||
RET_UNABLE_TO_WRITE_FILE, /**< Unable to write into file. */
|
||||
RET_UNABLE_TO_READ_FILE, /**< 100 Unable to read from file. */
|
||||
RET_FILEDATA_INCONSISTENT, /**< File contains inconsistent data. */
|
||||
/* SolutionAnalysis */
|
||||
RET_NO_SOLUTION, /**< QP solution does not satisfy KKT optimality conditions. */
|
||||
RET_INACCURATE_SOLUTION /**< KKT optimality conditions not satisfied to sufficient accuracy. */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** This class handles all kinds of messages (errors, warnings, infos) initiated
|
||||
* by qpOASES modules and stores the correspoding global preferences.
|
||||
*
|
||||
* \author Hans Joachim Ferreau (special thanks to Leonard Wirsching)
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class MessageHandling
|
||||
{
|
||||
/*
|
||||
* INTERNAL DATA STRUCTURES
|
||||
*/
|
||||
public:
|
||||
/** Data structure for entries in global message list. */
|
||||
typedef struct {
|
||||
returnValue key; /**< Global return value. */
|
||||
const char* data; /**< Corresponding message. */
|
||||
VisibilityStatus globalVisibilityStatus; /**< Determines if message can be printed.
|
||||
* If this value is set to VS_HIDDEN, no message is printed! */
|
||||
} ReturnValueList;
|
||||
|
||||
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
MessageHandling( );
|
||||
|
||||
/** Constructor which takes the desired output file. */
|
||||
MessageHandling( myFILE* _outputFile /**< Output file. */
|
||||
);
|
||||
|
||||
/** Constructor which takes the desired visibility states. */
|
||||
MessageHandling( VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */
|
||||
VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */
|
||||
VisibilityStatus _infoVisibility /**< Visibility status for info messages. */
|
||||
);
|
||||
|
||||
/** Constructor which takes the desired output file and desired visibility states. */
|
||||
MessageHandling( myFILE* _outputFile, /**< Output file. */
|
||||
VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */
|
||||
VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */
|
||||
VisibilityStatus _infoVisibility /**< Visibility status for info messages. */
|
||||
);
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
MessageHandling( const MessageHandling& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~MessageHandling( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
MessageHandling& operator=( const MessageHandling& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints an error message(a simplified macro THROWERROR is also provided). \n
|
||||
* Errors are definied as abnormal events which cause an immediate termination of the current (sub) function.
|
||||
* Errors of a sub function should be commented by the calling function by means of a warning message
|
||||
* (if this error does not cause an error of the calling function, either)!
|
||||
* \return Error number returned by sub function call
|
||||
*/
|
||||
returnValue throwError(
|
||||
returnValue Enumber, /**< Error number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional error text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the error. */
|
||||
const char* filename, /**< Name of file which caused the error. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the error.incompatible binary file */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if error message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
/** Prints a warning message (a simplified macro THROWWARNING is also provided).
|
||||
* Warnings are definied as abnormal events which does NOT cause an immediate termination of the current (sub) function.
|
||||
* \return Warning number returned by sub function call
|
||||
*/
|
||||
returnValue throwWarning(
|
||||
returnValue Wnumber, /**< Warning number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the warning. */
|
||||
const char* filename, /**< Name of file which caused the warning. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the warning. */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if warning message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
/** Prints a info message (a simplified macro THROWINFO is also provided).
|
||||
* \return Info number returned by sub function call
|
||||
*/
|
||||
returnValue throwInfo(
|
||||
returnValue Inumber, /**< Info number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which submitted the info. */
|
||||
const char* filename, /**< Name of file which submitted the info. */
|
||||
const unsigned long linenumber, /**< Number of line which submitted the info. */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if info message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
|
||||
/** Resets all preferences to default values.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue reset( );
|
||||
|
||||
|
||||
/** Prints a complete list of all messages to output file.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue listAllMessages( );
|
||||
|
||||
|
||||
/** Returns visibility status for error messages.
|
||||
* \return Visibility status for error messages. */
|
||||
inline VisibilityStatus getErrorVisibilityStatus( ) const;
|
||||
|
||||
/** Returns visibility status for warning messages.
|
||||
* \return Visibility status for warning messages. */
|
||||
inline VisibilityStatus getWarningVisibilityStatus( ) const;
|
||||
|
||||
/** Returns visibility status for info messages.
|
||||
* \return Visibility status for info messages. */
|
||||
inline VisibilityStatus getInfoVisibilityStatus( ) const;
|
||||
|
||||
/** Returns pointer to output file.
|
||||
* \return Pointer to output file. */
|
||||
inline myFILE* getOutputFile( ) const;
|
||||
|
||||
/** Returns error count value.
|
||||
* \return Error count value. */
|
||||
inline int getErrorCount( ) const;
|
||||
|
||||
|
||||
/** Changes visibility status for error messages. */
|
||||
inline void setErrorVisibilityStatus( VisibilityStatus _errorVisibility /**< New visibility status for error messages. */
|
||||
);
|
||||
|
||||
/** Changes visibility status for warning messages. */
|
||||
inline void setWarningVisibilityStatus( VisibilityStatus _warningVisibility /**< New visibility status for warning messages. */
|
||||
);
|
||||
|
||||
/** Changes visibility status for info messages. */
|
||||
inline void setInfoVisibilityStatus( VisibilityStatus _infoVisibility /**< New visibility status for info messages. */
|
||||
);
|
||||
|
||||
/** Changes output file for messages. */
|
||||
inline void setOutputFile( myFILE* _outputFile /**< New output file for messages. */
|
||||
);
|
||||
|
||||
/** Changes error count.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
* RET_INVALID_ARGUMENT */
|
||||
inline returnValue setErrorCount( int _errorCount /**< New error count value. */
|
||||
);
|
||||
|
||||
/** Return the error code string. */
|
||||
static const char* getErrorString(int error);
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER FUNCTIONS
|
||||
*/
|
||||
protected:
|
||||
/** Prints a info message to myStderr (auxiliary function).
|
||||
* \return Error/warning/info number returned by sub function call
|
||||
*/
|
||||
returnValue throwMessage(
|
||||
returnValue RETnumber, /**< Error/warning/info number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the error/warning/info. */
|
||||
const char* filename, /**< Name of file which caused the error/warning/info. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the error/warning/info. */
|
||||
VisibilityStatus localVisibilityStatus, /**< Determines (locally) if info message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
const char* RETstring /**< Leading string of error/warning/info message. */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
VisibilityStatus errorVisibility; /**< Error messages visible? */
|
||||
VisibilityStatus warningVisibility; /**< Warning messages visible? */
|
||||
VisibilityStatus infoVisibility; /**< Info messages visible? */
|
||||
|
||||
myFILE* outputFile; /**< Output file for messages. */
|
||||
|
||||
int errorCount; /**< Counts number of errors (for nicer output only). */
|
||||
};
|
||||
|
||||
|
||||
#ifndef __FUNCTION__
|
||||
/** Ensures that __FUNCTION__ macro is defined. */
|
||||
#define __FUNCTION__ 0
|
||||
#endif
|
||||
|
||||
#ifndef __FILE__
|
||||
/** Ensures that __FILE__ macro is defined. */
|
||||
#define __FILE__ 0
|
||||
#endif
|
||||
|
||||
#ifndef __LINE__
|
||||
/** Ensures that __LINE__ macro is defined. */
|
||||
#define __LINE__ 0
|
||||
#endif
|
||||
|
||||
|
||||
/** Short version of throwError with default values, only returnValue is needed */
|
||||
#define THROWERROR(retval) ( getGlobalMessageHandler( )->throwError((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
/** Short version of throwWarning with default values, only returnValue is needed */
|
||||
#define THROWWARNING(retval) ( getGlobalMessageHandler( )->throwWarning((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
/** Short version of throwInfo with default values, only returnValue is needed */
|
||||
#define THROWINFO(retval) ( getGlobalMessageHandler( )->throwInfo((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
|
||||
/** Returns a pointer to global message handler.
|
||||
* \return Pointer to global message handler.
|
||||
*/
|
||||
MessageHandling* getGlobalMessageHandler( );
|
||||
|
||||
|
||||
#include <MessageHandling.ipp>
|
||||
|
||||
#endif /* QPOASES_MESSAGEHANDLING_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/MessageHandling.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the MessageHandling class including global return values.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_MESSAGEHANDLING_HPP
|
||||
#define QPOASES_MESSAGEHANDLING_HPP
|
||||
|
||||
// #define PC_DEBUG
|
||||
|
||||
#ifdef PC_DEBUG
|
||||
#include <stdio.h>
|
||||
|
||||
/** Defines an alias for FILE from stdio.h. */
|
||||
#define myFILE FILE
|
||||
/** Defines an alias for stderr from stdio.h. */
|
||||
#define myStderr stderr
|
||||
/** Defines an alias for stdout from stdio.h. */
|
||||
#define myStdout stdout
|
||||
#else
|
||||
/** Defines an alias for FILE from stdio.h. */
|
||||
#define myFILE int
|
||||
/** Defines an alias for stderr from stdio.h. */
|
||||
#define myStderr 0
|
||||
/** Defines an alias for stdout from stdio.h. */
|
||||
#define myStdout 0
|
||||
#endif
|
||||
|
||||
|
||||
#include <Types.hpp>
|
||||
#include <Constants.hpp>
|
||||
|
||||
|
||||
/** Defines symbols for global return values. \n
|
||||
* Important: All return values are assumed to be nonnegative! */
|
||||
enum returnValue
|
||||
{
|
||||
TERMINAL_LIST_ELEMENT = -1, /**< Terminal list element, internal usage only! */
|
||||
/* miscellaneous */
|
||||
SUCCESSFUL_RETURN = 0, /**< Successful return. */
|
||||
RET_DIV_BY_ZERO, /**< Division by zero. */
|
||||
RET_INDEX_OUT_OF_BOUNDS, /**< Index out of bounds. */
|
||||
RET_INVALID_ARGUMENTS, /**< At least one of the arguments is invalid. */
|
||||
RET_ERROR_UNDEFINED, /**< Error number undefined. */
|
||||
RET_WARNING_UNDEFINED, /**< Warning number undefined. */
|
||||
RET_INFO_UNDEFINED, /**< Info number undefined. */
|
||||
RET_EWI_UNDEFINED, /**< Error/warning/info number undefined. */
|
||||
RET_AVAILABLE_WITH_LINUX_ONLY, /**< This function is available under Linux only. */
|
||||
RET_UNKNOWN_BUG, /**< The error occured is not yet known. */
|
||||
RET_PRINTLEVEL_CHANGED, /**< 10 Print level changed. */
|
||||
RET_NOT_YET_IMPLEMENTED, /**< Requested function is not yet implemented in this version of qpOASES. */
|
||||
/* Indexlist */
|
||||
RET_INDEXLIST_MUST_BE_REORDERD, /**< Index list has to be reordered. */
|
||||
RET_INDEXLIST_EXCEEDS_MAX_LENGTH, /**< Index list exceeds its maximal physical length. */
|
||||
RET_INDEXLIST_CORRUPTED, /**< Index list corrupted. */
|
||||
RET_INDEXLIST_OUTOFBOUNDS, /**< Physical index is out of bounds. */
|
||||
RET_INDEXLIST_ADD_FAILED, /**< Adding indices from another index set failed. */
|
||||
RET_INDEXLIST_INTERSECT_FAILED, /**< Intersection with another index set failed. */
|
||||
/* SubjectTo / Bounds / Constraints */
|
||||
RET_INDEX_ALREADY_OF_DESIRED_STATUS, /**< Index is already of desired status. */
|
||||
RET_ADDINDEX_FAILED, /**< Cannot swap between different indexsets. */
|
||||
RET_SWAPINDEX_FAILED, /**< 20 Adding index to index set failed. */
|
||||
RET_NOTHING_TO_DO, /**< Nothing to do. */
|
||||
RET_SETUP_BOUND_FAILED, /**< Setting up bound index failed. */
|
||||
RET_SETUP_CONSTRAINT_FAILED, /**< Setting up constraint index failed. */
|
||||
RET_MOVING_BOUND_FAILED, /**< Moving bound between index sets failed. */
|
||||
RET_MOVING_CONSTRAINT_FAILED, /**< Moving constraint between index sets failed. */
|
||||
/* QProblem */
|
||||
RET_QP_ALREADY_INITIALISED, /**< QProblem has already been initialised. */
|
||||
RET_NO_INIT_WITH_STANDARD_SOLVER, /**< Initialisation via extern QP solver is not yet implemented. */
|
||||
RET_RESET_FAILED, /**< Reset failed. */
|
||||
RET_INIT_FAILED, /**< Initialisation failed. */
|
||||
RET_INIT_FAILED_TQ, /**< 30 Initialisation failed due to TQ factorisation. */
|
||||
RET_INIT_FAILED_CHOLESKY, /**< Initialisation failed due to Cholesky decomposition. */
|
||||
RET_INIT_FAILED_HOTSTART, /**< Initialisation failed! QP could not be solved! */
|
||||
RET_INIT_FAILED_INFEASIBILITY, /**< Initial QP could not be solved due to infeasibility! */
|
||||
RET_INIT_FAILED_UNBOUNDEDNESS, /**< Initial QP could not be solved due to unboundedness! */
|
||||
RET_INIT_SUCCESSFUL, /**< Initialisation done. */
|
||||
RET_OBTAINING_WORKINGSET_FAILED, /**< Failed to obtain working set for auxiliary QP. */
|
||||
RET_SETUP_WORKINGSET_FAILED, /**< Failed to setup working set for auxiliary QP. */
|
||||
RET_SETUP_AUXILIARYQP_FAILED, /**< Failed to setup auxiliary QP for initialised homotopy. */
|
||||
RET_NO_EXTERN_SOLVER, /**< No extern QP solver available. */
|
||||
RET_QP_UNBOUNDED, /**< 40 QP is unbounded. */
|
||||
RET_QP_INFEASIBLE, /**< QP is infeasible. */
|
||||
RET_QP_NOT_SOLVED, /**< Problems occured while solving QP with standard solver. */
|
||||
RET_QP_SOLVED, /**< QP successfully solved. */
|
||||
RET_UNABLE_TO_SOLVE_QP, /**< Problems occured while solving QP. */
|
||||
RET_INITIALISATION_STARTED, /**< Starting problem initialisation. */
|
||||
RET_HOTSTART_FAILED, /**< Unable to perform homotopy due to internal error. */
|
||||
RET_HOTSTART_FAILED_TO_INIT, /**< Unable to initialise problem. */
|
||||
RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, /**< Unable to perform homotopy as previous QP is not solved. */
|
||||
RET_ITERATION_STARTED, /**< Iteration... */
|
||||
RET_SHIFT_DETERMINATION_FAILED, /**< 50 Determination of shift of the QP data failed. */
|
||||
RET_STEPDIRECTION_DETERMINATION_FAILED, /**< Determination of step direction failed. */
|
||||
RET_STEPLENGTH_DETERMINATION_FAILED, /**< Determination of step direction failed. */
|
||||
RET_OPTIMAL_SOLUTION_FOUND, /**< Optimal solution of neighbouring QP found. */
|
||||
RET_HOMOTOPY_STEP_FAILED, /**< Unable to perform homotopy step. */
|
||||
RET_HOTSTART_STOPPED_INFEASIBILITY, /**< Premature homotopy termination because QP is infeasible. */
|
||||
RET_HOTSTART_STOPPED_UNBOUNDEDNESS, /**< Premature homotopy termination because QP is unbounded. */
|
||||
RET_WORKINGSET_UPDATE_FAILED, /**< Unable to update working sets according to initial guesses. */
|
||||
RET_MAX_NWSR_REACHED, /**< Maximum number of working set recalculations performed. */
|
||||
RET_CONSTRAINTS_NOT_SPECIFIED, /**< Problem does comprise constraints! You also have to specify new constraints' bounds. */
|
||||
RET_INVALID_FACTORISATION_FLAG, /**< 60 Invalid factorisation flag. */
|
||||
RET_UNABLE_TO_SAVE_QPDATA, /**< Unable to save QP data. */
|
||||
RET_STEPDIRECTION_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */
|
||||
RET_STEPDIRECTION_FAILED_CHOLESKY, /**< Abnormal termination due to Cholesky factorisation. */
|
||||
RET_CYCLING_DETECTED, /**< Cycling detected. */
|
||||
RET_CYCLING_NOT_RESOLVED, /**< Cycling cannot be resolved, QP probably infeasible. */
|
||||
RET_CYCLING_RESOLVED, /**< Cycling probably resolved. */
|
||||
RET_STEPSIZE, /**< For displaying performed stepsize. */
|
||||
RET_STEPSIZE_NONPOSITIVE, /**< For displaying non-positive stepsize. */
|
||||
RET_SETUPSUBJECTTOTYPE_FAILED, /**< Setup of SubjectToTypes failed. */
|
||||
RET_ADDCONSTRAINT_FAILED, /**< 70 Addition of constraint to working set failed. */
|
||||
RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, /**< Addition of constraint to working set failed (due to QP infeasibility). */
|
||||
RET_ADDBOUND_FAILED, /**< Addition of bound to working set failed. */
|
||||
RET_ADDBOUND_FAILED_INFEASIBILITY, /**< Addition of bound to working set failed (due to QP infeasibility). */
|
||||
RET_REMOVECONSTRAINT_FAILED, /**< Removal of constraint from working set failed. */
|
||||
RET_REMOVEBOUND_FAILED, /**< Removal of bound from working set failed. */
|
||||
RET_REMOVE_FROM_ACTIVESET, /**< Removing from active set... */
|
||||
RET_ADD_TO_ACTIVESET, /**< Adding to active set... */
|
||||
RET_REMOVE_FROM_ACTIVESET_FAILED, /**< Removing from active set failed. */
|
||||
RET_ADD_TO_ACTIVESET_FAILED, /**< Adding to active set failed. */
|
||||
RET_CONSTRAINT_ALREADY_ACTIVE, /**< 80 Constraint is already active. */
|
||||
RET_ALL_CONSTRAINTS_ACTIVE, /**< All constraints are active, no further constraint can be added. */
|
||||
RET_LINEARLY_DEPENDENT, /**< New bound/constraint is linearly dependent. */
|
||||
RET_LINEARLY_INDEPENDENT, /**< New bound/constraint is linearly independent. */
|
||||
RET_LI_RESOLVED, /**< Linear independence of active contraint matrix successfully resolved. */
|
||||
RET_ENSURELI_FAILED, /**< Failed to ensure linear indepence of active contraint matrix. */
|
||||
RET_ENSURELI_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */
|
||||
RET_ENSURELI_FAILED_NOINDEX, /**< No index found, QP probably infeasible. */
|
||||
RET_ENSURELI_FAILED_CYCLING, /**< Cycling detected, QP probably infeasible. */
|
||||
RET_BOUND_ALREADY_ACTIVE, /**< Bound is already active. */
|
||||
RET_ALL_BOUNDS_ACTIVE, /**< 90 All bounds are active, no further bound can be added. */
|
||||
RET_CONSTRAINT_NOT_ACTIVE, /**< Constraint is not active. */
|
||||
RET_BOUND_NOT_ACTIVE, /**< Bound is not active. */
|
||||
RET_HESSIAN_NOT_SPD, /**< Projected Hessian matrix not positive definite. */
|
||||
RET_MATRIX_SHIFT_FAILED, /**< Unable to update matrices or to transform vectors. */
|
||||
RET_MATRIX_FACTORISATION_FAILED, /**< Unable to calculate new matrix factorisations. */
|
||||
RET_PRINT_ITERATION_FAILED, /**< Unable to print information on current iteration. */
|
||||
RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, /**< No global message output file initialised. */
|
||||
/* Utils */
|
||||
RET_UNABLE_TO_OPEN_FILE, /**< Unable to open file. */
|
||||
RET_UNABLE_TO_WRITE_FILE, /**< Unable to write into file. */
|
||||
RET_UNABLE_TO_READ_FILE, /**< 100 Unable to read from file. */
|
||||
RET_FILEDATA_INCONSISTENT, /**< File contains inconsistent data. */
|
||||
/* SolutionAnalysis */
|
||||
RET_NO_SOLUTION, /**< QP solution does not satisfy KKT optimality conditions. */
|
||||
RET_INACCURATE_SOLUTION /**< KKT optimality conditions not satisfied to sufficient accuracy. */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** This class handles all kinds of messages (errors, warnings, infos) initiated
|
||||
* by qpOASES modules and stores the correspoding global preferences.
|
||||
*
|
||||
* \author Hans Joachim Ferreau (special thanks to Leonard Wirsching)
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class MessageHandling
|
||||
{
|
||||
/*
|
||||
* INTERNAL DATA STRUCTURES
|
||||
*/
|
||||
public:
|
||||
/** Data structure for entries in global message list. */
|
||||
typedef struct {
|
||||
returnValue key; /**< Global return value. */
|
||||
const char* data; /**< Corresponding message. */
|
||||
VisibilityStatus globalVisibilityStatus; /**< Determines if message can be printed.
|
||||
* If this value is set to VS_HIDDEN, no message is printed! */
|
||||
} ReturnValueList;
|
||||
|
||||
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
MessageHandling( );
|
||||
|
||||
/** Constructor which takes the desired output file. */
|
||||
MessageHandling( myFILE* _outputFile /**< Output file. */
|
||||
);
|
||||
|
||||
/** Constructor which takes the desired visibility states. */
|
||||
MessageHandling( VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */
|
||||
VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */
|
||||
VisibilityStatus _infoVisibility /**< Visibility status for info messages. */
|
||||
);
|
||||
|
||||
/** Constructor which takes the desired output file and desired visibility states. */
|
||||
MessageHandling( myFILE* _outputFile, /**< Output file. */
|
||||
VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */
|
||||
VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */
|
||||
VisibilityStatus _infoVisibility /**< Visibility status for info messages. */
|
||||
);
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
MessageHandling( const MessageHandling& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~MessageHandling( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
MessageHandling& operator=( const MessageHandling& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints an error message(a simplified macro THROWERROR is also provided). \n
|
||||
* Errors are definied as abnormal events which cause an immediate termination of the current (sub) function.
|
||||
* Errors of a sub function should be commented by the calling function by means of a warning message
|
||||
* (if this error does not cause an error of the calling function, either)!
|
||||
* \return Error number returned by sub function call
|
||||
*/
|
||||
returnValue throwError(
|
||||
returnValue Enumber, /**< Error number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional error text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the error. */
|
||||
const char* filename, /**< Name of file which caused the error. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the error.incompatible binary file */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if error message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
/** Prints a warning message (a simplified macro THROWWARNING is also provided).
|
||||
* Warnings are definied as abnormal events which does NOT cause an immediate termination of the current (sub) function.
|
||||
* \return Warning number returned by sub function call
|
||||
*/
|
||||
returnValue throwWarning(
|
||||
returnValue Wnumber, /**< Warning number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the warning. */
|
||||
const char* filename, /**< Name of file which caused the warning. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the warning. */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if warning message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
/** Prints a info message (a simplified macro THROWINFO is also provided).
|
||||
* \return Info number returned by sub function call
|
||||
*/
|
||||
returnValue throwInfo(
|
||||
returnValue Inumber, /**< Info number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which submitted the info. */
|
||||
const char* filename, /**< Name of file which submitted the info. */
|
||||
const unsigned long linenumber, /**< Number of line which submitted the info. */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if info message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
|
||||
/** Resets all preferences to default values.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue reset( );
|
||||
|
||||
|
||||
/** Prints a complete list of all messages to output file.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue listAllMessages( );
|
||||
|
||||
|
||||
/** Returns visibility status for error messages.
|
||||
* \return Visibility status for error messages. */
|
||||
inline VisibilityStatus getErrorVisibilityStatus( ) const;
|
||||
|
||||
/** Returns visibility status for warning messages.
|
||||
* \return Visibility status for warning messages. */
|
||||
inline VisibilityStatus getWarningVisibilityStatus( ) const;
|
||||
|
||||
/** Returns visibility status for info messages.
|
||||
* \return Visibility status for info messages. */
|
||||
inline VisibilityStatus getInfoVisibilityStatus( ) const;
|
||||
|
||||
/** Returns pointer to output file.
|
||||
* \return Pointer to output file. */
|
||||
inline myFILE* getOutputFile( ) const;
|
||||
|
||||
/** Returns error count value.
|
||||
* \return Error count value. */
|
||||
inline int getErrorCount( ) const;
|
||||
|
||||
|
||||
/** Changes visibility status for error messages. */
|
||||
inline void setErrorVisibilityStatus( VisibilityStatus _errorVisibility /**< New visibility status for error messages. */
|
||||
);
|
||||
|
||||
/** Changes visibility status for warning messages. */
|
||||
inline void setWarningVisibilityStatus( VisibilityStatus _warningVisibility /**< New visibility status for warning messages. */
|
||||
);
|
||||
|
||||
/** Changes visibility status for info messages. */
|
||||
inline void setInfoVisibilityStatus( VisibilityStatus _infoVisibility /**< New visibility status for info messages. */
|
||||
);
|
||||
|
||||
/** Changes output file for messages. */
|
||||
inline void setOutputFile( myFILE* _outputFile /**< New output file for messages. */
|
||||
);
|
||||
|
||||
/** Changes error count.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
* RET_INVALID_ARGUMENT */
|
||||
inline returnValue setErrorCount( int _errorCount /**< New error count value. */
|
||||
);
|
||||
|
||||
/** Return the error code string. */
|
||||
static const char* getErrorString(int error);
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER FUNCTIONS
|
||||
*/
|
||||
protected:
|
||||
/** Prints a info message to myStderr (auxiliary function).
|
||||
* \return Error/warning/info number returned by sub function call
|
||||
*/
|
||||
returnValue throwMessage(
|
||||
returnValue RETnumber, /**< Error/warning/info number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the error/warning/info. */
|
||||
const char* filename, /**< Name of file which caused the error/warning/info. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the error/warning/info. */
|
||||
VisibilityStatus localVisibilityStatus, /**< Determines (locally) if info message can be printed to myStderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
const char* RETstring /**< Leading string of error/warning/info message. */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
VisibilityStatus errorVisibility; /**< Error messages visible? */
|
||||
VisibilityStatus warningVisibility; /**< Warning messages visible? */
|
||||
VisibilityStatus infoVisibility; /**< Info messages visible? */
|
||||
|
||||
myFILE* outputFile; /**< Output file for messages. */
|
||||
|
||||
int errorCount; /**< Counts number of errors (for nicer output only). */
|
||||
};
|
||||
|
||||
|
||||
#ifndef __FUNCTION__
|
||||
/** Ensures that __FUNCTION__ macro is defined. */
|
||||
#define __FUNCTION__ 0
|
||||
#endif
|
||||
|
||||
#ifndef __FILE__
|
||||
/** Ensures that __FILE__ macro is defined. */
|
||||
#define __FILE__ 0
|
||||
#endif
|
||||
|
||||
#ifndef __LINE__
|
||||
/** Ensures that __LINE__ macro is defined. */
|
||||
#define __LINE__ 0
|
||||
#endif
|
||||
|
||||
|
||||
/** Short version of throwError with default values, only returnValue is needed */
|
||||
#define THROWERROR(retval) ( getGlobalMessageHandler( )->throwError((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
/** Short version of throwWarning with default values, only returnValue is needed */
|
||||
#define THROWWARNING(retval) ( getGlobalMessageHandler( )->throwWarning((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
/** Short version of throwInfo with default values, only returnValue is needed */
|
||||
#define THROWINFO(retval) ( getGlobalMessageHandler( )->throwInfo((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
|
||||
/** Returns a pointer to global message handler.
|
||||
* \return Pointer to global message handler.
|
||||
*/
|
||||
MessageHandling* getGlobalMessageHandler( );
|
||||
|
||||
|
||||
#include <MessageHandling.ipp>
|
||||
|
||||
#endif /* QPOASES_MESSAGEHANDLING_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,178 +1,178 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/SubjectTo.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the SubjectTo class designed to manage working sets of
|
||||
* constraints and bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_SUBJECTTO_HPP
|
||||
#define QPOASES_SUBJECTTO_HPP
|
||||
|
||||
|
||||
#include <Indexlist.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class manages working sets of constraints and bounds by storing
|
||||
* index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class SubjectTo
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
SubjectTo( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
SubjectTo( const SubjectTo& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~SubjectTo( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
SubjectTo& operator=( const SubjectTo& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor takes the number of constraints or bounds.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int n /**< Number of constraints or bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns type of (constraints') bound.
|
||||
* \return Type of (constraints') bound \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
inline SubjectToType getType( int i /**< Number of (constraints') bound. */
|
||||
) const ;
|
||||
|
||||
/** Returns status of (constraints') bound.
|
||||
* \return Status of (constraints') bound \n
|
||||
ST_UNDEFINED */
|
||||
inline SubjectToStatus getStatus( int i /**< Number of (constraints') bound. */
|
||||
) const;
|
||||
|
||||
|
||||
/** Sets type of (constraints') bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
inline returnValue setType( int i, /**< Number of (constraints') bound. */
|
||||
SubjectToType value /**< Type of (constraints') bound. */
|
||||
);
|
||||
|
||||
/** Sets status of (constraints') bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
inline returnValue setStatus( int i, /**< Number of (constraints') bound. */
|
||||
SubjectToStatus value /**< Status of (constraints') bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Sets status of lower (constraints') bounds. */
|
||||
inline void setNoLower( BooleanType _status /**< Status of lower (constraints') bounds. */
|
||||
);
|
||||
|
||||
/** Sets status of upper (constraints') bounds. */
|
||||
inline void setNoUpper( BooleanType _status /**< Status of upper (constraints') bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns status of lower (constraints') bounds.
|
||||
* \return BT_TRUE if there is no lower (constraints') bound on any variable. */
|
||||
inline BooleanType isNoLower( ) const;
|
||||
|
||||
/** Returns status of upper bounds.
|
||||
* \return BT_TRUE if there is no upper (constraints') bound on any variable. */
|
||||
inline BooleanType isNoUpper( ) const;
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER FUNCTIONS
|
||||
*/
|
||||
protected:
|
||||
/** Adds the index of a new constraint or bound to index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_ADDINDEX_FAILED */
|
||||
returnValue addIndex( Indexlist* const indexlist, /**< Index list to which the new index shall be added. */
|
||||
int newnumber, /**< Number of new constraint or bound. */
|
||||
SubjectToStatus newstatus /**< Status of new constraint or bound. */
|
||||
);
|
||||
|
||||
/** Removes the index of a constraint or bound from index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNKNOWN_BUG */
|
||||
returnValue removeIndex( Indexlist* const indexlist, /**< Index list from which the new index shall be removed. */
|
||||
int removenumber /**< Number of constraint or bound to be removed. */
|
||||
);
|
||||
|
||||
/** Swaps the indices of two constraints or bounds within the index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SWAPINDEX_FAILED */
|
||||
returnValue swapIndex( Indexlist* const indexlist, /**< Index list in which the indices shold be swapped. */
|
||||
int number1, /**< Number of first constraint or bound. */
|
||||
int number2 /**< Number of second constraint or bound. */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
SubjectToType type[NVMAX+NCMAX]; /**< Type of constraints/bounds. */
|
||||
SubjectToStatus status[NVMAX+NCMAX]; /**< Status of constraints/bounds. */
|
||||
|
||||
BooleanType noLower; /**< This flag indicates if there is no lower bound on any variable. */
|
||||
BooleanType noUpper; /**< This flag indicates if there is no upper bound on any variable. */
|
||||
|
||||
|
||||
/*
|
||||
* PRIVATE MEMBER VARIABLES
|
||||
*/
|
||||
private:
|
||||
int size;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include <SubjectTo.ipp>
|
||||
|
||||
#endif /* QPOASES_SUBJECTTO_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/SubjectTo.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of the SubjectTo class designed to manage working sets of
|
||||
* constraints and bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_SUBJECTTO_HPP
|
||||
#define QPOASES_SUBJECTTO_HPP
|
||||
|
||||
|
||||
#include <Indexlist.hpp>
|
||||
|
||||
|
||||
|
||||
/** This class manages working sets of constraints and bounds by storing
|
||||
* index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*/
|
||||
class SubjectTo
|
||||
{
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS
|
||||
*/
|
||||
public:
|
||||
/** Default constructor. */
|
||||
SubjectTo( );
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
SubjectTo( const SubjectTo& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
/** Destructor. */
|
||||
~SubjectTo( );
|
||||
|
||||
/** Assignment operator (deep copy). */
|
||||
SubjectTo& operator=( const SubjectTo& rhs /**< Rhs object. */
|
||||
);
|
||||
|
||||
|
||||
/** Pseudo-constructor takes the number of constraints or bounds.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue init( int n /**< Number of constraints or bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns type of (constraints') bound.
|
||||
* \return Type of (constraints') bound \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
inline SubjectToType getType( int i /**< Number of (constraints') bound. */
|
||||
) const ;
|
||||
|
||||
/** Returns status of (constraints') bound.
|
||||
* \return Status of (constraints') bound \n
|
||||
ST_UNDEFINED */
|
||||
inline SubjectToStatus getStatus( int i /**< Number of (constraints') bound. */
|
||||
) const;
|
||||
|
||||
|
||||
/** Sets type of (constraints') bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
inline returnValue setType( int i, /**< Number of (constraints') bound. */
|
||||
SubjectToType value /**< Type of (constraints') bound. */
|
||||
);
|
||||
|
||||
/** Sets status of (constraints') bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
inline returnValue setStatus( int i, /**< Number of (constraints') bound. */
|
||||
SubjectToStatus value /**< Status of (constraints') bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Sets status of lower (constraints') bounds. */
|
||||
inline void setNoLower( BooleanType _status /**< Status of lower (constraints') bounds. */
|
||||
);
|
||||
|
||||
/** Sets status of upper (constraints') bounds. */
|
||||
inline void setNoUpper( BooleanType _status /**< Status of upper (constraints') bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns status of lower (constraints') bounds.
|
||||
* \return BT_TRUE if there is no lower (constraints') bound on any variable. */
|
||||
inline BooleanType isNoLower( ) const;
|
||||
|
||||
/** Returns status of upper bounds.
|
||||
* \return BT_TRUE if there is no upper (constraints') bound on any variable. */
|
||||
inline BooleanType isNoUpper( ) const;
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER FUNCTIONS
|
||||
*/
|
||||
protected:
|
||||
/** Adds the index of a new constraint or bound to index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_ADDINDEX_FAILED */
|
||||
returnValue addIndex( Indexlist* const indexlist, /**< Index list to which the new index shall be added. */
|
||||
int newnumber, /**< Number of new constraint or bound. */
|
||||
SubjectToStatus newstatus /**< Status of new constraint or bound. */
|
||||
);
|
||||
|
||||
/** Removes the index of a constraint or bound from index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNKNOWN_BUG */
|
||||
returnValue removeIndex( Indexlist* const indexlist, /**< Index list from which the new index shall be removed. */
|
||||
int removenumber /**< Number of constraint or bound to be removed. */
|
||||
);
|
||||
|
||||
/** Swaps the indices of two constraints or bounds within the index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SWAPINDEX_FAILED */
|
||||
returnValue swapIndex( Indexlist* const indexlist, /**< Index list in which the indices shold be swapped. */
|
||||
int number1, /**< Number of first constraint or bound. */
|
||||
int number2 /**< Number of second constraint or bound. */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* PROTECTED MEMBER VARIABLES
|
||||
*/
|
||||
protected:
|
||||
SubjectToType type[NVMAX+NCMAX]; /**< Type of constraints/bounds. */
|
||||
SubjectToStatus status[NVMAX+NCMAX]; /**< Status of constraints/bounds. */
|
||||
|
||||
BooleanType noLower; /**< This flag indicates if there is no lower bound on any variable. */
|
||||
BooleanType noUpper; /**< This flag indicates if there is no upper bound on any variable. */
|
||||
|
||||
|
||||
/*
|
||||
* PRIVATE MEMBER VARIABLES
|
||||
*/
|
||||
private:
|
||||
int size;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include <SubjectTo.ipp>
|
||||
|
||||
#endif /* QPOASES_SUBJECTTO_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+131
-131
@@ -1,131 +1,131 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Types.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2008
|
||||
*
|
||||
* Declaration of all non-built-in types (except for classes).
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_TYPES_HPP
|
||||
#define QPOASES_TYPES_HPP
|
||||
|
||||
|
||||
|
||||
/** Define real_t for facilitating switching between double and float. */
|
||||
// typedef double real_t;
|
||||
|
||||
|
||||
/** Summarises all possible logical values. */
|
||||
enum BooleanType
|
||||
{
|
||||
BT_FALSE, /**< Logical value for "false". */
|
||||
BT_TRUE /**< Logical value for "true". */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible print levels. Print levels are used to describe
|
||||
* the desired amount of output during runtime of qpOASES. */
|
||||
enum PrintLevel
|
||||
{
|
||||
PL_NONE, /**< No output. */
|
||||
PL_LOW, /**< Print error messages only. */
|
||||
PL_MEDIUM, /**< Print error and warning messages as well as concise info messages. */
|
||||
PL_HIGH /**< Print all messages with full details. */
|
||||
};
|
||||
|
||||
|
||||
/** Defines visibility status of a message. */
|
||||
enum VisibilityStatus
|
||||
{
|
||||
VS_VISIBLE, /**< Message visible. */
|
||||
VS_HIDDEN /**< Message not visible. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible states of the (S)QProblem(B) object during the
|
||||
solution process of a QP sequence. */
|
||||
enum QProblemStatus
|
||||
{
|
||||
QPS_NOTINITIALISED, /**< QProblem object is freshly instantiated or reset. */
|
||||
QPS_PREPARINGAUXILIARYQP, /**< An auxiliary problem is currently setup, either at the very beginning
|
||||
* via an initial homotopy or after changing the QP matrices. */
|
||||
QPS_AUXILIARYQPSOLVED, /**< An auxilary problem was solved, either at the very beginning
|
||||
* via an initial homotopy or after changing the QP matrices. */
|
||||
QPS_PERFORMINGHOMOTOPY, /**< A homotopy according to the main idea of the online active
|
||||
* set strategy is performed. */
|
||||
QPS_HOMOTOPYQPSOLVED, /**< An intermediate QP along the homotopy path was solved. */
|
||||
QPS_SOLVED /**< The solution of the actual QP was found. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible types of bounds and constraints. */
|
||||
enum SubjectToType
|
||||
{
|
||||
ST_UNBOUNDED, /**< Bound/constraint is unbounded. */
|
||||
ST_BOUNDED, /**< Bound/constraint is bounded but not fixed. */
|
||||
ST_EQUALITY, /**< Bound/constraint is fixed (implicit equality bound/constraint). */
|
||||
ST_UNKNOWN /**< Type of bound/constraint unknown. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible states of bounds and constraints. */
|
||||
enum SubjectToStatus
|
||||
{
|
||||
ST_INACTIVE, /**< Bound/constraint is inactive. */
|
||||
ST_LOWER, /**< Bound/constraint is at its lower bound. */
|
||||
ST_UPPER, /**< Bound/constraint is at its upper bound. */
|
||||
ST_UNDEFINED /**< Status of bound/constraint undefined. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible cycling states of bounds and constraints. */
|
||||
enum CyclingStatus
|
||||
{
|
||||
CYC_NOT_INVOLVED, /**< Bound/constraint is not involved in current cycling. */
|
||||
CYC_PREV_ADDED, /**< Bound/constraint has previously been added during the current cycling. */
|
||||
CYC_PREV_REMOVED /**< Bound/constraint has previously been removed during the current cycling. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible types of the QP's Hessian matrix. */
|
||||
enum HessianType
|
||||
{
|
||||
HST_SEMIDEF, /**< Hessian is positive semi-definite. */
|
||||
HST_POSDEF_NULLSPACE, /**< Hessian is positive definite on null space of active bounds/constraints. */
|
||||
HST_POSDEF, /**< Hessian is (strictly) positive definite. */
|
||||
HST_IDENTITY /**< Hessian is identity matrix. */
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QPOASES_TYPES_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Types.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2008
|
||||
*
|
||||
* Declaration of all non-built-in types (except for classes).
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_TYPES_HPP
|
||||
#define QPOASES_TYPES_HPP
|
||||
|
||||
|
||||
|
||||
/** Define real_t for facilitating switching between double and float. */
|
||||
// typedef double real_t;
|
||||
|
||||
|
||||
/** Summarises all possible logical values. */
|
||||
enum BooleanType
|
||||
{
|
||||
BT_FALSE, /**< Logical value for "false". */
|
||||
BT_TRUE /**< Logical value for "true". */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible print levels. Print levels are used to describe
|
||||
* the desired amount of output during runtime of qpOASES. */
|
||||
enum PrintLevel
|
||||
{
|
||||
PL_NONE, /**< No output. */
|
||||
PL_LOW, /**< Print error messages only. */
|
||||
PL_MEDIUM, /**< Print error and warning messages as well as concise info messages. */
|
||||
PL_HIGH /**< Print all messages with full details. */
|
||||
};
|
||||
|
||||
|
||||
/** Defines visibility status of a message. */
|
||||
enum VisibilityStatus
|
||||
{
|
||||
VS_VISIBLE, /**< Message visible. */
|
||||
VS_HIDDEN /**< Message not visible. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible states of the (S)QProblem(B) object during the
|
||||
solution process of a QP sequence. */
|
||||
enum QProblemStatus
|
||||
{
|
||||
QPS_NOTINITIALISED, /**< QProblem object is freshly instantiated or reset. */
|
||||
QPS_PREPARINGAUXILIARYQP, /**< An auxiliary problem is currently setup, either at the very beginning
|
||||
* via an initial homotopy or after changing the QP matrices. */
|
||||
QPS_AUXILIARYQPSOLVED, /**< An auxilary problem was solved, either at the very beginning
|
||||
* via an initial homotopy or after changing the QP matrices. */
|
||||
QPS_PERFORMINGHOMOTOPY, /**< A homotopy according to the main idea of the online active
|
||||
* set strategy is performed. */
|
||||
QPS_HOMOTOPYQPSOLVED, /**< An intermediate QP along the homotopy path was solved. */
|
||||
QPS_SOLVED /**< The solution of the actual QP was found. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible types of bounds and constraints. */
|
||||
enum SubjectToType
|
||||
{
|
||||
ST_UNBOUNDED, /**< Bound/constraint is unbounded. */
|
||||
ST_BOUNDED, /**< Bound/constraint is bounded but not fixed. */
|
||||
ST_EQUALITY, /**< Bound/constraint is fixed (implicit equality bound/constraint). */
|
||||
ST_UNKNOWN /**< Type of bound/constraint unknown. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible states of bounds and constraints. */
|
||||
enum SubjectToStatus
|
||||
{
|
||||
ST_INACTIVE, /**< Bound/constraint is inactive. */
|
||||
ST_LOWER, /**< Bound/constraint is at its lower bound. */
|
||||
ST_UPPER, /**< Bound/constraint is at its upper bound. */
|
||||
ST_UNDEFINED /**< Status of bound/constraint undefined. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible cycling states of bounds and constraints. */
|
||||
enum CyclingStatus
|
||||
{
|
||||
CYC_NOT_INVOLVED, /**< Bound/constraint is not involved in current cycling. */
|
||||
CYC_PREV_ADDED, /**< Bound/constraint has previously been added during the current cycling. */
|
||||
CYC_PREV_REMOVED /**< Bound/constraint has previously been removed during the current cycling. */
|
||||
};
|
||||
|
||||
|
||||
/** Summarises all possible types of the QP's Hessian matrix. */
|
||||
enum HessianType
|
||||
{
|
||||
HST_SEMIDEF, /**< Hessian is positive semi-definite. */
|
||||
HST_POSDEF_NULLSPACE, /**< Hessian is positive definite on null space of active bounds/constraints. */
|
||||
HST_POSDEF, /**< Hessian is (strictly) positive definite. */
|
||||
HST_IDENTITY /**< Hessian is identity matrix. */
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QPOASES_TYPES_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+197
-197
@@ -1,197 +1,197 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Utils.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of global utility functions for working with qpOASES.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_UTILS_HPP
|
||||
#define QPOASES_UTILS_HPP
|
||||
|
||||
|
||||
#include <MessageHandling.hpp>
|
||||
|
||||
|
||||
#ifdef PC_DEBUG /* Define print functions only for debugging! */
|
||||
|
||||
/** Prints a vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const v, /**< Vector to be printed. */
|
||||
int n /**< Length of vector. */
|
||||
);
|
||||
|
||||
/** Prints a permuted vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const v, /**< Vector to be printed. */
|
||||
int n, /**< Length of vector. */
|
||||
const int* const V_idx /**< Pemutation vector. */
|
||||
);
|
||||
|
||||
/** Prints a named vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const v, /**< Vector to be printed. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* name /** Name of vector. */
|
||||
);
|
||||
|
||||
/** Prints a matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol /**< Column number of matrix. */
|
||||
);
|
||||
|
||||
/** Prints a permuted matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol , /**< Column number of matrix. */
|
||||
const int* const ROW_idx, /**< Row pemutation vector. */
|
||||
const int* const COL_idx /**< Column pemutation vector. */
|
||||
);
|
||||
|
||||
/** Prints a named matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* name /** Name of matrix. */
|
||||
);
|
||||
|
||||
/** Prints an index array.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const int* const index, /**< Index array to be printed. */
|
||||
int n /**< Length of index array. */
|
||||
);
|
||||
|
||||
/** Prints a named index array.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const int* const index, /**< Index array to be printed. */
|
||||
int n, /**< Length of index array. */
|
||||
const char* name /**< Name of index array. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints a string to desired output target (useful also for MATLAB output!).
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue myPrintf( const char* s /**< String to be written. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints qpOASES copyright notice.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue printCopyrightNotice( );
|
||||
|
||||
|
||||
/** Reads a real_t matrix from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue readFromFile( real_t* data, /**< Matrix to be read from file. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
/** Reads a real_t vector from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue readFromFile( real_t* data, /**< Vector to be read from file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
/** Reads an integer (column) vector from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue readFromFile( int* data, /**< Vector to be read from file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
|
||||
/** Writes a real_t matrix into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue writeIntoFile( const real_t* const data, /**< Matrix to be written into file. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
/** Writes a real_t vector into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue writeIntoFile( const real_t* const data, /**< Vector to be written into file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
/** Writes an integer (column) vector into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue writeIntoFile( const int* const integer, /**< Integer vector to be written into file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if integer shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
#endif /* PC_DEBUG */
|
||||
|
||||
|
||||
/** Returns the current system time.
|
||||
* \return current system time */
|
||||
real_t getCPUtime( );
|
||||
|
||||
|
||||
/** Returns the Euclidean norm of a vector.
|
||||
* \return 0: successful */
|
||||
real_t getNorm( const real_t* const v, /**< Vector. */
|
||||
int n /**< Vector's dimension. */
|
||||
);
|
||||
|
||||
/** Returns the absolute value of a real_t.
|
||||
* \return Absolute value of a real_t */
|
||||
inline real_t getAbs( real_t x /**< Input argument. */
|
||||
);
|
||||
|
||||
|
||||
|
||||
#include <Utils.ipp>
|
||||
|
||||
#endif /* QPOASES_UTILS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file INCLUDE/Utils.hpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of global utility functions for working with qpOASES.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_UTILS_HPP
|
||||
#define QPOASES_UTILS_HPP
|
||||
|
||||
|
||||
#include <MessageHandling.hpp>
|
||||
|
||||
|
||||
#ifdef PC_DEBUG /* Define print functions only for debugging! */
|
||||
|
||||
/** Prints a vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const v, /**< Vector to be printed. */
|
||||
int n /**< Length of vector. */
|
||||
);
|
||||
|
||||
/** Prints a permuted vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const v, /**< Vector to be printed. */
|
||||
int n, /**< Length of vector. */
|
||||
const int* const V_idx /**< Pemutation vector. */
|
||||
);
|
||||
|
||||
/** Prints a named vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const v, /**< Vector to be printed. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* name /** Name of vector. */
|
||||
);
|
||||
|
||||
/** Prints a matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol /**< Column number of matrix. */
|
||||
);
|
||||
|
||||
/** Prints a permuted matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol , /**< Column number of matrix. */
|
||||
const int* const ROW_idx, /**< Row pemutation vector. */
|
||||
const int* const COL_idx /**< Column pemutation vector. */
|
||||
);
|
||||
|
||||
/** Prints a named matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* name /** Name of matrix. */
|
||||
);
|
||||
|
||||
/** Prints an index array.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const int* const index, /**< Index array to be printed. */
|
||||
int n /**< Length of index array. */
|
||||
);
|
||||
|
||||
/** Prints a named index array.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue print( const int* const index, /**< Index array to be printed. */
|
||||
int n, /**< Length of index array. */
|
||||
const char* name /**< Name of index array. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints a string to desired output target (useful also for MATLAB output!).
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue myPrintf( const char* s /**< String to be written. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints qpOASES copyright notice.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue printCopyrightNotice( );
|
||||
|
||||
|
||||
/** Reads a real_t matrix from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue readFromFile( real_t* data, /**< Matrix to be read from file. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
/** Reads a real_t vector from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue readFromFile( real_t* data, /**< Vector to be read from file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
/** Reads an integer (column) vector from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue readFromFile( int* data, /**< Vector to be read from file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
|
||||
/** Writes a real_t matrix into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue writeIntoFile( const real_t* const data, /**< Matrix to be written into file. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
/** Writes a real_t vector into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue writeIntoFile( const real_t* const data, /**< Vector to be written into file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
/** Writes an integer (column) vector into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue writeIntoFile( const int* const integer, /**< Integer vector to be written into file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if integer shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
#endif /* PC_DEBUG */
|
||||
|
||||
|
||||
/** Returns the current system time.
|
||||
* \return current system time */
|
||||
real_t getCPUtime( );
|
||||
|
||||
|
||||
/** Returns the Euclidean norm of a vector.
|
||||
* \return 0: successful */
|
||||
real_t getNorm( const real_t* const v, /**< Vector. */
|
||||
int n /**< Vector's dimension. */
|
||||
);
|
||||
|
||||
/** Returns the absolute value of a real_t.
|
||||
* \return Absolute value of a real_t */
|
||||
inline real_t getAbs( real_t x /**< Input argument. */
|
||||
);
|
||||
|
||||
|
||||
|
||||
#include <Utils.ipp>
|
||||
|
||||
#endif /* QPOASES_UTILS_HPP */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+504
-504
File diff suppressed because it is too large
Load Diff
@@ -1,92 +1,92 @@
|
||||
##
|
||||
## qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
## Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
##
|
||||
## qpOASES is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## qpOASES is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with qpOASES; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
=============
|
||||
|
||||
qpOASES is an open-source C++ implementation of the recently proposed
|
||||
online active set strategy (see [1], [2]), which was inspired by important
|
||||
observations from the field of parametric quadratic programming. It has
|
||||
several theoretical features that make it particularly suited for model
|
||||
predictive control (MPC) applications.
|
||||
|
||||
The software package qpOASES implements these ideas and has already been
|
||||
successfully used for closed-loop control of a real-world Diesel engine [3].
|
||||
|
||||
|
||||
References:
|
||||
|
||||
[1] H.J. Ferreau. An Online Active Set Strategy for Fast Solution of
|
||||
Parametric Quadratic Programs with Applications to Predictive Engine Control.
|
||||
Diplom thesis, University of Heidelberg, 2006.
|
||||
|
||||
[2] H.J. Ferreau, H.G. Bock, M. Diehl. An online active set strategy to
|
||||
overcome the limitations of explicit MPC. International Journal of Robust
|
||||
and Nonlinear Control, 18 (8), pp. 816-830, 2008.
|
||||
|
||||
[3] H.J. Ferreau, P. Ortner, P. Langthaler, L. del Re, M. Diehl. Predictive
|
||||
Control of a Real-World Diesel Engine using an Extended Online Active Set
|
||||
Strategy. Annual Reviews in Control, 31 (2), pp. 293-301, 2007.
|
||||
|
||||
|
||||
|
||||
GETTING STARTED
|
||||
================
|
||||
|
||||
1. For installation, usage and additional information on this software package
|
||||
see the qpOASES User's Manual located at ./DOC/manual.pdf!
|
||||
|
||||
|
||||
2. The file ./LICENSE.txt contains a copy of the GNU Lesser General Public
|
||||
License. Please read it carefully before using qpOASES!
|
||||
|
||||
|
||||
3. The whole software package can be downloaded from
|
||||
|
||||
http://homes.esat.kuleuven.be/~optec/software/qpOASES/
|
||||
|
||||
On this webpage you will also find a list of frequently asked questions.
|
||||
|
||||
|
||||
|
||||
CONTACT THE AUTHORS
|
||||
====================
|
||||
|
||||
If you have got questions, remarks or comments on qpOASES
|
||||
please contact the main author:
|
||||
|
||||
Hans Joachim Ferreau
|
||||
Katholieke Universiteit Leuven
|
||||
Department of Electrical Engineering (ESAT)
|
||||
Kasteelpark Arenberg 10, bus 2446
|
||||
B-3001 Leuven-Heverlee, Belgium
|
||||
|
||||
Phone: +32 16 32 03 63
|
||||
E-mail: joachim.ferreau@esat.kuleuven.be
|
||||
qpOASES@esat.kuleuven.be
|
||||
|
||||
Also bug reports and source code extensions are most welcome!
|
||||
|
||||
|
||||
|
||||
##
|
||||
## end of file
|
||||
##
|
||||
##
|
||||
## qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
## Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
##
|
||||
## qpOASES is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## qpOASES is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with qpOASES; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
=============
|
||||
|
||||
qpOASES is an open-source C++ implementation of the recently proposed
|
||||
online active set strategy (see [1], [2]), which was inspired by important
|
||||
observations from the field of parametric quadratic programming. It has
|
||||
several theoretical features that make it particularly suited for model
|
||||
predictive control (MPC) applications.
|
||||
|
||||
The software package qpOASES implements these ideas and has already been
|
||||
successfully used for closed-loop control of a real-world Diesel engine [3].
|
||||
|
||||
|
||||
References:
|
||||
|
||||
[1] H.J. Ferreau. An Online Active Set Strategy for Fast Solution of
|
||||
Parametric Quadratic Programs with Applications to Predictive Engine Control.
|
||||
Diplom thesis, University of Heidelberg, 2006.
|
||||
|
||||
[2] H.J. Ferreau, H.G. Bock, M. Diehl. An online active set strategy to
|
||||
overcome the limitations of explicit MPC. International Journal of Robust
|
||||
and Nonlinear Control, 18 (8), pp. 816-830, 2008.
|
||||
|
||||
[3] H.J. Ferreau, P. Ortner, P. Langthaler, L. del Re, M. Diehl. Predictive
|
||||
Control of a Real-World Diesel Engine using an Extended Online Active Set
|
||||
Strategy. Annual Reviews in Control, 31 (2), pp. 293-301, 2007.
|
||||
|
||||
|
||||
|
||||
GETTING STARTED
|
||||
================
|
||||
|
||||
1. For installation, usage and additional information on this software package
|
||||
see the qpOASES User's Manual located at ./DOC/manual.pdf!
|
||||
|
||||
|
||||
2. The file ./LICENSE.txt contains a copy of the GNU Lesser General Public
|
||||
License. Please read it carefully before using qpOASES!
|
||||
|
||||
|
||||
3. The whole software package can be downloaded from
|
||||
|
||||
http://homes.esat.kuleuven.be/~optec/software/qpOASES/
|
||||
|
||||
On this webpage you will also find a list of frequently asked questions.
|
||||
|
||||
|
||||
|
||||
CONTACT THE AUTHORS
|
||||
====================
|
||||
|
||||
If you have got questions, remarks or comments on qpOASES
|
||||
please contact the main author:
|
||||
|
||||
Hans Joachim Ferreau
|
||||
Katholieke Universiteit Leuven
|
||||
Department of Electrical Engineering (ESAT)
|
||||
Kasteelpark Arenberg 10, bus 2446
|
||||
B-3001 Leuven-Heverlee, Belgium
|
||||
|
||||
Phone: +32 16 32 03 63
|
||||
E-mail: joachim.ferreau@esat.kuleuven.be
|
||||
qpOASES@esat.kuleuven.be
|
||||
|
||||
Also bug reports and source code extensions are most welcome!
|
||||
|
||||
|
||||
|
||||
##
|
||||
## end of file
|
||||
##
|
||||
|
||||
+252
-252
@@ -1,252 +1,252 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Bounds.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the Bounds class designed to manage working sets of
|
||||
* bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#include <Bounds.hpp>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* B o u n d s
|
||||
*/
|
||||
Bounds::Bounds( ) : SubjectTo( ),
|
||||
nV( 0 ),
|
||||
nFV( 0 ),
|
||||
nBV( 0 ),
|
||||
nUV( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* B o u n d s
|
||||
*/
|
||||
Bounds::Bounds( const Bounds& rhs ) : SubjectTo( rhs ),
|
||||
nV( rhs.nV ),
|
||||
nFV( rhs.nFV ),
|
||||
nBV( rhs.nBV ),
|
||||
nUV( rhs.nUV )
|
||||
{
|
||||
free = rhs.free;
|
||||
fixed = rhs.fixed;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ B o u n d s
|
||||
*/
|
||||
Bounds::~Bounds( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
Bounds& Bounds::operator=( const Bounds& rhs )
|
||||
{
|
||||
if ( this != &rhs )
|
||||
{
|
||||
SubjectTo::operator=( rhs );
|
||||
|
||||
nV = rhs.nV;
|
||||
nFV = rhs.nFV;
|
||||
nBV = rhs.nBV;
|
||||
nUV = rhs.nUV;
|
||||
|
||||
free = rhs.free;
|
||||
fixed = rhs.fixed;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue Bounds::init( int n )
|
||||
{
|
||||
nV = n;
|
||||
nFV = 0;
|
||||
nBV = 0;
|
||||
nUV = 0;
|
||||
|
||||
free.init( );
|
||||
fixed.init( );
|
||||
|
||||
return SubjectTo::init( n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p B o u n d
|
||||
*/
|
||||
returnValue Bounds::setupBound( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Add bound index to respective index list. */
|
||||
switch ( _status )
|
||||
{
|
||||
case ST_INACTIVE:
|
||||
if ( this->addIndex( this->getFree( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
break;
|
||||
|
||||
case ST_LOWER:
|
||||
if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
break;
|
||||
|
||||
case ST_UPPER:
|
||||
if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
break;
|
||||
|
||||
default:
|
||||
return THROWERROR( RET_INVALID_ARGUMENTS );
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p A l l F r e e
|
||||
*/
|
||||
returnValue Bounds::setupAllFree( )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* 1) Place unbounded variables at the beginning of the index list of free variables. */
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_UNBOUNDED )
|
||||
{
|
||||
if ( setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Add remaining (i.e. bounded but possibly free) variables to the index list of free variables. */
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_BOUNDED )
|
||||
{
|
||||
if ( setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Place implicitly fixed variables at the end of the index list of free variables. */
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_EQUALITY )
|
||||
{
|
||||
if ( setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e F i x e d T o F r e e
|
||||
*/
|
||||
returnValue Bounds::moveFixedToFree( int _number )
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of fixed variables to that of free ones. */
|
||||
if ( this->removeIndex( this->getFixed( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getFree( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e F r e e T o F i x e d
|
||||
*/
|
||||
returnValue Bounds::moveFreeToFixed( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of free variables to that of fixed ones. */
|
||||
if ( this->removeIndex( this->getFree( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s w a p F r e e
|
||||
*/
|
||||
returnValue Bounds::swapFree( int number1, int number2
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( number1 < 0 ) || ( number1 >= getNV( ) ) || ( number2 < 0 ) || ( number2 >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Swap index within indexlist of free variables. */
|
||||
return this->swapIndex( this->getFree( ),number1,number2 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Bounds.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the Bounds class designed to manage working sets of
|
||||
* bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#include <Bounds.hpp>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* B o u n d s
|
||||
*/
|
||||
Bounds::Bounds( ) : SubjectTo( ),
|
||||
nV( 0 ),
|
||||
nFV( 0 ),
|
||||
nBV( 0 ),
|
||||
nUV( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* B o u n d s
|
||||
*/
|
||||
Bounds::Bounds( const Bounds& rhs ) : SubjectTo( rhs ),
|
||||
nV( rhs.nV ),
|
||||
nFV( rhs.nFV ),
|
||||
nBV( rhs.nBV ),
|
||||
nUV( rhs.nUV )
|
||||
{
|
||||
free = rhs.free;
|
||||
fixed = rhs.fixed;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ B o u n d s
|
||||
*/
|
||||
Bounds::~Bounds( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
Bounds& Bounds::operator=( const Bounds& rhs )
|
||||
{
|
||||
if ( this != &rhs )
|
||||
{
|
||||
SubjectTo::operator=( rhs );
|
||||
|
||||
nV = rhs.nV;
|
||||
nFV = rhs.nFV;
|
||||
nBV = rhs.nBV;
|
||||
nUV = rhs.nUV;
|
||||
|
||||
free = rhs.free;
|
||||
fixed = rhs.fixed;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue Bounds::init( int n )
|
||||
{
|
||||
nV = n;
|
||||
nFV = 0;
|
||||
nBV = 0;
|
||||
nUV = 0;
|
||||
|
||||
free.init( );
|
||||
fixed.init( );
|
||||
|
||||
return SubjectTo::init( n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p B o u n d
|
||||
*/
|
||||
returnValue Bounds::setupBound( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Add bound index to respective index list. */
|
||||
switch ( _status )
|
||||
{
|
||||
case ST_INACTIVE:
|
||||
if ( this->addIndex( this->getFree( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
break;
|
||||
|
||||
case ST_LOWER:
|
||||
if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
break;
|
||||
|
||||
case ST_UPPER:
|
||||
if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
break;
|
||||
|
||||
default:
|
||||
return THROWERROR( RET_INVALID_ARGUMENTS );
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p A l l F r e e
|
||||
*/
|
||||
returnValue Bounds::setupAllFree( )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* 1) Place unbounded variables at the beginning of the index list of free variables. */
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_UNBOUNDED )
|
||||
{
|
||||
if ( setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Add remaining (i.e. bounded but possibly free) variables to the index list of free variables. */
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_BOUNDED )
|
||||
{
|
||||
if ( setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Place implicitly fixed variables at the end of the index list of free variables. */
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_EQUALITY )
|
||||
{
|
||||
if ( setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_BOUND_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e F i x e d T o F r e e
|
||||
*/
|
||||
returnValue Bounds::moveFixedToFree( int _number )
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of fixed variables to that of free ones. */
|
||||
if ( this->removeIndex( this->getFixed( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getFree( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e F r e e T o F i x e d
|
||||
*/
|
||||
returnValue Bounds::moveFreeToFixed( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of free variables to that of fixed ones. */
|
||||
if ( this->removeIndex( this->getFree( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s w a p F r e e
|
||||
*/
|
||||
returnValue Bounds::swapFree( int number1, int number2
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( number1 < 0 ) || ( number1 >= getNV( ) ) || ( number2 < 0 ) || ( number2 >= getNV( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Swap index within indexlist of free variables. */
|
||||
return this->swapIndex( this->getFree( ),number1,number2 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+144
-144
@@ -1,144 +1,144 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Bounds.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the Bounds class designed
|
||||
* to manage working sets of bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t N V
|
||||
*/
|
||||
inline int Bounds::getNV( ) const
|
||||
{
|
||||
return nV;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F X
|
||||
*/
|
||||
inline int Bounds::getNFV( ) const
|
||||
{
|
||||
return nFV;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N B V
|
||||
*/
|
||||
inline int Bounds::getNBV( ) const
|
||||
{
|
||||
return nBV;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N U V
|
||||
*/
|
||||
inline int Bounds::getNUV( ) const
|
||||
{
|
||||
return nUV;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* s e t N F X
|
||||
*/
|
||||
inline returnValue Bounds::setNFV( int n )
|
||||
{
|
||||
nFV = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N B V
|
||||
*/
|
||||
inline returnValue Bounds::setNBV( int n )
|
||||
{
|
||||
nBV = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N U V
|
||||
*/
|
||||
inline returnValue Bounds::setNUV( int n )
|
||||
{
|
||||
nUV = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F R
|
||||
*/
|
||||
inline int Bounds::getNFR( )
|
||||
{
|
||||
return free.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F X
|
||||
*/
|
||||
inline int Bounds::getNFX( )
|
||||
{
|
||||
return fixed.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t F r e e
|
||||
*/
|
||||
inline Indexlist* Bounds::getFree( )
|
||||
{
|
||||
return &free;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t F i x e d
|
||||
*/
|
||||
inline Indexlist* Bounds::getFixed( )
|
||||
{
|
||||
return &fixed;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Bounds.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the Bounds class designed
|
||||
* to manage working sets of bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t N V
|
||||
*/
|
||||
inline int Bounds::getNV( ) const
|
||||
{
|
||||
return nV;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F X
|
||||
*/
|
||||
inline int Bounds::getNFV( ) const
|
||||
{
|
||||
return nFV;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N B V
|
||||
*/
|
||||
inline int Bounds::getNBV( ) const
|
||||
{
|
||||
return nBV;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N U V
|
||||
*/
|
||||
inline int Bounds::getNUV( ) const
|
||||
{
|
||||
return nUV;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* s e t N F X
|
||||
*/
|
||||
inline returnValue Bounds::setNFV( int n )
|
||||
{
|
||||
nFV = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N B V
|
||||
*/
|
||||
inline returnValue Bounds::setNBV( int n )
|
||||
{
|
||||
nBV = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N U V
|
||||
*/
|
||||
inline returnValue Bounds::setNUV( int n )
|
||||
{
|
||||
nUV = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F R
|
||||
*/
|
||||
inline int Bounds::getNFR( )
|
||||
{
|
||||
return free.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F X
|
||||
*/
|
||||
inline int Bounds::getNFX( )
|
||||
{
|
||||
return fixed.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t F r e e
|
||||
*/
|
||||
inline Indexlist* Bounds::getFree( )
|
||||
{
|
||||
return &free;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t F i x e d
|
||||
*/
|
||||
inline Indexlist* Bounds::getFixed( )
|
||||
{
|
||||
return &fixed;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,248 +1,248 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Constraints.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the Constraints class designed to manage working sets of
|
||||
* constraints within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#include <Constraints.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* C o n s t r a i n t s
|
||||
*/
|
||||
Constraints::Constraints( ) : SubjectTo( ),
|
||||
nC( 0 ),
|
||||
nEC( 0 ),
|
||||
nIC( 0 ),
|
||||
nUC( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* C o n s t r a i n t s
|
||||
*/
|
||||
Constraints::Constraints( const Constraints& rhs ) : SubjectTo( rhs ),
|
||||
nC( rhs.nC ),
|
||||
nEC( rhs.nEC ),
|
||||
nIC( rhs.nIC ),
|
||||
nUC( rhs.nUC )
|
||||
{
|
||||
active = rhs.active;
|
||||
inactive = rhs.inactive;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ C o n s t r a i n t s
|
||||
*/
|
||||
Constraints::~Constraints( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
Constraints& Constraints::operator=( const Constraints& rhs )
|
||||
{
|
||||
if ( this != &rhs )
|
||||
{
|
||||
SubjectTo::operator=( rhs );
|
||||
|
||||
nC = rhs.nC;
|
||||
nEC = rhs.nEC;
|
||||
nIC = rhs.nIC;
|
||||
nUC = rhs.nUC;
|
||||
|
||||
active = rhs.active;
|
||||
inactive = rhs.inactive;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue Constraints::init( int n )
|
||||
{
|
||||
nC = n;
|
||||
nEC = 0;
|
||||
nIC = 0;
|
||||
nUC = 0;
|
||||
|
||||
active.init( );
|
||||
inactive.init( );
|
||||
|
||||
return SubjectTo::init( n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p C o n s t r a i n t
|
||||
*/
|
||||
returnValue Constraints::setupConstraint( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNC( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Add constraint index to respective index list. */
|
||||
switch ( _status )
|
||||
{
|
||||
case ST_INACTIVE:
|
||||
if ( this->addIndex( this->getInactive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
break;
|
||||
|
||||
case ST_LOWER:
|
||||
if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
break;
|
||||
|
||||
case ST_UPPER:
|
||||
if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
break;
|
||||
|
||||
default:
|
||||
return THROWERROR( RET_INVALID_ARGUMENTS );
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p A l l I n a c t i v e
|
||||
*/
|
||||
returnValue Constraints::setupAllInactive( )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
/* 1) Place unbounded constraints at the beginning of the index list of inactive constraints. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_UNBOUNDED )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Add remaining (i.e. "real" inequality) constraints to the index list of inactive constraints. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_BOUNDED )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Place implicit equality constraints at the end of the index list of inactive constraints. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_EQUALITY )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 4) Moreover, add all constraints of unknown type. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_UNKNOWN )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e A c t i v e T o I n a c t i v e
|
||||
*/
|
||||
returnValue Constraints::moveActiveToInactive( int _number )
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNC( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of active constraints to that of inactive ones. */
|
||||
if ( this->removeIndex( this->getActive( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getInactive( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e I n a c t i v e T o A c t i v e
|
||||
*/
|
||||
returnValue Constraints::moveInactiveToActive( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNC( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of inactive constraints to that of active ones. */
|
||||
if ( this->removeIndex( this->getInactive( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Constraints.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the Constraints class designed to manage working sets of
|
||||
* constraints within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#include <Constraints.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* C o n s t r a i n t s
|
||||
*/
|
||||
Constraints::Constraints( ) : SubjectTo( ),
|
||||
nC( 0 ),
|
||||
nEC( 0 ),
|
||||
nIC( 0 ),
|
||||
nUC( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* C o n s t r a i n t s
|
||||
*/
|
||||
Constraints::Constraints( const Constraints& rhs ) : SubjectTo( rhs ),
|
||||
nC( rhs.nC ),
|
||||
nEC( rhs.nEC ),
|
||||
nIC( rhs.nIC ),
|
||||
nUC( rhs.nUC )
|
||||
{
|
||||
active = rhs.active;
|
||||
inactive = rhs.inactive;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ C o n s t r a i n t s
|
||||
*/
|
||||
Constraints::~Constraints( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
Constraints& Constraints::operator=( const Constraints& rhs )
|
||||
{
|
||||
if ( this != &rhs )
|
||||
{
|
||||
SubjectTo::operator=( rhs );
|
||||
|
||||
nC = rhs.nC;
|
||||
nEC = rhs.nEC;
|
||||
nIC = rhs.nIC;
|
||||
nUC = rhs.nUC;
|
||||
|
||||
active = rhs.active;
|
||||
inactive = rhs.inactive;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue Constraints::init( int n )
|
||||
{
|
||||
nC = n;
|
||||
nEC = 0;
|
||||
nIC = 0;
|
||||
nUC = 0;
|
||||
|
||||
active.init( );
|
||||
inactive.init( );
|
||||
|
||||
return SubjectTo::init( n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p C o n s t r a i n t
|
||||
*/
|
||||
returnValue Constraints::setupConstraint( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNC( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Add constraint index to respective index list. */
|
||||
switch ( _status )
|
||||
{
|
||||
case ST_INACTIVE:
|
||||
if ( this->addIndex( this->getInactive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
break;
|
||||
|
||||
case ST_LOWER:
|
||||
if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
break;
|
||||
|
||||
case ST_UPPER:
|
||||
if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
break;
|
||||
|
||||
default:
|
||||
return THROWERROR( RET_INVALID_ARGUMENTS );
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t u p A l l I n a c t i v e
|
||||
*/
|
||||
returnValue Constraints::setupAllInactive( )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
/* 1) Place unbounded constraints at the beginning of the index list of inactive constraints. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_UNBOUNDED )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Add remaining (i.e. "real" inequality) constraints to the index list of inactive constraints. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_BOUNDED )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Place implicit equality constraints at the end of the index list of inactive constraints. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_EQUALITY )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
/* 4) Moreover, add all constraints of unknown type. */
|
||||
for( i=0; i<nC; ++i )
|
||||
{
|
||||
if ( getType( i ) == ST_UNKNOWN )
|
||||
{
|
||||
if ( setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e A c t i v e T o I n a c t i v e
|
||||
*/
|
||||
returnValue Constraints::moveActiveToInactive( int _number )
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNC( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of active constraints to that of inactive ones. */
|
||||
if ( this->removeIndex( this->getActive( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getInactive( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m o v e I n a c t i v e T o A c t i v e
|
||||
*/
|
||||
returnValue Constraints::moveInactiveToActive( int _number, SubjectToStatus _status
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( _number < 0 ) || ( _number >= getNC( ) ) )
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
|
||||
/* Move index from indexlist of inactive constraints to that of active ones. */
|
||||
if ( this->removeIndex( this->getInactive( ),_number ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_MOVING_BOUND_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,144 +1,144 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Constraints.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of inlined member functions of the Constraints class designed
|
||||
* to manage working sets of constraints within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t N C
|
||||
*/
|
||||
inline int Constraints::getNC( ) const
|
||||
{
|
||||
return nC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N E C
|
||||
*/
|
||||
inline int Constraints::getNEC( ) const
|
||||
{
|
||||
return nEC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I C
|
||||
*/
|
||||
inline int Constraints::getNIC( ) const
|
||||
{
|
||||
return nIC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N U C
|
||||
*/
|
||||
inline int Constraints::getNUC( ) const
|
||||
{
|
||||
return nUC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N E C
|
||||
*/
|
||||
inline returnValue Constraints::setNEC( int n )
|
||||
{
|
||||
nEC = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N I C
|
||||
*/
|
||||
inline returnValue Constraints::setNIC( int n )
|
||||
{
|
||||
nIC = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N U C
|
||||
*/
|
||||
inline returnValue Constraints::setNUC( int n )
|
||||
{
|
||||
nUC = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N A C
|
||||
*/
|
||||
inline int Constraints::getNAC( )
|
||||
{
|
||||
return active.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I A C
|
||||
*/
|
||||
inline int Constraints::getNIAC( )
|
||||
{
|
||||
return inactive.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t A c t i v e
|
||||
*/
|
||||
inline Indexlist* Constraints::getActive( )
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n a c t i v e
|
||||
*/
|
||||
inline Indexlist* Constraints::getInactive( )
|
||||
{
|
||||
return &inactive;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Constraints.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Declaration of inlined member functions of the Constraints class designed
|
||||
* to manage working sets of constraints within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t N C
|
||||
*/
|
||||
inline int Constraints::getNC( ) const
|
||||
{
|
||||
return nC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N E C
|
||||
*/
|
||||
inline int Constraints::getNEC( ) const
|
||||
{
|
||||
return nEC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I C
|
||||
*/
|
||||
inline int Constraints::getNIC( ) const
|
||||
{
|
||||
return nIC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N U C
|
||||
*/
|
||||
inline int Constraints::getNUC( ) const
|
||||
{
|
||||
return nUC;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N E C
|
||||
*/
|
||||
inline returnValue Constraints::setNEC( int n )
|
||||
{
|
||||
nEC = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N I C
|
||||
*/
|
||||
inline returnValue Constraints::setNIC( int n )
|
||||
{
|
||||
nIC = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N U C
|
||||
*/
|
||||
inline returnValue Constraints::setNUC( int n )
|
||||
{
|
||||
nUC = n;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N A C
|
||||
*/
|
||||
inline int Constraints::getNAC( )
|
||||
{
|
||||
return active.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I A C
|
||||
*/
|
||||
inline int Constraints::getNIAC( )
|
||||
{
|
||||
return inactive.getLength( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t A c t i v e
|
||||
*/
|
||||
inline Indexlist* Constraints::getActive( )
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n a c t i v e
|
||||
*/
|
||||
inline Indexlist* Constraints::getInactive( )
|
||||
{
|
||||
return &inactive;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,188 +1,188 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/CyclingManager.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the CyclingManager class designed to detect
|
||||
* and handle possible cycling during QP iterations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <CyclingManager.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* C y c l i n g M a n a g e r
|
||||
*/
|
||||
CyclingManager::CyclingManager( ) : nV( 0 ),
|
||||
nC( 0 )
|
||||
{
|
||||
cyclingDetected = BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* C y c l i n g M a n a g e r
|
||||
*/
|
||||
CyclingManager::CyclingManager( const CyclingManager& rhs ) : nV( rhs.nV ),
|
||||
nC( rhs.nC ),
|
||||
cyclingDetected( rhs.cyclingDetected )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<nV+nC; ++i )
|
||||
status[i] = rhs.status[i];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ C y c l i n g M a n a g e r
|
||||
*/
|
||||
CyclingManager::~CyclingManager( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
CyclingManager& CyclingManager::operator=( const CyclingManager& rhs )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( this != &rhs )
|
||||
{
|
||||
nV = rhs.nV;
|
||||
nC = rhs.nC;
|
||||
|
||||
for( i=0; i<nV+nC; ++i )
|
||||
status[i] = rhs.status[i];
|
||||
|
||||
cyclingDetected = rhs.cyclingDetected;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue CyclingManager::init( int _nV, int _nC )
|
||||
{
|
||||
nV = _nV;
|
||||
nC = _nC;
|
||||
|
||||
cyclingDetected = BT_FALSE;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* s e t C y c l i n g S t a t u s
|
||||
*/
|
||||
returnValue CyclingManager::setCyclingStatus( int number,
|
||||
BooleanType isBound, CyclingStatus _status
|
||||
)
|
||||
{
|
||||
if ( isBound == BT_TRUE )
|
||||
{
|
||||
/* Set cycling status of a bound. */
|
||||
if ( ( number >= 0 ) && ( number < nV ) )
|
||||
{
|
||||
status[number] = _status;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set cycling status of a constraint. */
|
||||
if ( ( number >= 0 ) && ( number < nC ) )
|
||||
{
|
||||
status[nV+number] = _status;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t C y c l i n g S t a t u s
|
||||
*/
|
||||
CyclingStatus CyclingManager::getCyclingStatus( int number, BooleanType isBound ) const
|
||||
{
|
||||
if ( isBound == BT_TRUE )
|
||||
{
|
||||
/* Return cycling status of a bound. */
|
||||
if ( ( number >= 0 ) && ( number < nV ) )
|
||||
return status[number];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Return cycling status of a constraint. */
|
||||
if ( ( number >= 0 ) && ( number < nC ) )
|
||||
return status[nV+number];
|
||||
}
|
||||
|
||||
return CYC_NOT_INVOLVED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* c l e a r C y c l i n g D a t a
|
||||
*/
|
||||
returnValue CyclingManager::clearCyclingData( )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Reset all status values ... */
|
||||
for( i=0; i<nV+nC; ++i )
|
||||
status[i] = CYC_NOT_INVOLVED;
|
||||
|
||||
/* ... and the main cycling flag. */
|
||||
cyclingDetected = BT_FALSE;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/CyclingManager.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the CyclingManager class designed to detect
|
||||
* and handle possible cycling during QP iterations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <CyclingManager.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* C y c l i n g M a n a g e r
|
||||
*/
|
||||
CyclingManager::CyclingManager( ) : nV( 0 ),
|
||||
nC( 0 )
|
||||
{
|
||||
cyclingDetected = BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* C y c l i n g M a n a g e r
|
||||
*/
|
||||
CyclingManager::CyclingManager( const CyclingManager& rhs ) : nV( rhs.nV ),
|
||||
nC( rhs.nC ),
|
||||
cyclingDetected( rhs.cyclingDetected )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<nV+nC; ++i )
|
||||
status[i] = rhs.status[i];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ C y c l i n g M a n a g e r
|
||||
*/
|
||||
CyclingManager::~CyclingManager( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
CyclingManager& CyclingManager::operator=( const CyclingManager& rhs )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( this != &rhs )
|
||||
{
|
||||
nV = rhs.nV;
|
||||
nC = rhs.nC;
|
||||
|
||||
for( i=0; i<nV+nC; ++i )
|
||||
status[i] = rhs.status[i];
|
||||
|
||||
cyclingDetected = rhs.cyclingDetected;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue CyclingManager::init( int _nV, int _nC )
|
||||
{
|
||||
nV = _nV;
|
||||
nC = _nC;
|
||||
|
||||
cyclingDetected = BT_FALSE;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* s e t C y c l i n g S t a t u s
|
||||
*/
|
||||
returnValue CyclingManager::setCyclingStatus( int number,
|
||||
BooleanType isBound, CyclingStatus _status
|
||||
)
|
||||
{
|
||||
if ( isBound == BT_TRUE )
|
||||
{
|
||||
/* Set cycling status of a bound. */
|
||||
if ( ( number >= 0 ) && ( number < nV ) )
|
||||
{
|
||||
status[number] = _status;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set cycling status of a constraint. */
|
||||
if ( ( number >= 0 ) && ( number < nC ) )
|
||||
{
|
||||
status[nV+number] = _status;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t C y c l i n g S t a t u s
|
||||
*/
|
||||
CyclingStatus CyclingManager::getCyclingStatus( int number, BooleanType isBound ) const
|
||||
{
|
||||
if ( isBound == BT_TRUE )
|
||||
{
|
||||
/* Return cycling status of a bound. */
|
||||
if ( ( number >= 0 ) && ( number < nV ) )
|
||||
return status[number];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Return cycling status of a constraint. */
|
||||
if ( ( number >= 0 ) && ( number < nC ) )
|
||||
return status[nV+number];
|
||||
}
|
||||
|
||||
return CYC_NOT_INVOLVED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* c l e a r C y c l i n g D a t a
|
||||
*/
|
||||
returnValue CyclingManager::clearCyclingData( )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Reset all status values ... */
|
||||
for( i=0; i<nV+nC; ++i )
|
||||
status[i] = CYC_NOT_INVOLVED;
|
||||
|
||||
/* ... and the main cycling flag. */
|
||||
cyclingDetected = BT_FALSE;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/CyclingManager.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the CyclingManager class
|
||||
* designed to detect and handle possible cycling during QP iterations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* i s C y c l i n g D e t e c t e d
|
||||
*/
|
||||
inline BooleanType CyclingManager::isCyclingDetected( ) const
|
||||
{
|
||||
return cyclingDetected;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/CyclingManager.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the CyclingManager class
|
||||
* designed to detect and handle possible cycling during QP iterations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* i s C y c l i n g D e t e c t e d
|
||||
*/
|
||||
inline BooleanType CyclingManager::isCyclingDetected( ) const
|
||||
{
|
||||
return cyclingDetected;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+342
-342
@@ -1,342 +1,342 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Indexlist.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the Indexlist class designed to manage index lists of
|
||||
* constraints and bounds within a QProblem_SubjectTo.
|
||||
*/
|
||||
|
||||
|
||||
#include <Indexlist.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* I n d e x l i s t
|
||||
*/
|
||||
Indexlist::Indexlist( ) : length( 0 ),
|
||||
first( -1 ),
|
||||
last( -1 ),
|
||||
lastusedindex( -1 ),
|
||||
physicallength( INDEXLISTFACTOR*(NVMAX+NCMAX) )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* I n d e x l i s t
|
||||
*/
|
||||
Indexlist::Indexlist( const Indexlist& rhs ) : length( rhs.length ),
|
||||
first( rhs.first ),
|
||||
last( rhs.last ),
|
||||
lastusedindex( rhs.lastusedindex ),
|
||||
physicallength( rhs.physicallength )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = rhs.number[i];
|
||||
next[i] = rhs.next[i];
|
||||
previous[i] = rhs.previous[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ I n d e x l i s t
|
||||
*/
|
||||
Indexlist::~Indexlist( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
Indexlist& Indexlist::operator=( const Indexlist& rhs )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( this != &rhs )
|
||||
{
|
||||
length = rhs.length;
|
||||
first = rhs.first;
|
||||
last = rhs.last;
|
||||
lastusedindex = rhs.lastusedindex;
|
||||
physicallength = rhs.physicallength;
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = rhs.number[i];
|
||||
next[i] = rhs.next[i];
|
||||
previous[i] = rhs.previous[i];
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue Indexlist::init( )
|
||||
{
|
||||
int i;
|
||||
|
||||
length = 0;
|
||||
first = -1;
|
||||
last = -1;
|
||||
lastusedindex = -1;
|
||||
physicallength = INDEXLISTFACTOR*(NVMAX+NCMAX);
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N u m b e r A r r a y
|
||||
*/
|
||||
returnValue Indexlist::getNumberArray( int* const numberarray ) const
|
||||
{
|
||||
int i;
|
||||
int n = first;
|
||||
|
||||
/* Run trough indexlist and store numbers in numberarray. */
|
||||
for( i=0; i<length; ++i )
|
||||
{
|
||||
if ( ( n >= 0 ) && ( number[n] >= 0 ) )
|
||||
numberarray[i] = number[n];
|
||||
else
|
||||
return THROWERROR( RET_INDEXLIST_CORRUPTED );
|
||||
|
||||
n = next[n];
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n d e x
|
||||
*/
|
||||
int Indexlist::getIndex( int givennumber ) const
|
||||
{
|
||||
int i;
|
||||
int n = first;
|
||||
int index = -1; /* return -1 by default */
|
||||
|
||||
/* Run trough indexlist until number is found, if so return it index. */
|
||||
for ( i=0; i<length; ++i )
|
||||
{
|
||||
if ( number[n] == givennumber )
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
n = next[n];
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t P h y s i c a l I n d e x
|
||||
*/
|
||||
int Indexlist::getPhysicalIndex( int givennumber ) const
|
||||
{
|
||||
int i;
|
||||
int n = first;
|
||||
int index = -1; /* return -1 by default */
|
||||
|
||||
/* Run trough indexlist until number is found, if so return it physicalindex. */
|
||||
for ( i=0; i<length; ++i )
|
||||
{
|
||||
if ( number[n] == givennumber )
|
||||
{
|
||||
index = n;
|
||||
break;
|
||||
}
|
||||
|
||||
n = next[n];
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* a d d N u m b e r
|
||||
*/
|
||||
returnValue Indexlist::addNumber( int addnumber )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( lastusedindex+1 < physicallength )
|
||||
{
|
||||
/* If there is enough storage, add number to indexlist. */
|
||||
++lastusedindex;
|
||||
number[lastusedindex] = addnumber;
|
||||
next[lastusedindex] = 0;
|
||||
|
||||
if ( length == 0 )
|
||||
{
|
||||
first = lastusedindex;
|
||||
previous[lastusedindex] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
next[last] = lastusedindex;
|
||||
previous[lastusedindex] = last;
|
||||
}
|
||||
|
||||
last = lastusedindex;
|
||||
++length;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Rearrangement of index list necessary! */
|
||||
if ( length == physicallength )
|
||||
return THROWERROR( RET_INDEXLIST_EXCEEDS_MAX_LENGTH );
|
||||
else
|
||||
{
|
||||
int numberArray[NVMAX+NCMAX];
|
||||
getNumberArray( numberArray );
|
||||
|
||||
/* copy existing elements */
|
||||
for ( i=0; i<length; ++i )
|
||||
{
|
||||
number[i] = numberArray[i];
|
||||
next[i] = i+1;
|
||||
previous[i] = i-1;
|
||||
}
|
||||
|
||||
/* add new number at end of list */
|
||||
number[length] = addnumber;
|
||||
next[length] = -1;
|
||||
previous[length] = length-1;
|
||||
|
||||
/* and set remaining entries to empty */
|
||||
for ( i=length+1; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
}
|
||||
|
||||
first = 0;
|
||||
last = length;
|
||||
lastusedindex = length;
|
||||
++length;
|
||||
|
||||
return THROWWARNING( RET_INDEXLIST_MUST_BE_REORDERD );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e m o v e N u m b e r
|
||||
*/
|
||||
returnValue Indexlist::removeNumber( int removenumber )
|
||||
{
|
||||
int i = getPhysicalIndex( removenumber );
|
||||
|
||||
/* nothing to be done if number is not contained in index set */
|
||||
if ( i < 0 )
|
||||
return SUCCESSFUL_RETURN;
|
||||
|
||||
int p = previous[i];
|
||||
int n = next[i];
|
||||
|
||||
if ( i == last )
|
||||
last = p;
|
||||
else
|
||||
previous[n] = p;
|
||||
|
||||
if ( i == first )
|
||||
first = n;
|
||||
else
|
||||
next[p] = n;
|
||||
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
--length;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s w a p N u m b e r s
|
||||
*/
|
||||
returnValue Indexlist::swapNumbers( int number1, int number2 )
|
||||
{
|
||||
int index1 = getPhysicalIndex( number1 );
|
||||
int index2 = getPhysicalIndex( number2 );
|
||||
|
||||
/* consistency check */
|
||||
if ( ( index1 < 0 ) || ( index2 < 0 ) )
|
||||
return THROWERROR( RET_INDEXLIST_CORRUPTED );
|
||||
|
||||
int tmp = number[index1];
|
||||
number[index1] = number[index2];
|
||||
number[index2] = tmp;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Indexlist.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the Indexlist class designed to manage index lists of
|
||||
* constraints and bounds within a QProblem_SubjectTo.
|
||||
*/
|
||||
|
||||
|
||||
#include <Indexlist.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* I n d e x l i s t
|
||||
*/
|
||||
Indexlist::Indexlist( ) : length( 0 ),
|
||||
first( -1 ),
|
||||
last( -1 ),
|
||||
lastusedindex( -1 ),
|
||||
physicallength( INDEXLISTFACTOR*(NVMAX+NCMAX) )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* I n d e x l i s t
|
||||
*/
|
||||
Indexlist::Indexlist( const Indexlist& rhs ) : length( rhs.length ),
|
||||
first( rhs.first ),
|
||||
last( rhs.last ),
|
||||
lastusedindex( rhs.lastusedindex ),
|
||||
physicallength( rhs.physicallength )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = rhs.number[i];
|
||||
next[i] = rhs.next[i];
|
||||
previous[i] = rhs.previous[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ I n d e x l i s t
|
||||
*/
|
||||
Indexlist::~Indexlist( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
Indexlist& Indexlist::operator=( const Indexlist& rhs )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( this != &rhs )
|
||||
{
|
||||
length = rhs.length;
|
||||
first = rhs.first;
|
||||
last = rhs.last;
|
||||
lastusedindex = rhs.lastusedindex;
|
||||
physicallength = rhs.physicallength;
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = rhs.number[i];
|
||||
next[i] = rhs.next[i];
|
||||
previous[i] = rhs.previous[i];
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue Indexlist::init( )
|
||||
{
|
||||
int i;
|
||||
|
||||
length = 0;
|
||||
first = -1;
|
||||
last = -1;
|
||||
lastusedindex = -1;
|
||||
physicallength = INDEXLISTFACTOR*(NVMAX+NCMAX);
|
||||
|
||||
for( i=0; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N u m b e r A r r a y
|
||||
*/
|
||||
returnValue Indexlist::getNumberArray( int* const numberarray ) const
|
||||
{
|
||||
int i;
|
||||
int n = first;
|
||||
|
||||
/* Run trough indexlist and store numbers in numberarray. */
|
||||
for( i=0; i<length; ++i )
|
||||
{
|
||||
if ( ( n >= 0 ) && ( number[n] >= 0 ) )
|
||||
numberarray[i] = number[n];
|
||||
else
|
||||
return THROWERROR( RET_INDEXLIST_CORRUPTED );
|
||||
|
||||
n = next[n];
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n d e x
|
||||
*/
|
||||
int Indexlist::getIndex( int givennumber ) const
|
||||
{
|
||||
int i;
|
||||
int n = first;
|
||||
int index = -1; /* return -1 by default */
|
||||
|
||||
/* Run trough indexlist until number is found, if so return it index. */
|
||||
for ( i=0; i<length; ++i )
|
||||
{
|
||||
if ( number[n] == givennumber )
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
n = next[n];
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t P h y s i c a l I n d e x
|
||||
*/
|
||||
int Indexlist::getPhysicalIndex( int givennumber ) const
|
||||
{
|
||||
int i;
|
||||
int n = first;
|
||||
int index = -1; /* return -1 by default */
|
||||
|
||||
/* Run trough indexlist until number is found, if so return it physicalindex. */
|
||||
for ( i=0; i<length; ++i )
|
||||
{
|
||||
if ( number[n] == givennumber )
|
||||
{
|
||||
index = n;
|
||||
break;
|
||||
}
|
||||
|
||||
n = next[n];
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* a d d N u m b e r
|
||||
*/
|
||||
returnValue Indexlist::addNumber( int addnumber )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( lastusedindex+1 < physicallength )
|
||||
{
|
||||
/* If there is enough storage, add number to indexlist. */
|
||||
++lastusedindex;
|
||||
number[lastusedindex] = addnumber;
|
||||
next[lastusedindex] = 0;
|
||||
|
||||
if ( length == 0 )
|
||||
{
|
||||
first = lastusedindex;
|
||||
previous[lastusedindex] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
next[last] = lastusedindex;
|
||||
previous[lastusedindex] = last;
|
||||
}
|
||||
|
||||
last = lastusedindex;
|
||||
++length;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Rearrangement of index list necessary! */
|
||||
if ( length == physicallength )
|
||||
return THROWERROR( RET_INDEXLIST_EXCEEDS_MAX_LENGTH );
|
||||
else
|
||||
{
|
||||
int numberArray[NVMAX+NCMAX];
|
||||
getNumberArray( numberArray );
|
||||
|
||||
/* copy existing elements */
|
||||
for ( i=0; i<length; ++i )
|
||||
{
|
||||
number[i] = numberArray[i];
|
||||
next[i] = i+1;
|
||||
previous[i] = i-1;
|
||||
}
|
||||
|
||||
/* add new number at end of list */
|
||||
number[length] = addnumber;
|
||||
next[length] = -1;
|
||||
previous[length] = length-1;
|
||||
|
||||
/* and set remaining entries to empty */
|
||||
for ( i=length+1; i<physicallength; ++i )
|
||||
{
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
}
|
||||
|
||||
first = 0;
|
||||
last = length;
|
||||
lastusedindex = length;
|
||||
++length;
|
||||
|
||||
return THROWWARNING( RET_INDEXLIST_MUST_BE_REORDERD );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e m o v e N u m b e r
|
||||
*/
|
||||
returnValue Indexlist::removeNumber( int removenumber )
|
||||
{
|
||||
int i = getPhysicalIndex( removenumber );
|
||||
|
||||
/* nothing to be done if number is not contained in index set */
|
||||
if ( i < 0 )
|
||||
return SUCCESSFUL_RETURN;
|
||||
|
||||
int p = previous[i];
|
||||
int n = next[i];
|
||||
|
||||
if ( i == last )
|
||||
last = p;
|
||||
else
|
||||
previous[n] = p;
|
||||
|
||||
if ( i == first )
|
||||
first = n;
|
||||
else
|
||||
next[p] = n;
|
||||
|
||||
number[i] = -1;
|
||||
next[i] = -1;
|
||||
previous[i] = -1;
|
||||
--length;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s w a p N u m b e r s
|
||||
*/
|
||||
returnValue Indexlist::swapNumbers( int number1, int number2 )
|
||||
{
|
||||
int index1 = getPhysicalIndex( number1 );
|
||||
int index2 = getPhysicalIndex( number2 );
|
||||
|
||||
/* consistency check */
|
||||
if ( ( index1 < 0 ) || ( index2 < 0 ) )
|
||||
return THROWERROR( RET_INDEXLIST_CORRUPTED );
|
||||
|
||||
int tmp = number[index1];
|
||||
number[index1] = number[index2];
|
||||
number[index2] = tmp;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,85 +1,85 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Indexlist.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the Indexlist class designed
|
||||
* to manage index lists of constraints and bounds within a QProblem_SubjectTo.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t N u m b e r
|
||||
*/
|
||||
inline int Indexlist::getNumber( int physicalindex ) const
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( physicalindex < 0 ) || ( physicalindex > length ) )
|
||||
return -RET_INDEXLIST_OUTOFBOUNDS;
|
||||
|
||||
return number[physicalindex];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L e n g t h
|
||||
*/
|
||||
inline int Indexlist::getLength( )
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L a s t N u m b e r
|
||||
*/
|
||||
inline int Indexlist::getLastNumber( ) const
|
||||
{
|
||||
return number[last];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L a s t N u m b e r
|
||||
*/
|
||||
inline BooleanType Indexlist::isMember( int _number ) const
|
||||
{
|
||||
if ( getIndex( _number ) >= 0 )
|
||||
return BT_TRUE;
|
||||
else
|
||||
return BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Indexlist.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the Indexlist class designed
|
||||
* to manage index lists of constraints and bounds within a QProblem_SubjectTo.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t N u m b e r
|
||||
*/
|
||||
inline int Indexlist::getNumber( int physicalindex ) const
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( physicalindex < 0 ) || ( physicalindex > length ) )
|
||||
return -RET_INDEXLIST_OUTOFBOUNDS;
|
||||
|
||||
return number[physicalindex];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L e n g t h
|
||||
*/
|
||||
inline int Indexlist::getLength( )
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L a s t N u m b e r
|
||||
*/
|
||||
inline int Indexlist::getLastNumber( ) const
|
||||
{
|
||||
return number[last];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L a s t N u m b e r
|
||||
*/
|
||||
inline BooleanType Indexlist::isMember( int _number ) const
|
||||
{
|
||||
if ( getIndex( _number ) >= 0 )
|
||||
return BT_TRUE;
|
||||
else
|
||||
return BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,137 +1,137 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/MessageHandling.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the MessageHandling class.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t E r r o r V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline VisibilityStatus MessageHandling::getErrorVisibilityStatus( ) const
|
||||
{
|
||||
return errorVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t W a r n i n g V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline VisibilityStatus MessageHandling::getWarningVisibilityStatus( ) const
|
||||
{
|
||||
return warningVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n f o V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline VisibilityStatus MessageHandling::getInfoVisibilityStatus( ) const
|
||||
{
|
||||
return infoVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t O u t p u t F i l e
|
||||
*/
|
||||
inline myFILE* MessageHandling::getOutputFile( ) const
|
||||
{
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t E r r o r C o u n t
|
||||
*/
|
||||
inline int MessageHandling::getErrorCount( ) const
|
||||
{
|
||||
return errorCount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t E r r o r V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline void MessageHandling::setErrorVisibilityStatus( VisibilityStatus _errorVisibility )
|
||||
{
|
||||
errorVisibility = _errorVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t W a r n i n g V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline void MessageHandling::setWarningVisibilityStatus( VisibilityStatus _warningVisibility )
|
||||
{
|
||||
warningVisibility = _warningVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t I n f o V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline void MessageHandling::setInfoVisibilityStatus( VisibilityStatus _infoVisibility )
|
||||
{
|
||||
infoVisibility = _infoVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t O u t p u t F i l e
|
||||
*/
|
||||
inline void MessageHandling::setOutputFile( myFILE* _outputFile )
|
||||
{
|
||||
outputFile = _outputFile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t E r r o r C o u n t
|
||||
*/
|
||||
inline returnValue MessageHandling::setErrorCount( int _errorCount )
|
||||
{
|
||||
if ( _errorCount >= 0 )
|
||||
{
|
||||
errorCount = _errorCount;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return RET_INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/MessageHandling.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the MessageHandling class.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t E r r o r V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline VisibilityStatus MessageHandling::getErrorVisibilityStatus( ) const
|
||||
{
|
||||
return errorVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t W a r n i n g V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline VisibilityStatus MessageHandling::getWarningVisibilityStatus( ) const
|
||||
{
|
||||
return warningVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n f o V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline VisibilityStatus MessageHandling::getInfoVisibilityStatus( ) const
|
||||
{
|
||||
return infoVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t O u t p u t F i l e
|
||||
*/
|
||||
inline myFILE* MessageHandling::getOutputFile( ) const
|
||||
{
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t E r r o r C o u n t
|
||||
*/
|
||||
inline int MessageHandling::getErrorCount( ) const
|
||||
{
|
||||
return errorCount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t E r r o r V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline void MessageHandling::setErrorVisibilityStatus( VisibilityStatus _errorVisibility )
|
||||
{
|
||||
errorVisibility = _errorVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t W a r n i n g V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline void MessageHandling::setWarningVisibilityStatus( VisibilityStatus _warningVisibility )
|
||||
{
|
||||
warningVisibility = _warningVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t I n f o V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
inline void MessageHandling::setInfoVisibilityStatus( VisibilityStatus _infoVisibility )
|
||||
{
|
||||
infoVisibility = _infoVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t O u t p u t F i l e
|
||||
*/
|
||||
inline void MessageHandling::setOutputFile( myFILE* _outputFile )
|
||||
{
|
||||
outputFile = _outputFile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t E r r o r C o u n t
|
||||
*/
|
||||
inline returnValue MessageHandling::setErrorCount( int _errorCount )
|
||||
{
|
||||
if ( _errorCount >= 0 )
|
||||
{
|
||||
errorCount = _errorCount;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return RET_INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+3867
-3867
File diff suppressed because it is too large
Load Diff
+299
-299
@@ -1,299 +1,299 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/QProblem.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the QProblem class which
|
||||
* is able to use the newly developed online active set strategy for
|
||||
* parametric quadratic programming.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t A
|
||||
*/
|
||||
inline returnValue QProblem::getA( real_t* const _A ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( )*getNC( ); ++i )
|
||||
_A[i] = A[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t A
|
||||
*/
|
||||
inline returnValue QProblem::getA( int number, real_t* const row ) const
|
||||
{
|
||||
int nV = getNV( );
|
||||
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
for ( int i=0; i<nV; ++i )
|
||||
row[i] = A[number*NVMAX + i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::getLBA( real_t* const _lbA ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNC( ); ++i )
|
||||
_lbA[i] = lbA[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::getLBA( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
value = lbA[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::getUBA( real_t* const _ubA ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNC( ); ++i )
|
||||
_ubA[i] = ubA[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::getUBA( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
value = ubA[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t C o n s t r a i n t s
|
||||
*/
|
||||
inline returnValue QProblem::getConstraints( Constraints* const _constraints ) const
|
||||
{
|
||||
*_constraints = constraints;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t N C
|
||||
*/
|
||||
inline int QProblem::getNC( ) const
|
||||
{
|
||||
return constraints.getNC( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N E C
|
||||
*/
|
||||
inline int QProblem::getNEC( ) const
|
||||
{
|
||||
return constraints.getNEC( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N A C
|
||||
*/
|
||||
inline int QProblem::getNAC( )
|
||||
{
|
||||
return constraints.getNAC( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I A C
|
||||
*/
|
||||
inline int QProblem::getNIAC( )
|
||||
{
|
||||
return constraints.getNIAC( );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P R O T E C T E D *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* s e t A
|
||||
*/
|
||||
inline returnValue QProblem::setA( const real_t* const A_new )
|
||||
{
|
||||
int i, j;
|
||||
int nV = getNV( );
|
||||
int nC = getNC( );
|
||||
|
||||
/* Set constraint matrix AND update member AX. */
|
||||
for( j=0; j<nC; ++j )
|
||||
{
|
||||
Ax[j] = 0.0;
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
A[j*NVMAX + i] = A_new[j*nV + i];
|
||||
Ax[j] += A[j*NVMAX + i] * x[i];
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t A
|
||||
*/
|
||||
inline returnValue QProblem::setA( int number, const real_t* const row )
|
||||
{
|
||||
int i;
|
||||
int nV = getNV( );
|
||||
|
||||
/* Set constraint matrix AND update member AX. */
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
Ax[number] = 0.0;
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
A[number*NVMAX + i] = row[i];
|
||||
Ax[number] += A[number*NVMAX + i] * x[i];
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::setLBA( const real_t* const lbA_new )
|
||||
{
|
||||
int i;
|
||||
int nC = getNC();
|
||||
|
||||
for( i=0; i<nC; ++i )
|
||||
lbA[i] = lbA_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::setLBA( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
lbA[number] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::setUBA( const real_t* const ubA_new )
|
||||
{
|
||||
int i;
|
||||
int nC = getNC();
|
||||
|
||||
for( i=0; i<nC; ++i )
|
||||
ubA[i] = ubA_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::setUBA( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
ubA[number] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/QProblem.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the QProblem class which
|
||||
* is able to use the newly developed online active set strategy for
|
||||
* parametric quadratic programming.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t A
|
||||
*/
|
||||
inline returnValue QProblem::getA( real_t* const _A ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( )*getNC( ); ++i )
|
||||
_A[i] = A[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t A
|
||||
*/
|
||||
inline returnValue QProblem::getA( int number, real_t* const row ) const
|
||||
{
|
||||
int nV = getNV( );
|
||||
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
for ( int i=0; i<nV; ++i )
|
||||
row[i] = A[number*NVMAX + i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::getLBA( real_t* const _lbA ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNC( ); ++i )
|
||||
_lbA[i] = lbA[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::getLBA( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
value = lbA[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::getUBA( real_t* const _ubA ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNC( ); ++i )
|
||||
_ubA[i] = ubA[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::getUBA( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
value = ubA[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t C o n s t r a i n t s
|
||||
*/
|
||||
inline returnValue QProblem::getConstraints( Constraints* const _constraints ) const
|
||||
{
|
||||
*_constraints = constraints;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t N C
|
||||
*/
|
||||
inline int QProblem::getNC( ) const
|
||||
{
|
||||
return constraints.getNC( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N E C
|
||||
*/
|
||||
inline int QProblem::getNEC( ) const
|
||||
{
|
||||
return constraints.getNEC( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N A C
|
||||
*/
|
||||
inline int QProblem::getNAC( )
|
||||
{
|
||||
return constraints.getNAC( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I A C
|
||||
*/
|
||||
inline int QProblem::getNIAC( )
|
||||
{
|
||||
return constraints.getNIAC( );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P R O T E C T E D *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* s e t A
|
||||
*/
|
||||
inline returnValue QProblem::setA( const real_t* const A_new )
|
||||
{
|
||||
int i, j;
|
||||
int nV = getNV( );
|
||||
int nC = getNC( );
|
||||
|
||||
/* Set constraint matrix AND update member AX. */
|
||||
for( j=0; j<nC; ++j )
|
||||
{
|
||||
Ax[j] = 0.0;
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
A[j*NVMAX + i] = A_new[j*nV + i];
|
||||
Ax[j] += A[j*NVMAX + i] * x[i];
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t A
|
||||
*/
|
||||
inline returnValue QProblem::setA( int number, const real_t* const row )
|
||||
{
|
||||
int i;
|
||||
int nV = getNV( );
|
||||
|
||||
/* Set constraint matrix AND update member AX. */
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
Ax[number] = 0.0;
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
{
|
||||
A[number*NVMAX + i] = row[i];
|
||||
Ax[number] += A[number*NVMAX + i] * x[i];
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::setLBA( const real_t* const lbA_new )
|
||||
{
|
||||
int i;
|
||||
int nC = getNC();
|
||||
|
||||
for( i=0; i<nC; ++i )
|
||||
lbA[i] = lbA_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B A
|
||||
*/
|
||||
inline returnValue QProblem::setLBA( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
lbA[number] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::setUBA( const real_t* const ubA_new )
|
||||
{
|
||||
int i;
|
||||
int nC = getNC();
|
||||
|
||||
for( i=0; i<nC; ++i )
|
||||
ubA[i] = ubA_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B A
|
||||
*/
|
||||
inline returnValue QProblem::setUBA( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNC( ) ) )
|
||||
{
|
||||
ubA[number] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+2151
-2151
File diff suppressed because it is too large
Load Diff
+425
-425
@@ -1,425 +1,425 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/QProblemB.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the QProblemB class which
|
||||
* is able to use the newly developed online active set strategy for
|
||||
* parametric quadratic programming.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t H
|
||||
*/
|
||||
inline returnValue QProblemB::getH( real_t* const _H ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( )*getNV( ); ++i )
|
||||
_H[i] = H[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t G
|
||||
*/
|
||||
inline returnValue QProblemB::getG( real_t* const _g ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( ); ++i )
|
||||
_g[i] = g[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::getLB( real_t* const _lb ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( ); ++i )
|
||||
_lb[i] = lb[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::getLB( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
value = lb[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::getUB( real_t* const _ub ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( ); ++i )
|
||||
_ub[i] = ub[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::getUB( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
value = ub[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t B o u n d s
|
||||
*/
|
||||
inline returnValue QProblemB::getBounds( Bounds* const _bounds ) const
|
||||
{
|
||||
*_bounds = bounds;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N V
|
||||
*/
|
||||
inline int QProblemB::getNV( ) const
|
||||
{
|
||||
return bounds.getNV( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F R
|
||||
*/
|
||||
inline int QProblemB::getNFR( )
|
||||
{
|
||||
return bounds.getNFR( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F X
|
||||
*/
|
||||
inline int QProblemB::getNFX( )
|
||||
{
|
||||
return bounds.getNFX( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F V
|
||||
*/
|
||||
inline int QProblemB::getNFV( ) const
|
||||
{
|
||||
return bounds.getNFV( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t S t a t u s
|
||||
*/
|
||||
inline QProblemStatus QProblemB::getStatus( ) const
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s I n i t i a l i s e d
|
||||
*/
|
||||
inline BooleanType QProblemB::isInitialised( ) const
|
||||
{
|
||||
if ( status == QPS_NOTINITIALISED )
|
||||
return BT_FALSE;
|
||||
else
|
||||
return BT_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s S o l v e d
|
||||
*/
|
||||
inline BooleanType QProblemB::isSolved( ) const
|
||||
{
|
||||
if ( status == QPS_SOLVED )
|
||||
return BT_TRUE;
|
||||
else
|
||||
return BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s I n f e a s i b l e
|
||||
*/
|
||||
inline BooleanType QProblemB::isInfeasible( ) const
|
||||
{
|
||||
return infeasible;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s U n b o u n d e d
|
||||
*/
|
||||
inline BooleanType QProblemB::isUnbounded( ) const
|
||||
{
|
||||
return unbounded;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t P r i n t L e v e l
|
||||
*/
|
||||
inline PrintLevel QProblemB::getPrintLevel( ) const
|
||||
{
|
||||
return printlevel;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t H e s s i a n T y p e
|
||||
*/
|
||||
inline HessianType QProblemB::getHessianType( ) const
|
||||
{
|
||||
return hessianType;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t H e s s i a n T y p e
|
||||
*/
|
||||
inline returnValue QProblemB::setHessianType( HessianType _hessianType )
|
||||
{
|
||||
hessianType = _hessianType;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P R O T E C T E D *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* s e t H
|
||||
*/
|
||||
inline returnValue QProblemB::setH( const real_t* const H_new )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
for( j=0; j<nV; ++j )
|
||||
H[i*NVMAX + j] = H_new[i*nV + j];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t G
|
||||
*/
|
||||
inline returnValue QProblemB::setG( const real_t* const g_new )
|
||||
{
|
||||
int i;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
g[i] = g_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::setLB( const real_t* const lb_new )
|
||||
{
|
||||
int i;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
lb[i] = lb_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::setLB( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
lb[number] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::setUB( const real_t* const ub_new )
|
||||
{
|
||||
int i;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
ub[i] = ub_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::setUB( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
ub[number] = value;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* c o m p u t e G i v e n s
|
||||
*/
|
||||
inline void QProblemB::computeGivens( real_t xold, real_t yold, real_t& xnew, real_t& ynew,
|
||||
real_t& c, real_t& s
|
||||
) const
|
||||
{
|
||||
if ( getAbs( yold ) <= ZERO )
|
||||
{
|
||||
c = 1.0;
|
||||
s = 0.0;
|
||||
|
||||
xnew = xold;
|
||||
ynew = yold;
|
||||
}
|
||||
else
|
||||
{
|
||||
real_t t, mu;
|
||||
|
||||
mu = getAbs( xold );
|
||||
if ( getAbs( yold ) > mu )
|
||||
mu = getAbs( yold );
|
||||
|
||||
t = mu * sqrt( (xold/mu)*(xold/mu) + (yold/mu)*(yold/mu) );
|
||||
|
||||
if ( xold < 0.0 )
|
||||
t = -t;
|
||||
|
||||
c = xold/t;
|
||||
s = yold/t;
|
||||
xnew = t;
|
||||
ynew = 0.0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* a p p l y G i v e n s
|
||||
*/
|
||||
inline void QProblemB::applyGivens( real_t c, real_t s, real_t xold, real_t yold,
|
||||
real_t& xnew, real_t& ynew
|
||||
) const
|
||||
{
|
||||
/* Usual Givens plane rotation requiring four multiplications. */
|
||||
xnew = c*xold + s*yold;
|
||||
ynew = -s*xold + c*yold;
|
||||
// double nu = s/(1.0+c);
|
||||
//
|
||||
// xnew = xold*c + yold*s;
|
||||
// ynew = (xnew+xold)*nu - yold;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/QProblemB.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of inlined member functions of the QProblemB class which
|
||||
* is able to use the newly developed online active set strategy for
|
||||
* parametric quadratic programming.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* g e t H
|
||||
*/
|
||||
inline returnValue QProblemB::getH( real_t* const _H ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( )*getNV( ); ++i )
|
||||
_H[i] = H[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t G
|
||||
*/
|
||||
inline returnValue QProblemB::getG( real_t* const _g ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( ); ++i )
|
||||
_g[i] = g[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::getLB( real_t* const _lb ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( ); ++i )
|
||||
_lb[i] = lb[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::getLB( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
value = lb[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::getUB( real_t* const _ub ) const
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i<getNV( ); ++i )
|
||||
_ub[i] = ub[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::getUB( int number, real_t& value ) const
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
value = ub[number];
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t B o u n d s
|
||||
*/
|
||||
inline returnValue QProblemB::getBounds( Bounds* const _bounds ) const
|
||||
{
|
||||
*_bounds = bounds;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N V
|
||||
*/
|
||||
inline int QProblemB::getNV( ) const
|
||||
{
|
||||
return bounds.getNV( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F R
|
||||
*/
|
||||
inline int QProblemB::getNFR( )
|
||||
{
|
||||
return bounds.getNFR( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F X
|
||||
*/
|
||||
inline int QProblemB::getNFX( )
|
||||
{
|
||||
return bounds.getNFX( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F V
|
||||
*/
|
||||
inline int QProblemB::getNFV( ) const
|
||||
{
|
||||
return bounds.getNFV( );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t S t a t u s
|
||||
*/
|
||||
inline QProblemStatus QProblemB::getStatus( ) const
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s I n i t i a l i s e d
|
||||
*/
|
||||
inline BooleanType QProblemB::isInitialised( ) const
|
||||
{
|
||||
if ( status == QPS_NOTINITIALISED )
|
||||
return BT_FALSE;
|
||||
else
|
||||
return BT_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s S o l v e d
|
||||
*/
|
||||
inline BooleanType QProblemB::isSolved( ) const
|
||||
{
|
||||
if ( status == QPS_SOLVED )
|
||||
return BT_TRUE;
|
||||
else
|
||||
return BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s I n f e a s i b l e
|
||||
*/
|
||||
inline BooleanType QProblemB::isInfeasible( ) const
|
||||
{
|
||||
return infeasible;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s U n b o u n d e d
|
||||
*/
|
||||
inline BooleanType QProblemB::isUnbounded( ) const
|
||||
{
|
||||
return unbounded;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t P r i n t L e v e l
|
||||
*/
|
||||
inline PrintLevel QProblemB::getPrintLevel( ) const
|
||||
{
|
||||
return printlevel;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t H e s s i a n T y p e
|
||||
*/
|
||||
inline HessianType QProblemB::getHessianType( ) const
|
||||
{
|
||||
return hessianType;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t H e s s i a n T y p e
|
||||
*/
|
||||
inline returnValue QProblemB::setHessianType( HessianType _hessianType )
|
||||
{
|
||||
hessianType = _hessianType;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P R O T E C T E D *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* s e t H
|
||||
*/
|
||||
inline returnValue QProblemB::setH( const real_t* const H_new )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
for( j=0; j<nV; ++j )
|
||||
H[i*NVMAX + j] = H_new[i*nV + j];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t G
|
||||
*/
|
||||
inline returnValue QProblemB::setG( const real_t* const g_new )
|
||||
{
|
||||
int i;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
g[i] = g_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::setLB( const real_t* const lb_new )
|
||||
{
|
||||
int i;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
lb[i] = lb_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t L B
|
||||
*/
|
||||
inline returnValue QProblemB::setLB( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
lb[number] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::setUB( const real_t* const ub_new )
|
||||
{
|
||||
int i;
|
||||
|
||||
int nV = getNV();
|
||||
|
||||
for( i=0; i<nV; ++i )
|
||||
ub[i] = ub_new[i];
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t U B
|
||||
*/
|
||||
inline returnValue QProblemB::setUB( int number, real_t value )
|
||||
{
|
||||
if ( ( number >= 0 ) && ( number < getNV( ) ) )
|
||||
{
|
||||
ub[number] = value;
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* c o m p u t e G i v e n s
|
||||
*/
|
||||
inline void QProblemB::computeGivens( real_t xold, real_t yold, real_t& xnew, real_t& ynew,
|
||||
real_t& c, real_t& s
|
||||
) const
|
||||
{
|
||||
if ( getAbs( yold ) <= ZERO )
|
||||
{
|
||||
c = 1.0;
|
||||
s = 0.0;
|
||||
|
||||
xnew = xold;
|
||||
ynew = yold;
|
||||
}
|
||||
else
|
||||
{
|
||||
real_t t, mu;
|
||||
|
||||
mu = getAbs( xold );
|
||||
if ( getAbs( yold ) > mu )
|
||||
mu = getAbs( yold );
|
||||
|
||||
t = mu * sqrt( (xold/mu)*(xold/mu) + (yold/mu)*(yold/mu) );
|
||||
|
||||
if ( xold < 0.0 )
|
||||
t = -t;
|
||||
|
||||
c = xold/t;
|
||||
s = yold/t;
|
||||
xnew = t;
|
||||
ynew = 0.0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* a p p l y G i v e n s
|
||||
*/
|
||||
inline void QProblemB::applyGivens( real_t c, real_t s, real_t xold, real_t yold,
|
||||
real_t& xnew, real_t& ynew
|
||||
) const
|
||||
{
|
||||
/* Usual Givens plane rotation requiring four multiplications. */
|
||||
xnew = c*xold + s*yold;
|
||||
ynew = -s*xold + c*yold;
|
||||
// double nu = s/(1.0+c);
|
||||
//
|
||||
// xnew = xold*c + yold*s;
|
||||
// ynew = (xnew+xold)*nu - yold;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+200
-200
@@ -1,200 +1,200 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/SubjectTo.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the SubjectTo class designed to manage working sets of
|
||||
* constraints and bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#include <SubjectTo.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* S u b j e c t T o
|
||||
*/
|
||||
SubjectTo::SubjectTo( ) : noLower( BT_TRUE ),
|
||||
noUpper( BT_TRUE ),
|
||||
size( 0 )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = ST_UNKNOWN;
|
||||
status[i] = ST_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* S u b j e c t T o
|
||||
*/
|
||||
SubjectTo::SubjectTo( const SubjectTo& rhs ) : noLower( rhs.noLower ),
|
||||
noUpper( rhs.noUpper ),
|
||||
size( rhs.size )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = rhs.type[i];
|
||||
status[i] = rhs.status[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ S u b j e c t T o
|
||||
*/
|
||||
SubjectTo::~SubjectTo( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
SubjectTo& SubjectTo::operator=( const SubjectTo& rhs )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( this != &rhs )
|
||||
{
|
||||
size = rhs.size;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = rhs.type[i];
|
||||
status[i] = rhs.status[i];
|
||||
}
|
||||
|
||||
noLower = rhs.noLower;
|
||||
noUpper = rhs.noUpper;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue SubjectTo::init( int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
size = n;
|
||||
|
||||
noLower = BT_TRUE;
|
||||
noUpper = BT_TRUE;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = ST_UNKNOWN;
|
||||
status[i] = ST_UNDEFINED;
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P R O T E C T E D *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* a d d I n d e x
|
||||
*/
|
||||
returnValue SubjectTo::addIndex( Indexlist* const indexlist,
|
||||
int newnumber, SubjectToStatus newstatus
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( status[newnumber] == newstatus )
|
||||
return THROWERROR( RET_INDEX_ALREADY_OF_DESIRED_STATUS );
|
||||
|
||||
status[newnumber] = newstatus;
|
||||
|
||||
if ( indexlist->addNumber( newnumber ) == RET_INDEXLIST_EXCEEDS_MAX_LENGTH )
|
||||
return THROWERROR( RET_ADDINDEX_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e m o v e I n d e x
|
||||
*/
|
||||
returnValue SubjectTo::removeIndex( Indexlist* const indexlist,
|
||||
int removenumber
|
||||
)
|
||||
{
|
||||
status[removenumber] = ST_UNDEFINED;
|
||||
|
||||
if ( indexlist->removeNumber( removenumber ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_UNKNOWN_BUG );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s w a p I n d e x
|
||||
*/
|
||||
returnValue SubjectTo::swapIndex( Indexlist* const indexlist,
|
||||
int number1, int number2
|
||||
)
|
||||
{
|
||||
/* consistency checks */
|
||||
if ( status[number1] != status[number2] )
|
||||
return THROWERROR( RET_SWAPINDEX_FAILED );
|
||||
|
||||
if ( number1 == number2 )
|
||||
{
|
||||
THROWWARNING( RET_NOTHING_TO_DO );
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
if ( indexlist->swapNumbers( number1,number2 ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SWAPINDEX_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/SubjectTo.cpp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the SubjectTo class designed to manage working sets of
|
||||
* constraints and bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#include <SubjectTo.hpp>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* S u b j e c t T o
|
||||
*/
|
||||
SubjectTo::SubjectTo( ) : noLower( BT_TRUE ),
|
||||
noUpper( BT_TRUE ),
|
||||
size( 0 )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = ST_UNKNOWN;
|
||||
status[i] = ST_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* S u b j e c t T o
|
||||
*/
|
||||
SubjectTo::SubjectTo( const SubjectTo& rhs ) : noLower( rhs.noLower ),
|
||||
noUpper( rhs.noUpper ),
|
||||
size( rhs.size )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = rhs.type[i];
|
||||
status[i] = rhs.status[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~ S u b j e c t T o
|
||||
*/
|
||||
SubjectTo::~SubjectTo( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* o p e r a t o r =
|
||||
*/
|
||||
SubjectTo& SubjectTo::operator=( const SubjectTo& rhs )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( this != &rhs )
|
||||
{
|
||||
size = rhs.size;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = rhs.type[i];
|
||||
status[i] = rhs.status[i];
|
||||
}
|
||||
|
||||
noLower = rhs.noLower;
|
||||
noUpper = rhs.noUpper;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* i n i t
|
||||
*/
|
||||
returnValue SubjectTo::init( int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
size = n;
|
||||
|
||||
noLower = BT_TRUE;
|
||||
noUpper = BT_TRUE;
|
||||
|
||||
for( i=0; i<size; ++i )
|
||||
{
|
||||
type[i] = ST_UNKNOWN;
|
||||
status[i] = ST_UNDEFINED;
|
||||
}
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P R O T E C T E D *
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* a d d I n d e x
|
||||
*/
|
||||
returnValue SubjectTo::addIndex( Indexlist* const indexlist,
|
||||
int newnumber, SubjectToStatus newstatus
|
||||
)
|
||||
{
|
||||
/* consistency check */
|
||||
if ( status[newnumber] == newstatus )
|
||||
return THROWERROR( RET_INDEX_ALREADY_OF_DESIRED_STATUS );
|
||||
|
||||
status[newnumber] = newstatus;
|
||||
|
||||
if ( indexlist->addNumber( newnumber ) == RET_INDEXLIST_EXCEEDS_MAX_LENGTH )
|
||||
return THROWERROR( RET_ADDINDEX_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e m o v e I n d e x
|
||||
*/
|
||||
returnValue SubjectTo::removeIndex( Indexlist* const indexlist,
|
||||
int removenumber
|
||||
)
|
||||
{
|
||||
status[removenumber] = ST_UNDEFINED;
|
||||
|
||||
if ( indexlist->removeNumber( removenumber ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_UNKNOWN_BUG );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s w a p I n d e x
|
||||
*/
|
||||
returnValue SubjectTo::swapIndex( Indexlist* const indexlist,
|
||||
int number1, int number2
|
||||
)
|
||||
{
|
||||
/* consistency checks */
|
||||
if ( status[number1] != status[number2] )
|
||||
return THROWERROR( RET_SWAPINDEX_FAILED );
|
||||
|
||||
if ( number1 == number2 )
|
||||
{
|
||||
THROWWARNING( RET_NOTHING_TO_DO );
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
if ( indexlist->swapNumbers( number1,number2 ) != SUCCESSFUL_RETURN )
|
||||
return THROWERROR( RET_SWAPINDEX_FAILED );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+132
-132
@@ -1,132 +1,132 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/SubjectTo.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the inlined member functions of the SubjectTo class
|
||||
* designed to manage working sets of constraints and bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* g e t T y p e
|
||||
*/
|
||||
inline SubjectToType SubjectTo::getType( int i ) const
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
return type[i];
|
||||
else
|
||||
return ST_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t S t a t u s
|
||||
*/
|
||||
inline SubjectToStatus SubjectTo::getStatus( int i ) const
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
return status[i];
|
||||
else
|
||||
return ST_UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t T y p e
|
||||
*/
|
||||
inline returnValue SubjectTo::setType( int i, SubjectToType value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
{
|
||||
type[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t S t a t u s
|
||||
*/
|
||||
inline returnValue SubjectTo::setStatus( int i, SubjectToStatus value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
{
|
||||
status[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o L o w e r
|
||||
*/
|
||||
inline void SubjectTo::setNoLower( BooleanType _status )
|
||||
{
|
||||
noLower = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o U p p e r
|
||||
*/
|
||||
inline void SubjectTo::setNoUpper( BooleanType _status )
|
||||
{
|
||||
noUpper = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s N o L o w e r
|
||||
*/
|
||||
inline BooleanType SubjectTo::isNoLower( ) const
|
||||
{
|
||||
return noLower;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s N o L o w e r
|
||||
*/
|
||||
inline BooleanType SubjectTo::isNoUpper( ) const
|
||||
{
|
||||
return noUpper;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/SubjectTo.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of the inlined member functions of the SubjectTo class
|
||||
* designed to manage working sets of constraints and bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* P U B L I C *
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* g e t T y p e
|
||||
*/
|
||||
inline SubjectToType SubjectTo::getType( int i ) const
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
return type[i];
|
||||
else
|
||||
return ST_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t S t a t u s
|
||||
*/
|
||||
inline SubjectToStatus SubjectTo::getStatus( int i ) const
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
return status[i];
|
||||
else
|
||||
return ST_UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t T y p e
|
||||
*/
|
||||
inline returnValue SubjectTo::setType( int i, SubjectToType value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
{
|
||||
type[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t S t a t u s
|
||||
*/
|
||||
inline returnValue SubjectTo::setStatus( int i, SubjectToStatus value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < size ) )
|
||||
{
|
||||
status[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o L o w e r
|
||||
*/
|
||||
inline void SubjectTo::setNoLower( BooleanType _status )
|
||||
{
|
||||
noLower = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o U p p e r
|
||||
*/
|
||||
inline void SubjectTo::setNoUpper( BooleanType _status )
|
||||
{
|
||||
noUpper = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s N o L o w e r
|
||||
*/
|
||||
inline BooleanType SubjectTo::isNoLower( ) const
|
||||
{
|
||||
return noLower;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s N o L o w e r
|
||||
*/
|
||||
inline BooleanType SubjectTo::isNoUpper( ) const
|
||||
{
|
||||
return noUpper;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
+471
-471
@@ -1,471 +1,471 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Utils.cpp
|
||||
* \author Hans Joachim Ferreau, Eckhard Arnold
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of some inlined utilities for working with the different QProblem
|
||||
* classes.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if defined(__WIN32__) || defined(WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(LINUX)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MATLAB__
|
||||
#include <mex.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <Utils.hpp>
|
||||
|
||||
|
||||
|
||||
#ifdef PC_DEBUG /* Define print functions only for debugging! */
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const v, int n )
|
||||
{
|
||||
int i;
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print a vector. */
|
||||
myPrintf( "[\t" );
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
sprintf( myPrintfString," %.16e\t", v[i] );
|
||||
myPrintf( myPrintfString );
|
||||
}
|
||||
myPrintf( "]\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const v, int n,
|
||||
const int* const V_idx
|
||||
)
|
||||
{
|
||||
int i;
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print a permuted vector. */
|
||||
myPrintf( "[\t" );
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
sprintf( myPrintfString," %.16e\t", v[ V_idx[i] ] );
|
||||
myPrintf( myPrintfString );
|
||||
}
|
||||
myPrintf( "]\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const v, int n,
|
||||
const char* name
|
||||
)
|
||||
{
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print vector name ... */
|
||||
sprintf( myPrintfString,"%s = ", name );
|
||||
myPrintf( myPrintfString );
|
||||
|
||||
/* ... and the vector itself. */
|
||||
return print( v, n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const M, int nrow, int ncol )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Print a matrix as a collection of row vectors. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
print( &(M[i*ncol]), ncol );
|
||||
myPrintf( "\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const M, int nrow, int ncol,
|
||||
const int* const ROW_idx, const int* const COL_idx
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Print a permuted matrix as a collection of permuted row vectors. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
print( &( M[ ROW_idx[i]*ncol ] ), ncol, COL_idx );
|
||||
myPrintf( "\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const M, int nrow, int ncol,
|
||||
const char* name
|
||||
)
|
||||
{
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print matrix name ... */
|
||||
sprintf( myPrintfString,"%s = ", name );
|
||||
myPrintf( myPrintfString );
|
||||
|
||||
/* ... and the matrix itself. */
|
||||
return print( M, nrow, ncol );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const int* const index, int n )
|
||||
{
|
||||
int i;
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print a indexlist. */
|
||||
myPrintf( "[\t" );
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
sprintf( myPrintfString," %d\t", index[i] );
|
||||
myPrintf( myPrintfString );
|
||||
}
|
||||
myPrintf( "]\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const int* const index, int n,
|
||||
const char* name
|
||||
)
|
||||
{
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print indexlist name ... */
|
||||
sprintf( myPrintfString,"%s = ", name );
|
||||
myPrintf( myPrintfString );
|
||||
|
||||
/* ... and the indexlist itself. */
|
||||
return print( index, n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m y P r i n t f
|
||||
*/
|
||||
returnValue myPrintf( const char* s )
|
||||
{
|
||||
#ifdef __MATLAB__
|
||||
mexPrintf( s );
|
||||
#else
|
||||
myFILE* outputfile = getGlobalMessageHandler( )->getOutputFile( );
|
||||
if ( outputfile == 0 )
|
||||
return THROWERROR( RET_NO_GLOBAL_MESSAGE_OUTPUTFILE );
|
||||
|
||||
fprintf( outputfile, "%s", s );
|
||||
#endif
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t C o p y r i g h t N o t i c e
|
||||
*/
|
||||
returnValue printCopyrightNotice( )
|
||||
{
|
||||
return myPrintf( "\nqpOASES -- An Implementation of the Online Active Set Strategy.\nCopyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.\n\nqpOASES is distributed under the terms of the \nGNU Lesser General Public License 2.1 in the hope that it will be \nuseful, but WITHOUT ANY WARRANTY; without even the implied warranty \nof MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \nSee the GNU Lesser General Public License for more details.\n\n" );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e a d F r o m F i l e
|
||||
*/
|
||||
returnValue readFromFile( real_t* data, int nrow, int ncol,
|
||||
const char* datafilename
|
||||
)
|
||||
{
|
||||
int i, j;
|
||||
float float_data;
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( ( datafile = fopen( datafilename, "r" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
|
||||
/* 2) Read data from file. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
{
|
||||
for( j=0; j<ncol; ++j )
|
||||
{
|
||||
if ( fscanf( datafile, "%f ", &float_data ) == 0 )
|
||||
{
|
||||
fclose( datafile );
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
data[i*ncol + j] = ( (real_t) float_data );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e a d F r o m F i l e
|
||||
*/
|
||||
returnValue readFromFile( real_t* data, int n,
|
||||
const char* datafilename
|
||||
)
|
||||
{
|
||||
return readFromFile( data, n, 1, datafilename );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* r e a d F r o m F i l e
|
||||
*/
|
||||
returnValue readFromFile( int* data, int n,
|
||||
const char* datafilename
|
||||
)
|
||||
{
|
||||
int i;
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( ( datafile = fopen( datafilename, "r" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
|
||||
/* 2) Read data from file. */
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
if ( fscanf( datafile, "%d\n", &(data[i]) ) == 0 )
|
||||
{
|
||||
fclose( datafile );
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* w r i t e I n t o F i l e
|
||||
*/
|
||||
returnValue writeIntoFile( const real_t* const data, int nrow, int ncol,
|
||||
const char* datafilename, BooleanType append
|
||||
)
|
||||
{
|
||||
int i, j;
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( append == BT_TRUE )
|
||||
{
|
||||
/* append data */
|
||||
if ( ( datafile = fopen( datafilename, "a" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* do not append data */
|
||||
if ( ( datafile = fopen( datafilename, "w" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Write data into file. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
{
|
||||
for( j=0; j<ncol; ++j )
|
||||
fprintf( datafile, "%.16e ", data[i*ncol+j] );
|
||||
|
||||
fprintf( datafile, "\n" );
|
||||
}
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* w r i t e I n t o F i l e
|
||||
*/
|
||||
returnValue writeIntoFile( const real_t* const data, int n,
|
||||
const char* datafilename, BooleanType append
|
||||
)
|
||||
{
|
||||
return writeIntoFile( data,1,n,datafilename,append );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* w r i t e I n t o F i l e
|
||||
*/
|
||||
returnValue writeIntoFile( const int* const data, int n,
|
||||
const char* datafilename, BooleanType append
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( append == BT_TRUE )
|
||||
{
|
||||
/* append data */
|
||||
if ( ( datafile = fopen( datafilename, "a" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* do not append data */
|
||||
if ( ( datafile = fopen( datafilename, "w" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Write data into file. */
|
||||
for( i=0; i<n; ++i )
|
||||
fprintf( datafile, "%d\n", data[i] );
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
#endif /* PC_DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* g e t C P U t i m e
|
||||
*/
|
||||
real_t getCPUtime( )
|
||||
{
|
||||
real_t current_time = -1.0;
|
||||
|
||||
#if defined(__WIN32__) || defined(WIN32)
|
||||
LARGE_INTEGER counter, frequency;
|
||||
QueryPerformanceFrequency(&frequency);
|
||||
QueryPerformanceCounter(&counter);
|
||||
current_time = ((real_t) counter.QuadPart) / ((real_t) frequency.QuadPart);
|
||||
#elif defined(LINUX)
|
||||
struct timeval theclock;
|
||||
gettimeofday( &theclock,0 );
|
||||
current_time = 1.0*theclock.tv_sec + 1.0e-6*theclock.tv_usec;
|
||||
#endif
|
||||
|
||||
return current_time;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N o r m
|
||||
*/
|
||||
real_t getNorm( const real_t* const v, int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
real_t norm = 0.0;
|
||||
|
||||
for( i=0; i<n; ++i )
|
||||
norm += v[i]*v[i];
|
||||
|
||||
return sqrt( norm );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Utils.cpp
|
||||
* \author Hans Joachim Ferreau, Eckhard Arnold
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of some inlined utilities for working with the different QProblem
|
||||
* classes.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if defined(__WIN32__) || defined(WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(LINUX)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MATLAB__
|
||||
#include <mex.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <Utils.hpp>
|
||||
|
||||
|
||||
|
||||
#ifdef PC_DEBUG /* Define print functions only for debugging! */
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const v, int n )
|
||||
{
|
||||
int i;
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print a vector. */
|
||||
myPrintf( "[\t" );
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
sprintf( myPrintfString," %.16e\t", v[i] );
|
||||
myPrintf( myPrintfString );
|
||||
}
|
||||
myPrintf( "]\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const v, int n,
|
||||
const int* const V_idx
|
||||
)
|
||||
{
|
||||
int i;
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print a permuted vector. */
|
||||
myPrintf( "[\t" );
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
sprintf( myPrintfString," %.16e\t", v[ V_idx[i] ] );
|
||||
myPrintf( myPrintfString );
|
||||
}
|
||||
myPrintf( "]\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const v, int n,
|
||||
const char* name
|
||||
)
|
||||
{
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print vector name ... */
|
||||
sprintf( myPrintfString,"%s = ", name );
|
||||
myPrintf( myPrintfString );
|
||||
|
||||
/* ... and the vector itself. */
|
||||
return print( v, n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const M, int nrow, int ncol )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Print a matrix as a collection of row vectors. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
print( &(M[i*ncol]), ncol );
|
||||
myPrintf( "\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const M, int nrow, int ncol,
|
||||
const int* const ROW_idx, const int* const COL_idx
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Print a permuted matrix as a collection of permuted row vectors. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
print( &( M[ ROW_idx[i]*ncol ] ), ncol, COL_idx );
|
||||
myPrintf( "\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const real_t* const M, int nrow, int ncol,
|
||||
const char* name
|
||||
)
|
||||
{
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print matrix name ... */
|
||||
sprintf( myPrintfString,"%s = ", name );
|
||||
myPrintf( myPrintfString );
|
||||
|
||||
/* ... and the matrix itself. */
|
||||
return print( M, nrow, ncol );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const int* const index, int n )
|
||||
{
|
||||
int i;
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print a indexlist. */
|
||||
myPrintf( "[\t" );
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
sprintf( myPrintfString," %d\t", index[i] );
|
||||
myPrintf( myPrintfString );
|
||||
}
|
||||
myPrintf( "]\n" );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t
|
||||
*/
|
||||
returnValue print( const int* const index, int n,
|
||||
const char* name
|
||||
)
|
||||
{
|
||||
char myPrintfString[160];
|
||||
|
||||
/* Print indexlist name ... */
|
||||
sprintf( myPrintfString,"%s = ", name );
|
||||
myPrintf( myPrintfString );
|
||||
|
||||
/* ... and the indexlist itself. */
|
||||
return print( index, n );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* m y P r i n t f
|
||||
*/
|
||||
returnValue myPrintf( const char* s )
|
||||
{
|
||||
#ifdef __MATLAB__
|
||||
mexPrintf( s );
|
||||
#else
|
||||
myFILE* outputfile = getGlobalMessageHandler( )->getOutputFile( );
|
||||
if ( outputfile == 0 )
|
||||
return THROWERROR( RET_NO_GLOBAL_MESSAGE_OUTPUTFILE );
|
||||
|
||||
fprintf( outputfile, "%s", s );
|
||||
#endif
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p r i n t C o p y r i g h t N o t i c e
|
||||
*/
|
||||
returnValue printCopyrightNotice( )
|
||||
{
|
||||
return myPrintf( "\nqpOASES -- An Implementation of the Online Active Set Strategy.\nCopyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.\n\nqpOASES is distributed under the terms of the \nGNU Lesser General Public License 2.1 in the hope that it will be \nuseful, but WITHOUT ANY WARRANTY; without even the implied warranty \nof MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \nSee the GNU Lesser General Public License for more details.\n\n" );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e a d F r o m F i l e
|
||||
*/
|
||||
returnValue readFromFile( real_t* data, int nrow, int ncol,
|
||||
const char* datafilename
|
||||
)
|
||||
{
|
||||
int i, j;
|
||||
float float_data;
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( ( datafile = fopen( datafilename, "r" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
|
||||
/* 2) Read data from file. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
{
|
||||
for( j=0; j<ncol; ++j )
|
||||
{
|
||||
if ( fscanf( datafile, "%f ", &float_data ) == 0 )
|
||||
{
|
||||
fclose( datafile );
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
data[i*ncol + j] = ( (real_t) float_data );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* r e a d F r o m F i l e
|
||||
*/
|
||||
returnValue readFromFile( real_t* data, int n,
|
||||
const char* datafilename
|
||||
)
|
||||
{
|
||||
return readFromFile( data, n, 1, datafilename );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* r e a d F r o m F i l e
|
||||
*/
|
||||
returnValue readFromFile( int* data, int n,
|
||||
const char* datafilename
|
||||
)
|
||||
{
|
||||
int i;
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( ( datafile = fopen( datafilename, "r" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
|
||||
/* 2) Read data from file. */
|
||||
for( i=0; i<n; ++i )
|
||||
{
|
||||
if ( fscanf( datafile, "%d\n", &(data[i]) ) == 0 )
|
||||
{
|
||||
fclose( datafile );
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* w r i t e I n t o F i l e
|
||||
*/
|
||||
returnValue writeIntoFile( const real_t* const data, int nrow, int ncol,
|
||||
const char* datafilename, BooleanType append
|
||||
)
|
||||
{
|
||||
int i, j;
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( append == BT_TRUE )
|
||||
{
|
||||
/* append data */
|
||||
if ( ( datafile = fopen( datafilename, "a" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* do not append data */
|
||||
if ( ( datafile = fopen( datafilename, "w" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Write data into file. */
|
||||
for( i=0; i<nrow; ++i )
|
||||
{
|
||||
for( j=0; j<ncol; ++j )
|
||||
fprintf( datafile, "%.16e ", data[i*ncol+j] );
|
||||
|
||||
fprintf( datafile, "\n" );
|
||||
}
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* w r i t e I n t o F i l e
|
||||
*/
|
||||
returnValue writeIntoFile( const real_t* const data, int n,
|
||||
const char* datafilename, BooleanType append
|
||||
)
|
||||
{
|
||||
return writeIntoFile( data,1,n,datafilename,append );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* w r i t e I n t o F i l e
|
||||
*/
|
||||
returnValue writeIntoFile( const int* const data, int n,
|
||||
const char* datafilename, BooleanType append
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
myFILE* datafile;
|
||||
|
||||
/* 1) Open file. */
|
||||
if ( append == BT_TRUE )
|
||||
{
|
||||
/* append data */
|
||||
if ( ( datafile = fopen( datafilename, "a" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* do not append data */
|
||||
if ( ( datafile = fopen( datafilename, "w" ) ) == 0 )
|
||||
{
|
||||
char errstr[80];
|
||||
sprintf( errstr,"(%s)",datafilename );
|
||||
return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Write data into file. */
|
||||
for( i=0; i<n; ++i )
|
||||
fprintf( datafile, "%d\n", data[i] );
|
||||
|
||||
/* 3) Close file. */
|
||||
fclose( datafile );
|
||||
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
#endif /* PC_DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* g e t C P U t i m e
|
||||
*/
|
||||
real_t getCPUtime( )
|
||||
{
|
||||
real_t current_time = -1.0;
|
||||
|
||||
#if defined(__WIN32__) || defined(WIN32)
|
||||
LARGE_INTEGER counter, frequency;
|
||||
QueryPerformanceFrequency(&frequency);
|
||||
QueryPerformanceCounter(&counter);
|
||||
current_time = ((real_t) counter.QuadPart) / ((real_t) frequency.QuadPart);
|
||||
#elif defined(LINUX)
|
||||
struct timeval theclock;
|
||||
gettimeofday( &theclock,0 );
|
||||
current_time = 1.0*theclock.tv_sec + 1.0e-6*theclock.tv_usec;
|
||||
#endif
|
||||
|
||||
return current_time;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N o r m
|
||||
*/
|
||||
real_t getNorm( const real_t* const v, int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
real_t norm = 0.0;
|
||||
|
||||
for( i=0; i<n; ++i )
|
||||
norm += v[i]*v[i];
|
||||
|
||||
return sqrt( norm );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Utils.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of some inlined utilities for working with the different QProblem
|
||||
* classes.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t A b s
|
||||
*/
|
||||
inline real_t getAbs( real_t x )
|
||||
{
|
||||
if ( x < 0.0 )
|
||||
return -x;
|
||||
else
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
*
|
||||
* qpOASES is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \file SRC/Utils.ipp
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 1.3embedded
|
||||
* \date 2007-2008
|
||||
*
|
||||
* Implementation of some inlined utilities for working with the different QProblem
|
||||
* classes.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t A b s
|
||||
*/
|
||||
inline real_t getAbs( real_t x )
|
||||
{
|
||||
if ( x < 0.0 )
|
||||
return -x;
|
||||
else
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
|
||||
@@ -1,87 +1,87 @@
|
||||
##
|
||||
## qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
## Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
##
|
||||
## qpOASES is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## qpOASES is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with qpOASES; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
|
||||
|
||||
VERSION HISTORY
|
||||
===============
|
||||
|
||||
1.3embedded (last updated on 30th April 2009):
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
+ Re-programming of internal memory management to avoid dynamic memory allocations
|
||||
+ Most #ifdef directives removed
|
||||
+ Almost all type definitions gathered within INCLUDE/Types.hpp
|
||||
+ Irrelevant functionality removed (like the SQProblem class, functionality
|
||||
for loading data from files or the SCILAB interface)
|
||||
+ Replacement of all doubles by real_t
|
||||
+ Introduction of define "PC_DEBUG" for switching off all print functions
|
||||
+ stdio.h was made optional, string.h is no longer needed
|
||||
+ relative paths removed from #include directives
|
||||
+ made auxiliary objects locally static within solveInitialQP()
|
||||
+ Matlab interface fixed for single precision
|
||||
+ New return value -2 from Legacy wrapper added to Matlab/Simulink interfaces
|
||||
+ KKT optimality check moved into QProblem(B) class, SolutionAnalysis class removed
|
||||
|
||||
|
||||
1.3 (released on 2nd June 2008, last updated on 19th June 2008):
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
+ Implementation of "initialised homotopy" concept
|
||||
+ Addition of the SolutionAnalysis class
|
||||
+ Utility functions for solving test problems in OQP format added
|
||||
+ Flexibility of Matlab(R) interface enhanced
|
||||
+ Major source code cleanup
|
||||
(Attention: a few class names and calling interfaces have changed!)
|
||||
|
||||
|
||||
|
||||
1.2 (released on 9th October 2007):
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
+ Special treatment of diagonal Hessians
|
||||
+ Improved infeasibility detection
|
||||
+ Further improved Matlab(R) interface
|
||||
+ Extended Simulink(R) interface
|
||||
+ scilab interface added
|
||||
+ Code cleanup and several bugfixes
|
||||
|
||||
|
||||
|
||||
1.1 (released on 8th July 2007):
|
||||
--------------------------------
|
||||
|
||||
+ Implementation of the QProblemB class
|
||||
+ Basic implementation of the SQProblem class
|
||||
+ Improved Matlab(R) interface
|
||||
+ Enabling/Disabling of constraints introduced
|
||||
+ Several bugfixes
|
||||
|
||||
|
||||
|
||||
1.0 (released on 17th April 2007):
|
||||
----------------------------------
|
||||
|
||||
Initial release.
|
||||
|
||||
|
||||
|
||||
##
|
||||
## end of file
|
||||
##
|
||||
##
|
||||
## qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
## Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
|
||||
##
|
||||
## qpOASES is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## qpOASES is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with qpOASES; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
|
||||
|
||||
VERSION HISTORY
|
||||
===============
|
||||
|
||||
1.3embedded (last updated on 30th April 2009):
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
+ Re-programming of internal memory management to avoid dynamic memory allocations
|
||||
+ Most #ifdef directives removed
|
||||
+ Almost all type definitions gathered within INCLUDE/Types.hpp
|
||||
+ Irrelevant functionality removed (like the SQProblem class, functionality
|
||||
for loading data from files or the SCILAB interface)
|
||||
+ Replacement of all doubles by real_t
|
||||
+ Introduction of define "PC_DEBUG" for switching off all print functions
|
||||
+ stdio.h was made optional, string.h is no longer needed
|
||||
+ relative paths removed from #include directives
|
||||
+ made auxiliary objects locally static within solveInitialQP()
|
||||
+ Matlab interface fixed for single precision
|
||||
+ New return value -2 from Legacy wrapper added to Matlab/Simulink interfaces
|
||||
+ KKT optimality check moved into QProblem(B) class, SolutionAnalysis class removed
|
||||
|
||||
|
||||
1.3 (released on 2nd June 2008, last updated on 19th June 2008):
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
+ Implementation of "initialised homotopy" concept
|
||||
+ Addition of the SolutionAnalysis class
|
||||
+ Utility functions for solving test problems in OQP format added
|
||||
+ Flexibility of Matlab(R) interface enhanced
|
||||
+ Major source code cleanup
|
||||
(Attention: a few class names and calling interfaces have changed!)
|
||||
|
||||
|
||||
|
||||
1.2 (released on 9th October 2007):
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
+ Special treatment of diagonal Hessians
|
||||
+ Improved infeasibility detection
|
||||
+ Further improved Matlab(R) interface
|
||||
+ Extended Simulink(R) interface
|
||||
+ scilab interface added
|
||||
+ Code cleanup and several bugfixes
|
||||
|
||||
|
||||
|
||||
1.1 (released on 8th July 2007):
|
||||
--------------------------------
|
||||
|
||||
+ Implementation of the QProblemB class
|
||||
+ Basic implementation of the SQProblem class
|
||||
+ Improved Matlab(R) interface
|
||||
+ Enabling/Disabling of constraints introduced
|
||||
+ Several bugfixes
|
||||
|
||||
|
||||
|
||||
1.0 (released on 17th April 2007):
|
||||
----------------------------------
|
||||
|
||||
Initial release.
|
||||
|
||||
|
||||
|
||||
##
|
||||
## end of file
|
||||
##
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,39 +0,0 @@
|
||||
/* =========================================================================
|
||||
CZMQ - a high-level binding in C for ZeroMQ
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
|
||||
"Tell them I was a writer.
|
||||
A maker of software.
|
||||
A humanist. A father.
|
||||
And many things.
|
||||
But above all, a writer.
|
||||
Thank You. :)
|
||||
- Pieter Hintjens
|
||||
*/
|
||||
|
||||
#ifndef __CZMQ_H_INCLUDED__
|
||||
#define __CZMQ_H_INCLUDED__
|
||||
|
||||
// These are signatures for handler functions that customize the
|
||||
// behavior of CZMQ containers. These are shared between all CZMQ
|
||||
// container types.
|
||||
|
||||
// -- destroy an item
|
||||
typedef void (czmq_destructor) (void **item);
|
||||
// -- duplicate an item
|
||||
typedef void *(czmq_duplicator) (const void *item);
|
||||
// - compare two items, for sorting
|
||||
typedef int (czmq_comparator) (const void *item1, const void *item2);
|
||||
|
||||
// Include the project library file
|
||||
#include "czmq_library.h"
|
||||
|
||||
#endif
|
||||
@@ -1,178 +0,0 @@
|
||||
/* =========================================================================
|
||||
czmq - generated layer of public API
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
################################################################################
|
||||
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
||||
# Read the zproject/README.md for information about making permanent changes. #
|
||||
################################################################################
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef CZMQ_LIBRARY_H_INCLUDED
|
||||
#define CZMQ_LIBRARY_H_INCLUDED
|
||||
|
||||
// Set up environment for the application
|
||||
#include "czmq_prelude.h"
|
||||
|
||||
// External dependencies
|
||||
#include <zmq.h>
|
||||
|
||||
// CZMQ version macros for compile-time API detection
|
||||
#define CZMQ_VERSION_MAJOR 4
|
||||
#define CZMQ_VERSION_MINOR 0
|
||||
#define CZMQ_VERSION_PATCH 2
|
||||
|
||||
#define CZMQ_MAKE_VERSION(major, minor, patch) \
|
||||
((major) * 10000 + (minor) * 100 + (patch))
|
||||
#define CZMQ_VERSION \
|
||||
CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH)
|
||||
|
||||
#if defined (__WINDOWS__)
|
||||
# if defined CZMQ_STATIC
|
||||
# define CZMQ_EXPORT
|
||||
# elif defined CZMQ_INTERNAL_BUILD
|
||||
# if defined DLL_EXPORT
|
||||
# define CZMQ_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define CZMQ_EXPORT
|
||||
# endif
|
||||
# elif defined CZMQ_EXPORTS
|
||||
# define CZMQ_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define CZMQ_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
# define CZMQ_PRIVATE
|
||||
#else
|
||||
# define CZMQ_EXPORT
|
||||
# if (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
|
||||
# define CZMQ_PRIVATE __attribute__ ((visibility ("hidden")))
|
||||
# else
|
||||
# define CZMQ_PRIVATE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Opaque class structures to allow forward references
|
||||
// These classes are stable or legacy and built in all releases
|
||||
typedef struct _zactor_t zactor_t;
|
||||
#define ZACTOR_T_DEFINED
|
||||
typedef struct _zarmour_t zarmour_t;
|
||||
#define ZARMOUR_T_DEFINED
|
||||
typedef struct _zcert_t zcert_t;
|
||||
#define ZCERT_T_DEFINED
|
||||
typedef struct _zcertstore_t zcertstore_t;
|
||||
#define ZCERTSTORE_T_DEFINED
|
||||
typedef struct _zchunk_t zchunk_t;
|
||||
#define ZCHUNK_T_DEFINED
|
||||
typedef struct _zclock_t zclock_t;
|
||||
#define ZCLOCK_T_DEFINED
|
||||
typedef struct _zconfig_t zconfig_t;
|
||||
#define ZCONFIG_T_DEFINED
|
||||
typedef struct _zdigest_t zdigest_t;
|
||||
#define ZDIGEST_T_DEFINED
|
||||
typedef struct _zdir_t zdir_t;
|
||||
#define ZDIR_T_DEFINED
|
||||
typedef struct _zdir_patch_t zdir_patch_t;
|
||||
#define ZDIR_PATCH_T_DEFINED
|
||||
typedef struct _zfile_t zfile_t;
|
||||
#define ZFILE_T_DEFINED
|
||||
typedef struct _zframe_t zframe_t;
|
||||
#define ZFRAME_T_DEFINED
|
||||
typedef struct _zhash_t zhash_t;
|
||||
#define ZHASH_T_DEFINED
|
||||
typedef struct _zhashx_t zhashx_t;
|
||||
#define ZHASHX_T_DEFINED
|
||||
typedef struct _ziflist_t ziflist_t;
|
||||
#define ZIFLIST_T_DEFINED
|
||||
typedef struct _zlist_t zlist_t;
|
||||
#define ZLIST_T_DEFINED
|
||||
typedef struct _zlistx_t zlistx_t;
|
||||
#define ZLISTX_T_DEFINED
|
||||
typedef struct _zloop_t zloop_t;
|
||||
#define ZLOOP_T_DEFINED
|
||||
typedef struct _zmsg_t zmsg_t;
|
||||
#define ZMSG_T_DEFINED
|
||||
typedef struct _zpoller_t zpoller_t;
|
||||
#define ZPOLLER_T_DEFINED
|
||||
typedef struct _zsock_t zsock_t;
|
||||
#define ZSOCK_T_DEFINED
|
||||
typedef struct _zstr_t zstr_t;
|
||||
#define ZSTR_T_DEFINED
|
||||
typedef struct _zuuid_t zuuid_t;
|
||||
#define ZUUID_T_DEFINED
|
||||
typedef struct _zauth_t zauth_t;
|
||||
#define ZAUTH_T_DEFINED
|
||||
typedef struct _zbeacon_t zbeacon_t;
|
||||
#define ZBEACON_T_DEFINED
|
||||
typedef struct _zgossip_t zgossip_t;
|
||||
#define ZGOSSIP_T_DEFINED
|
||||
typedef struct _zmonitor_t zmonitor_t;
|
||||
#define ZMONITOR_T_DEFINED
|
||||
typedef struct _zproxy_t zproxy_t;
|
||||
#define ZPROXY_T_DEFINED
|
||||
typedef struct _zrex_t zrex_t;
|
||||
#define ZREX_T_DEFINED
|
||||
typedef struct _zsys_t zsys_t;
|
||||
#define ZSYS_T_DEFINED
|
||||
// Draft classes are by default not built in stable releases
|
||||
#ifdef CZMQ_BUILD_DRAFT_API
|
||||
typedef struct _zproc_t zproc_t;
|
||||
#define ZPROC_T_DEFINED
|
||||
typedef struct _ztimerset_t ztimerset_t;
|
||||
#define ZTIMERSET_T_DEFINED
|
||||
typedef struct _ztrie_t ztrie_t;
|
||||
#define ZTRIE_T_DEFINED
|
||||
#endif // CZMQ_BUILD_DRAFT_API
|
||||
|
||||
|
||||
// Public classes, each with its own header file
|
||||
#include "zactor.h"
|
||||
#include "zarmour.h"
|
||||
#include "zcert.h"
|
||||
#include "zcertstore.h"
|
||||
#include "zchunk.h"
|
||||
#include "zclock.h"
|
||||
#include "zconfig.h"
|
||||
#include "zdigest.h"
|
||||
#include "zdir.h"
|
||||
#include "zdir_patch.h"
|
||||
#include "zfile.h"
|
||||
#include "zframe.h"
|
||||
#include "zhash.h"
|
||||
#include "zhashx.h"
|
||||
#include "ziflist.h"
|
||||
#include "zlist.h"
|
||||
#include "zlistx.h"
|
||||
#include "zloop.h"
|
||||
#include "zmsg.h"
|
||||
#include "zpoller.h"
|
||||
#include "zsock.h"
|
||||
#include "zstr.h"
|
||||
#include "zuuid.h"
|
||||
#include "zauth.h"
|
||||
#include "zbeacon.h"
|
||||
#include "zgossip.h"
|
||||
#include "zmonitor.h"
|
||||
#include "zproxy.h"
|
||||
#include "zrex.h"
|
||||
#include "zsys.h"
|
||||
#ifdef CZMQ_BUILD_DRAFT_API
|
||||
#include "zproc.h"
|
||||
#include "ztimerset.h"
|
||||
#include "ztrie.h"
|
||||
#endif // CZMQ_BUILD_DRAFT_API
|
||||
|
||||
#endif
|
||||
/*
|
||||
################################################################################
|
||||
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
||||
# Read the zproject/README.md for information about making permanent changes. #
|
||||
################################################################################
|
||||
*/
|
||||
@@ -1,647 +0,0 @@
|
||||
/* =========================================================================
|
||||
czmq_prelude.h - CZMQ environment
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CZMQ_PRELUDE_H_INCLUDED__
|
||||
#define __CZMQ_PRELUDE_H_INCLUDED__
|
||||
|
||||
//- Establish the compiler and computer system ------------------------------
|
||||
/*
|
||||
* Defines zero or more of these symbols, for use in any non-portable
|
||||
* code:
|
||||
*
|
||||
* __WINDOWS__ Microsoft C/C++ with Windows calls
|
||||
* __MSDOS__ System is MS-DOS (set if __WINDOWS__ set)
|
||||
* __VMS__ System is VAX/VMS or Alpha/OpenVMS
|
||||
* __UNIX__ System is UNIX
|
||||
* __OS2__ System is OS/2
|
||||
*
|
||||
* __IS_32BIT__ OS/compiler is 32 bits
|
||||
* __IS_64BIT__ OS/compiler is 64 bits
|
||||
*
|
||||
* When __UNIX__ is defined, we also define exactly one of these:
|
||||
*
|
||||
* __UTYPE_AUX Apple AUX
|
||||
* __UTYPE_BEOS BeOS
|
||||
* __UTYPE_BSDOS BSD/OS
|
||||
* __UTYPE_DECALPHA Digital UNIX (Alpha)
|
||||
* __UTYPE_IBMAIX IBM RS/6000 AIX
|
||||
* __UTYPE_FREEBSD FreeBSD
|
||||
* __UTYPE_HPUX HP/UX
|
||||
* __UTYPE_ANDROID Android
|
||||
* __UTYPE_LINUX Linux
|
||||
* __UTYPE_GNU GNU/Hurd
|
||||
* __UTYPE_MIPS MIPS (BSD 4.3/System V mixture)
|
||||
* __UTYPE_NETBSD NetBSD
|
||||
* __UTYPE_NEXT NeXT
|
||||
* __UTYPE_OPENBSD OpenBSD
|
||||
* __UTYPE_OSX Apple Macintosh OS X
|
||||
* __UTYPE_IOS Apple iOS
|
||||
* __UTYPE_QNX QNX
|
||||
* __UTYPE_IRIX Silicon Graphics IRIX
|
||||
* __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix)
|
||||
* __UTYPE_SUNOS SunOS
|
||||
* __UTYPE_SUNSOLARIS Sun Solaris
|
||||
* __UTYPE_UNIXWARE SCO UnixWare
|
||||
* ... these are the ones I know about so far.
|
||||
* __UTYPE_GENERIC Any other UNIX
|
||||
*
|
||||
* When __VMS__ is defined, we may define one or more of these:
|
||||
*
|
||||
* __VMS_XOPEN Supports XOPEN functions
|
||||
*/
|
||||
|
||||
#if (defined (__64BIT__) || defined (__x86_64__))
|
||||
# define __IS_64BIT__ // May have 64-bit OS/compiler
|
||||
#else
|
||||
# define __IS_32BIT__ // Else assume 32-bit OS/compiler
|
||||
#endif
|
||||
|
||||
#if (defined WIN32 || defined _WIN32)
|
||||
# undef __WINDOWS__
|
||||
# define __WINDOWS__
|
||||
# undef __MSDOS__
|
||||
# define __MSDOS__
|
||||
#endif
|
||||
|
||||
#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__)
|
||||
# undef __WINDOWS__
|
||||
# define __WINDOWS__
|
||||
# undef __MSDOS__
|
||||
# define __MSDOS__
|
||||
// Stop cheeky warnings about "deprecated" functions like fopen
|
||||
# if _MSC_VER >= 1500
|
||||
# undef _CRT_SECURE_NO_DEPRECATE
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
# pragma warning(disable: 4996)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// MSDOS Microsoft C
|
||||
// _MSC_VER Microsoft C
|
||||
#if (defined (MSDOS) || defined (_MSC_VER))
|
||||
# undef __MSDOS__
|
||||
# define __MSDOS__
|
||||
# if (defined (_DEBUG) && !defined (DEBUG))
|
||||
# define DEBUG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (defined (__EMX__) && defined (__i386__))
|
||||
# undef __OS2__
|
||||
# define __OS2__
|
||||
#endif
|
||||
|
||||
// VMS VAX C (VAX/VMS)
|
||||
// __VMS Dec C (Alpha/OpenVMS)
|
||||
// __vax__ gcc
|
||||
#if (defined (VMS) || defined (__VMS) || defined (__vax__))
|
||||
# undef __VMS__
|
||||
# define __VMS__
|
||||
# if (__VMS_VER >= 70000000)
|
||||
# define __VMS_XOPEN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Try to define a __UTYPE_xxx symbol...
|
||||
// unix SunOS at least
|
||||
// __unix__ gcc
|
||||
// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS
|
||||
#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE))
|
||||
# if (!defined (__VMS__))
|
||||
# undef __UNIX__
|
||||
# define __UNIX__
|
||||
# if (defined (__alpha)) // Digital UNIX is 64-bit
|
||||
# undef __IS_32BIT__
|
||||
# define __IS_64BIT__
|
||||
# define __UTYPE_DECALPHA
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (defined (_AUX))
|
||||
# define __UTYPE_AUX
|
||||
# define __UNIX__
|
||||
#elif (defined (__BEOS__))
|
||||
# define __UTYPE_BEOS
|
||||
# define __UNIX__
|
||||
#elif (defined (__hpux))
|
||||
# define __UTYPE_HPUX
|
||||
# define __UNIX__
|
||||
# define _INCLUDE_HPUX_SOURCE
|
||||
# define _INCLUDE_XOPEN_SOURCE
|
||||
# define _INCLUDE_POSIX_SOURCE
|
||||
#elif (defined (_AIX) || defined (AIX))
|
||||
# define __UTYPE_IBMAIX
|
||||
# define __UNIX__
|
||||
#elif (defined (BSD) || defined (bsd))
|
||||
# define __UTYPE_BSDOS
|
||||
# define __UNIX__
|
||||
#elif (defined (__ANDROID__))
|
||||
# define __UTYPE_ANDROID
|
||||
# define __UNIX__
|
||||
#elif (defined (LINUX) || defined (linux) || defined (__linux__))
|
||||
# define __UTYPE_LINUX
|
||||
# define __UNIX__
|
||||
# ifndef __NO_CTYPE
|
||||
# define __NO_CTYPE // Suppress warnings on tolower()
|
||||
# endif
|
||||
# ifndef _DEFAULT_SOURCE
|
||||
# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix
|
||||
# endif
|
||||
#elif (defined (__GNU__))
|
||||
# define __UTYPE_GNU
|
||||
# define __UNIX__
|
||||
#elif (defined (Mips))
|
||||
# define __UTYPE_MIPS
|
||||
# define __UNIX__
|
||||
#elif (defined (FreeBSD) || defined (__FreeBSD__))
|
||||
# define __UTYPE_FREEBSD
|
||||
# define __UNIX__
|
||||
#elif (defined (NetBSD) || defined (__NetBSD__))
|
||||
# define __UTYPE_NETBSD
|
||||
# define __UNIX__
|
||||
#elif (defined (OpenBSD) || defined (__OpenBSD__))
|
||||
# define __UTYPE_OPENBSD
|
||||
# define __UNIX__
|
||||
#elif (defined (APPLE) || defined (__APPLE__))
|
||||
# include <TargetConditionals.h>
|
||||
# define __UNIX__
|
||||
# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
# define __UTYPE_IOS
|
||||
# else
|
||||
# define __UTYPE_OSX
|
||||
# endif
|
||||
#elif (defined (NeXT))
|
||||
# define __UTYPE_NEXT
|
||||
# define __UNIX__
|
||||
#elif (defined (__QNX__))
|
||||
# define __UTYPE_QNX
|
||||
# define __UNIX__
|
||||
#elif (defined (sgi))
|
||||
# define __UTYPE_IRIX
|
||||
# define __UNIX__
|
||||
#elif (defined (sinix))
|
||||
# define __UTYPE_SINIX
|
||||
# define __UNIX__
|
||||
#elif (defined (SOLARIS) || defined (__SVR4)) || defined (SVR4)
|
||||
# define __UTYPE_SUNSOLARIS
|
||||
# define __UNIX__
|
||||
#elif (defined (SUNOS) || defined (SUN) || defined (sun))
|
||||
# define __UTYPE_SUNOS
|
||||
# define __UNIX__
|
||||
#elif (defined (__USLC__) || defined (UnixWare))
|
||||
# define __UTYPE_UNIXWARE
|
||||
# define __UNIX__
|
||||
#elif (defined (__CYGWIN__))
|
||||
# define __UTYPE_CYGWIN
|
||||
# define __UNIX__
|
||||
#elif (defined (__UNIX__))
|
||||
# define __UTYPE_GENERIC
|
||||
#endif
|
||||
|
||||
//- Always include ZeroMQ headers -------------------------------------------
|
||||
|
||||
#include "zmq.h"
|
||||
#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0))
|
||||
# include "zmq_utils.h"
|
||||
#endif
|
||||
|
||||
//- Standard ANSI include files ---------------------------------------------
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <assert.h>
|
||||
|
||||
//- System-specific include files -------------------------------------------
|
||||
|
||||
#if (defined (__MSDOS__))
|
||||
# if (defined (__WINDOWS__))
|
||||
# if (_WIN32_WINNT < 0x0600)
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0600
|
||||
# endif
|
||||
# if (!defined (FD_SETSIZE))
|
||||
# define FD_SETSIZE 1024 // Max. filehandles/sockets
|
||||
# endif
|
||||
# include <direct.h>
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
# include <process.h>
|
||||
# include <ws2tcpip.h> // For getnameinfo ()
|
||||
# include <iphlpapi.h> // For GetAdaptersAddresses ()
|
||||
# endif
|
||||
# include <malloc.h>
|
||||
# include <dos.h>
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/utime.h>
|
||||
# include <share.h>
|
||||
#endif
|
||||
|
||||
#if (defined (__UNIX__))
|
||||
# include <fcntl.h>
|
||||
# include <netdb.h>
|
||||
# include <unistd.h>
|
||||
# include <pthread.h>
|
||||
# include <dirent.h>
|
||||
# include <pwd.h>
|
||||
# include <grp.h>
|
||||
# include <utime.h>
|
||||
# include <inttypes.h>
|
||||
# include <syslog.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/param.h>
|
||||
# include <sys/socket.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/file.h>
|
||||
# include <sys/wait.h>
|
||||
# include <sys/un.h>
|
||||
# include <sys/uio.h> // Let CZMQ build with libzmq/3.x
|
||||
# include <netinet/in.h> // Must come before arpa/inet.h
|
||||
# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \
|
||||
&& (!defined (__UTYPE_HPUX))
|
||||
# include <ifaddrs.h>
|
||||
# endif
|
||||
# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS)
|
||||
# include <sys/sockio.h>
|
||||
# endif
|
||||
# if (!defined (__UTYPE_BEOS))
|
||||
# include <arpa/inet.h>
|
||||
# if (!defined (TCP_NODELAY))
|
||||
# include <netinet/tcp.h>
|
||||
# endif
|
||||
# endif
|
||||
# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX))
|
||||
# include <sys/select.h>
|
||||
# endif
|
||||
# if (defined (__UTYPE_BEOS))
|
||||
# include <NetKit.h>
|
||||
# endif
|
||||
# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \
|
||||
|| (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L)))
|
||||
# include <sched.h>
|
||||
# endif
|
||||
# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS))
|
||||
# include <mach/clock.h>
|
||||
# include <mach/mach.h> // For monotonic clocks
|
||||
# endif
|
||||
# if (defined (__UTYPE_OSX))
|
||||
# include <crt_externs.h> // For _NSGetEnviron()
|
||||
# endif
|
||||
# if (defined (__UTYPE_ANDROID))
|
||||
# include <android/log.h>
|
||||
# endif
|
||||
# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD))
|
||||
# include <systemd/sd-daemon.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (defined (__VMS__))
|
||||
# if (!defined (vaxc))
|
||||
# include <fcntl.h> // Not provided by Vax C
|
||||
# endif
|
||||
# include <netdb.h>
|
||||
# include <unistd.h>
|
||||
# include <pthread.h>
|
||||
# include <unixio.h>
|
||||
# include <unixlib.h>
|
||||
# include <types.h>
|
||||
# include <file.h>
|
||||
# include <socket.h>
|
||||
# include <dirent.h>
|
||||
# include <time.h>
|
||||
# include <pwd.h>
|
||||
# include <stat.h>
|
||||
# include <in.h>
|
||||
# include <inet.h>
|
||||
#endif
|
||||
|
||||
#if (defined (__OS2__))
|
||||
# include <sys/types.h> // Required near top
|
||||
# include <fcntl.h>
|
||||
# include <malloc.h>
|
||||
# include <netdb.h>
|
||||
# include <unistd.h>
|
||||
# include <pthread.h>
|
||||
# include <dirent.h>
|
||||
# include <pwd.h>
|
||||
# include <grp.h>
|
||||
# include <io.h>
|
||||
# include <process.h>
|
||||
# include <sys/param.h>
|
||||
# include <sys/socket.h>
|
||||
# include <sys/select.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/file.h>
|
||||
# include <sys/wait.h>
|
||||
# include <netinet/in.h> // Must come before arpa/inet.h
|
||||
# include <arpa/inet.h>
|
||||
# include <utime.h>
|
||||
# if (!defined (TCP_NODELAY))
|
||||
# include <netinet/tcp.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Add missing defines for non-POSIX systems
|
||||
#ifndef S_IRUSR
|
||||
# define S_IRUSR S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
# define S_IWUSR S_IWRITE
|
||||
#endif
|
||||
#ifndef S_ISDIR
|
||||
# define S_ISDIR(m) (((m) & S_IFDIR) != 0)
|
||||
#endif
|
||||
#ifndef S_ISREG
|
||||
# define S_ISREG(m) (((m) & S_IFREG) != 0)
|
||||
#endif
|
||||
|
||||
|
||||
//- Check compiler data type sizes ------------------------------------------
|
||||
|
||||
#if (UCHAR_MAX != 0xFF)
|
||||
# error "Cannot compile: must change definition of 'byte'."
|
||||
#endif
|
||||
#if (USHRT_MAX != 0xFFFFU)
|
||||
# error "Cannot compile: must change definition of 'dbyte'."
|
||||
#endif
|
||||
#if (UINT_MAX != 0xFFFFFFFFU)
|
||||
# error "Cannot compile: must change definition of 'qbyte'."
|
||||
#endif
|
||||
|
||||
//- Data types --------------------------------------------------------------
|
||||
|
||||
typedef unsigned char byte; // Single unsigned byte = 8 bits
|
||||
typedef unsigned short dbyte; // Double byte = 16 bits
|
||||
typedef unsigned int qbyte; // Quad byte = 32 bits
|
||||
typedef struct sockaddr_in inaddr_t; // Internet socket address structure
|
||||
typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure
|
||||
|
||||
// Common structure to hold inaddr_t and in6addr_t with length
|
||||
typedef struct {
|
||||
union {
|
||||
inaddr_t __addr; // IPv4 address
|
||||
in6addr_t __addr6; // IPv6 address
|
||||
} __inaddr_u;
|
||||
#define ipv4addr __inaddr_u.__addr
|
||||
#define ipv6addr __inaddr_u.__addr6
|
||||
int inaddrlen;
|
||||
} inaddr_storage_t;
|
||||
|
||||
//- Inevitable macros -------------------------------------------------------
|
||||
|
||||
#define streq(s1,s2) (!strcmp ((s1), (s2)))
|
||||
#define strneq(s1,s2) (strcmp ((s1), (s2)))
|
||||
|
||||
// Provide random number from 0..(num-1)
|
||||
// Note that (at least in Solaris) while rand() returns an int limited by
|
||||
// RAND_MAX, random() returns a 32-bit value all filled with random bits.
|
||||
#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \
|
||||
|| (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) || (defined (__UTYPE_SOLARIS))
|
||||
# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0))
|
||||
#else
|
||||
# if defined(RAND_MAX)
|
||||
# define randof(num) (int) ((float) (num) * (random () % RAND_MAX) / (RAND_MAX + 1.0))
|
||||
# else
|
||||
# define randof(num) (int) ((float) (num) * (uint32_t)random () / (UINT32_MAX + 1.0))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Windows MSVS doesn't have stdbool
|
||||
#if (defined (_MSC_VER))
|
||||
# if (!defined (__cplusplus) && (!defined (true)))
|
||||
# define true 1
|
||||
# define false 0
|
||||
typedef char bool;
|
||||
# endif
|
||||
#else
|
||||
# include <stdbool.h>
|
||||
#endif
|
||||
|
||||
//- A number of POSIX and C99 keywords and data types -----------------------
|
||||
// CZMQ uses uint for array indices; equivalent to unsigned int, but more
|
||||
// convenient in code. We define it in czmq_prelude.h on systems that do
|
||||
// not define it by default.
|
||||
|
||||
#if (defined (__WINDOWS__))
|
||||
# if (!defined (__cplusplus) && (!defined (inline)))
|
||||
# define inline __inline
|
||||
# endif
|
||||
# define strtoull _strtoui64
|
||||
# define atoll _atoi64
|
||||
# define srandom srand
|
||||
# define TIMEZONE _timezone
|
||||
# if (!defined (__MINGW32__))
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
# if (!defined (__MINGW32__))
|
||||
typedef int mode_t;
|
||||
# if !defined (_SSIZE_T_DEFINED)
|
||||
typedef intptr_t ssize_t;
|
||||
# define _SSIZE_T_DEFINED
|
||||
# endif
|
||||
# endif
|
||||
# if ((!defined (__MINGW32__) \
|
||||
|| (defined (__MINGW32__) && defined (__IS_64BIT__))) \
|
||||
&& !defined (ZMQ_DEFINED_STDINT))
|
||||
typedef __int8 int8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
# endif
|
||||
typedef uint32_t in_addr_t;
|
||||
# if (!defined (PRId8))
|
||||
# define PRId8 "d"
|
||||
# endif
|
||||
# if (!defined (PRId16))
|
||||
# define PRId16 "d"
|
||||
# endif
|
||||
# if (!defined (PRId32))
|
||||
# define PRId32 "d"
|
||||
# endif
|
||||
# if (!defined (PRId64))
|
||||
# define PRId64 "I64d"
|
||||
# endif
|
||||
# if (!defined (PRIu8))
|
||||
# define PRIu8 "u"
|
||||
# endif
|
||||
# if (!defined (PRIu16))
|
||||
# define PRIu16 "u"
|
||||
# endif
|
||||
# if (!defined (PRIu32))
|
||||
# define PRIu32 "u"
|
||||
# endif
|
||||
# if (!defined (PRIu64))
|
||||
# define PRIu64 "I64u"
|
||||
# endif
|
||||
# if (!defined (va_copy))
|
||||
// MSVC does not support C99's va_copy so we use a regular assignment
|
||||
# define va_copy(dest,src) (dest) = (src)
|
||||
# endif
|
||||
#elif (defined (__UTYPE_OSX))
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
// This fixes header-order dependence problem with some Linux versions
|
||||
#elif (defined (__UTYPE_LINUX))
|
||||
# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC))
|
||||
typedef unsigned int uint;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//- Non-portable declaration specifiers -------------------------------------
|
||||
|
||||
// For thread-local storage
|
||||
#if defined (__WINDOWS__)
|
||||
# define CZMQ_THREADLS __declspec(thread)
|
||||
#else
|
||||
# define CZMQ_THREADLS __thread
|
||||
#endif
|
||||
|
||||
// Replacement for malloc() which asserts if we run out of heap, and
|
||||
// which zeroes the allocated block.
|
||||
static inline void *
|
||||
safe_malloc (size_t size, const char *file, unsigned line)
|
||||
{
|
||||
// printf ("%s:%u %08d\n", file, line, (int) size);
|
||||
void *mem = calloc (1, size);
|
||||
if (mem == NULL) {
|
||||
fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line);
|
||||
fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n");
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace,
|
||||
// otherwise all allocations will claim to come from czmq_prelude.h. For best
|
||||
// results, compile all classes so you see dangling object allocations.
|
||||
// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate
|
||||
// out of memory condition back up the call stack.
|
||||
#if defined (_ZMALLOC_DEBUG) || defined (_ZMALLOC_PEDANTIC)
|
||||
# define zmalloc(size) calloc(1,(size))
|
||||
#else
|
||||
# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
// GCC supports validating format strings for functions that act like printf
|
||||
#if defined (__GNUC__) && (__GNUC__ >= 2)
|
||||
# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1)))
|
||||
#else
|
||||
# define CHECK_PRINTF(a)
|
||||
#endif
|
||||
|
||||
// Lets us write code that compiles both on Windows and normal platforms
|
||||
#if !defined (__WINDOWS__)
|
||||
typedef int SOCKET;
|
||||
# define closesocket close
|
||||
# define INVALID_SOCKET -1
|
||||
# define SOCKET_ERROR -1
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
||||
//- Include non-portable header files based on platform.h -------------------
|
||||
|
||||
#if defined (HAVE_LINUX_WIRELESS_H)
|
||||
# include <linux/wireless.h>
|
||||
// This would normally come from net/if.h
|
||||
unsigned int if_nametoindex (const char *ifname);
|
||||
#else
|
||||
# if defined (HAVE_NET_IF_H)
|
||||
# include <net/if.h>
|
||||
# endif
|
||||
# if defined (HAVE_NET_IF_MEDIA_H)
|
||||
# include <net/if_media.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__WINDOWS__) && !defined (HAVE_UUID)
|
||||
# define HAVE_UUID 1
|
||||
#endif
|
||||
#if defined (__UTYPE_OSX) && !defined (HAVE_UUID)
|
||||
# define HAVE_UUID 1
|
||||
#endif
|
||||
#if defined (HAVE_UUID)
|
||||
# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD)
|
||||
# include <uuid.h>
|
||||
# elif defined __UTYPE_HPUX
|
||||
# include <dce/uuid.h>
|
||||
# elif defined (__UNIX__)
|
||||
# include <uuid/uuid.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// ZMQ compatibility macros
|
||||
|
||||
#if ZMQ_VERSION_MAJOR == 4
|
||||
# define ZMQ_POLL_MSEC 1 // zmq_poll is msec
|
||||
|
||||
#elif ZMQ_VERSION_MAJOR == 3
|
||||
# define ZMQ_POLL_MSEC 1 // zmq_poll is msec
|
||||
# if ZMQ_VERSION_MINOR < 2
|
||||
# define zmq_ctx_new zmq_init
|
||||
# endif
|
||||
# define zmq_ctx_term zmq_term
|
||||
|
||||
#elif ZMQ_VERSION_MAJOR == 2
|
||||
# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec
|
||||
# define zmq_sendmsg zmq_send // Smooth out 2.x changes
|
||||
# define zmq_recvmsg zmq_recv
|
||||
# define zmq_ctx_new zmq_init
|
||||
# define zmq_ctx_term zmq_term
|
||||
# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f))
|
||||
# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f))
|
||||
// Older libzmq APIs may be missing some aspects of libzmq v3.0
|
||||
# ifndef ZMQ_ROUTER
|
||||
# define ZMQ_ROUTER ZMQ_XREP
|
||||
# endif
|
||||
# ifndef ZMQ_DEALER
|
||||
# define ZMQ_DEALER ZMQ_XREQ
|
||||
# endif
|
||||
# ifndef ZMQ_DONTWAIT
|
||||
# define ZMQ_DONTWAIT ZMQ_NOBLOCK
|
||||
# endif
|
||||
# ifndef ZMQ_XSUB
|
||||
# error "please upgrade your libzmq from http://zeromq.org"
|
||||
# endif
|
||||
# if ZMQ_VERSION_MINOR == 0 \
|
||||
|| (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7)
|
||||
# error "CZMQ requires at least libzmq/2.1.7 stable"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,76 +0,0 @@
|
||||
/* =========================================================================
|
||||
zactor - actor
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZACTOR_H_INCLUDED__
|
||||
#define __ZACTOR_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zactor.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
// Actors get a pipe and arguments from caller
|
||||
typedef void (zactor_fn) (
|
||||
zsock_t *pipe, void *args);
|
||||
|
||||
// Create a new actor passing arbitrary arguments reference.
|
||||
CZMQ_EXPORT zactor_t *
|
||||
zactor_new (zactor_fn task, void *args);
|
||||
|
||||
// Destroy an actor.
|
||||
CZMQ_EXPORT void
|
||||
zactor_destroy (zactor_t **self_p);
|
||||
|
||||
// Send a zmsg message to the actor, take ownership of the message
|
||||
// and destroy when it has been sent.
|
||||
CZMQ_EXPORT int
|
||||
zactor_send (zactor_t *self, zmsg_t **msg_p);
|
||||
|
||||
// Receive a zmsg message from the actor. Returns NULL if the actor
|
||||
// was interrupted before the message could be received, or if there
|
||||
// was a timeout on the actor.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zmsg_t *
|
||||
zactor_recv (zactor_t *self);
|
||||
|
||||
// Probe the supplied object, and report if it looks like a zactor_t.
|
||||
CZMQ_EXPORT bool
|
||||
zactor_is (void *self);
|
||||
|
||||
// Probe the supplied reference. If it looks like a zactor_t instance,
|
||||
// return the underlying libzmq actor handle; else if it looks like
|
||||
// a libzmq actor handle, return the supplied value.
|
||||
CZMQ_EXPORT void *
|
||||
zactor_resolve (void *self);
|
||||
|
||||
// Return the actor's zsock handle. Use this when you absolutely need
|
||||
// to work with the zsock instance rather than the actor.
|
||||
CZMQ_EXPORT zsock_t *
|
||||
zactor_sock (zactor_t *self);
|
||||
|
||||
// Self test of this class.
|
||||
CZMQ_EXPORT void
|
||||
zactor_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,114 +0,0 @@
|
||||
/* =========================================================================
|
||||
zarmour - armoured text encoding and decoding
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZARMOUR_H_INCLUDED__
|
||||
#define __ZARMOUR_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zarmour.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64
|
||||
#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64
|
||||
#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32
|
||||
#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32
|
||||
#define ZARMOUR_MODE_BASE16 4 // Standard base 16
|
||||
#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32
|
||||
|
||||
// Create a new zarmour
|
||||
CZMQ_EXPORT zarmour_t *
|
||||
zarmour_new (void);
|
||||
|
||||
// Destroy the zarmour
|
||||
CZMQ_EXPORT void
|
||||
zarmour_destroy (zarmour_t **self_p);
|
||||
|
||||
// Encode a stream of bytes into an armoured string. Returns the armoured
|
||||
// string, or NULL if there was insufficient memory available to allocate
|
||||
// a new string.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT char *
|
||||
zarmour_encode (zarmour_t *self, const byte *data, size_t size);
|
||||
|
||||
// Decode an armoured string into a chunk. The decoded output is
|
||||
// null-terminated, so it may be treated as a string, if that's what
|
||||
// it was prior to encoding.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zchunk_t *
|
||||
zarmour_decode (zarmour_t *self, const char *data);
|
||||
|
||||
// Get the mode property.
|
||||
CZMQ_EXPORT int
|
||||
zarmour_mode (zarmour_t *self);
|
||||
|
||||
// Get printable string for mode.
|
||||
CZMQ_EXPORT const char *
|
||||
zarmour_mode_str (zarmour_t *self);
|
||||
|
||||
// Set the mode property.
|
||||
CZMQ_EXPORT void
|
||||
zarmour_set_mode (zarmour_t *self, int mode);
|
||||
|
||||
// Return true if padding is turned on.
|
||||
CZMQ_EXPORT bool
|
||||
zarmour_pad (zarmour_t *self);
|
||||
|
||||
// Turn padding on or off. Default is on.
|
||||
CZMQ_EXPORT void
|
||||
zarmour_set_pad (zarmour_t *self, bool pad);
|
||||
|
||||
// Get the padding character.
|
||||
CZMQ_EXPORT char
|
||||
zarmour_pad_char (zarmour_t *self);
|
||||
|
||||
// Set the padding character.
|
||||
CZMQ_EXPORT void
|
||||
zarmour_set_pad_char (zarmour_t *self, char pad_char);
|
||||
|
||||
// Return if splitting output into lines is turned on. Default is off.
|
||||
CZMQ_EXPORT bool
|
||||
zarmour_line_breaks (zarmour_t *self);
|
||||
|
||||
// Turn splitting output into lines on or off.
|
||||
CZMQ_EXPORT void
|
||||
zarmour_set_line_breaks (zarmour_t *self, bool line_breaks);
|
||||
|
||||
// Get the line length used for splitting lines.
|
||||
CZMQ_EXPORT size_t
|
||||
zarmour_line_length (zarmour_t *self);
|
||||
|
||||
// Set the line length used for splitting lines.
|
||||
CZMQ_EXPORT void
|
||||
zarmour_set_line_length (zarmour_t *self, size_t line_length);
|
||||
|
||||
// Print properties of object
|
||||
CZMQ_EXPORT void
|
||||
zarmour_print (zarmour_t *self);
|
||||
|
||||
// Self test of this class.
|
||||
CZMQ_EXPORT void
|
||||
zarmour_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,100 +0,0 @@
|
||||
/* =========================================================================
|
||||
zauth - authentication for ZeroMQ security mechanisms
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZAUTH_H_INCLUDED__
|
||||
#define __ZAUTH_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @interface
|
||||
#define CURVE_ALLOW_ANY "*"
|
||||
|
||||
// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated).
|
||||
//
|
||||
// Create new zauth actor instance. This installs authentication on all
|
||||
// zsock sockets. Until you add policies, all incoming NULL connections are
|
||||
// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections
|
||||
// are denied:
|
||||
//
|
||||
// zactor_t *auth = zactor_new (zauth, NULL);
|
||||
//
|
||||
// Destroy zauth instance. This removes authentication and allows all
|
||||
// connections to pass, without authentication:
|
||||
//
|
||||
// zactor_destroy (&auth);
|
||||
//
|
||||
// Note that all zauth commands are synchronous, so your application always
|
||||
// waits for a signal from the actor after each command.
|
||||
//
|
||||
// Enable verbose logging of commands and activity. Verbose logging can help
|
||||
// debug non-trivial authentication policies:
|
||||
//
|
||||
// zstr_send (auth, "VERBOSE");
|
||||
// zsock_wait (auth);
|
||||
//
|
||||
// Allow (whitelist) a list of IP addresses. For NULL, all clients from
|
||||
// these addresses will be accepted. For PLAIN and CURVE, they will be
|
||||
// allowed to continue with authentication. You can call this method
|
||||
// multiple times to whitelist more IP addresses. If you whitelist one
|
||||
// or more addresses, any non-whitelisted addresses are treated as
|
||||
// blacklisted:
|
||||
//
|
||||
// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL);
|
||||
// zsock_wait (auth);
|
||||
//
|
||||
// Deny (blacklist) a list of IP addresses. For all security mechanisms,
|
||||
// this rejects the connection without any further authentication. Use
|
||||
// either a whitelist, or a blacklist, not not both. If you define both
|
||||
// a whitelist and a blacklist, only the whitelist takes effect:
|
||||
//
|
||||
// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL);
|
||||
// zsock_wait (auth);
|
||||
//
|
||||
// Configure PLAIN authentication using a plain-text password file. You can
|
||||
// modify the password file at any time; zauth will reload it automatically
|
||||
// if modified externally:
|
||||
//
|
||||
// zstr_sendx (auth, "PLAIN", filename, NULL);
|
||||
// zsock_wait (auth);
|
||||
//
|
||||
// Configure CURVE authentication, using a directory that holds all public
|
||||
// client certificates, i.e. their public keys. The certificates must be in
|
||||
// zcert_save format. You can add and remove certificates in that directory
|
||||
// at any time. To allow all client keys without checking, specify
|
||||
// CURVE_ALLOW_ANY for the directory name:
|
||||
//
|
||||
// zstr_sendx (auth, "CURVE", directory, NULL);
|
||||
// zsock_wait (auth);
|
||||
//
|
||||
// Configure GSSAPI authentication, using an underlying mechanism (usually
|
||||
// Kerberos) to establish a secure context and perform mutual authentication:
|
||||
//
|
||||
// zstr_sendx (auth, "GSSAPI", NULL);
|
||||
// zsock_wait (auth);
|
||||
//
|
||||
// This is the zauth constructor as a zactor_fn:
|
||||
CZMQ_EXPORT void
|
||||
zauth (zsock_t *pipe, void *certstore);
|
||||
|
||||
// Selftest
|
||||
CZMQ_EXPORT void
|
||||
zauth_test (bool verbose);
|
||||
// @end
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,86 +0,0 @@
|
||||
/* =========================================================================
|
||||
zbeacon - LAN discovery and presence
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZBEACON_H_INCLUDED__
|
||||
#define __ZBEACON_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @interface
|
||||
// Create new zbeacon actor instance:
|
||||
//
|
||||
// zactor_t *beacon = zactor_new (zbeacon, NULL);
|
||||
//
|
||||
// Destroy zbeacon instance:
|
||||
//
|
||||
// zactor_destroy (&beacon);
|
||||
//
|
||||
// Enable verbose logging of commands and activity:
|
||||
//
|
||||
// zstr_send (beacon, "VERBOSE");
|
||||
//
|
||||
// Configure beacon to run on specified UDP port, and return the name of
|
||||
// the host, which can be used as endpoint for incoming connections. To
|
||||
// force the beacon to operate on a given interface, set the environment
|
||||
// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating
|
||||
// the beacon. If the system does not support UDP broadcasts (lacking a
|
||||
// workable interface), returns an empty hostname:
|
||||
//
|
||||
// // Pictures: 's' = C string, 'i' = int
|
||||
// zsock_send (beacon, "si", "CONFIGURE", port_number);
|
||||
// char *hostname = zstr_recv (beacon);
|
||||
//
|
||||
// Start broadcasting a beacon at a specified interval in msec. The beacon
|
||||
// data can be at most UDP_FRAME_MAX bytes; this constant is defined in
|
||||
// zsys.h to be 255:
|
||||
//
|
||||
// // Pictures: 'b' = byte * data + size_t size
|
||||
// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval);
|
||||
//
|
||||
// Stop broadcasting the beacon:
|
||||
//
|
||||
// zstr_sendx (beacon, "SILENCE", NULL);
|
||||
//
|
||||
// Start listening to beacons from peers. The filter is used to do a prefix
|
||||
// match on received beacons, to remove junk. Note that any received data
|
||||
// that is identical to our broadcast beacon_data is discarded in any case.
|
||||
// If the filter size is zero, we get all peer beacons:
|
||||
//
|
||||
// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size);
|
||||
//
|
||||
// Stop listening to other peers
|
||||
//
|
||||
// zstr_sendx (beacon, "UNSUBSCRIBE", NULL);
|
||||
//
|
||||
// Receive next beacon from a peer. Received beacons are always a 2-frame
|
||||
// message containing the ipaddress of the sender, and then the binary
|
||||
// beacon data as published by the sender:
|
||||
//
|
||||
// zmsg_t *msg = zmsg_recv (beacon);
|
||||
//
|
||||
// This is the zbeacon constructor as a zactor_fn:
|
||||
CZMQ_EXPORT void
|
||||
zbeacon (zsock_t *pipe, void *unused);
|
||||
|
||||
// Self test of this class
|
||||
CZMQ_EXPORT void
|
||||
zbeacon_test (bool verbose);
|
||||
// @end
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,128 +0,0 @@
|
||||
/* =========================================================================
|
||||
zcert - work with CURVE security certificates
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZCERT_H_INCLUDED__
|
||||
#define __ZCERT_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zcert.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
// This class has draft methods, which may change over time. They are not
|
||||
// in stable releases, by default. Use --enable-drafts to enable.
|
||||
// Create and initialize a new certificate in memory
|
||||
CZMQ_EXPORT zcert_t *
|
||||
zcert_new (void);
|
||||
|
||||
// Accepts public/secret key pair from caller
|
||||
CZMQ_EXPORT zcert_t *
|
||||
zcert_new_from (const byte *public_key, const byte *secret_key);
|
||||
|
||||
// Load certificate from file
|
||||
CZMQ_EXPORT zcert_t *
|
||||
zcert_load (const char *filename);
|
||||
|
||||
// Destroy a certificate in memory
|
||||
CZMQ_EXPORT void
|
||||
zcert_destroy (zcert_t **self_p);
|
||||
|
||||
// Return public part of key pair as 32-byte binary string
|
||||
CZMQ_EXPORT const byte *
|
||||
zcert_public_key (zcert_t *self);
|
||||
|
||||
// Return secret part of key pair as 32-byte binary string
|
||||
CZMQ_EXPORT const byte *
|
||||
zcert_secret_key (zcert_t *self);
|
||||
|
||||
// Return public part of key pair as Z85 armored string
|
||||
CZMQ_EXPORT const char *
|
||||
zcert_public_txt (zcert_t *self);
|
||||
|
||||
// Return secret part of key pair as Z85 armored string
|
||||
CZMQ_EXPORT const char *
|
||||
zcert_secret_txt (zcert_t *self);
|
||||
|
||||
// Set certificate metadata from formatted string.
|
||||
CZMQ_EXPORT void
|
||||
zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3);
|
||||
|
||||
// Get metadata value from certificate; if the metadata value doesn't
|
||||
// exist, returns NULL.
|
||||
CZMQ_EXPORT const char *
|
||||
zcert_meta (zcert_t *self, const char *name);
|
||||
|
||||
// Get list of metadata fields from certificate. Caller is responsible for
|
||||
// destroying list. Caller should not modify the values of list items.
|
||||
CZMQ_EXPORT zlist_t *
|
||||
zcert_meta_keys (zcert_t *self);
|
||||
|
||||
// Save full certificate (public + secret) to file for persistent storage
|
||||
// This creates one public file and one secret file (filename + "_secret").
|
||||
CZMQ_EXPORT int
|
||||
zcert_save (zcert_t *self, const char *filename);
|
||||
|
||||
// Save public certificate only to file for persistent storage
|
||||
CZMQ_EXPORT int
|
||||
zcert_save_public (zcert_t *self, const char *filename);
|
||||
|
||||
// Save secret certificate only to file for persistent storage
|
||||
CZMQ_EXPORT int
|
||||
zcert_save_secret (zcert_t *self, const char *filename);
|
||||
|
||||
// Apply certificate to socket, i.e. use for CURVE security on socket.
|
||||
// If certificate was loaded from public file, the secret key will be
|
||||
// undefined, and this certificate will not work successfully.
|
||||
CZMQ_EXPORT void
|
||||
zcert_apply (zcert_t *self, void *socket);
|
||||
|
||||
// Return copy of certificate; if certificate is NULL or we exhausted
|
||||
// heap memory, returns NULL.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zcert_t *
|
||||
zcert_dup (zcert_t *self);
|
||||
|
||||
// Return true if two certificates have the same keys
|
||||
CZMQ_EXPORT bool
|
||||
zcert_eq (zcert_t *self, zcert_t *compare);
|
||||
|
||||
// Print certificate contents to stdout
|
||||
CZMQ_EXPORT void
|
||||
zcert_print (zcert_t *self);
|
||||
|
||||
// Self test of this class
|
||||
CZMQ_EXPORT void
|
||||
zcert_test (bool verbose);
|
||||
|
||||
#ifdef CZMQ_BUILD_DRAFT_API
|
||||
// *** Draft method, for development use, may change without warning ***
|
||||
// Unset certificate metadata.
|
||||
CZMQ_EXPORT void
|
||||
zcert_unset_meta (zcert_t *self, const char *name);
|
||||
|
||||
#endif // CZMQ_BUILD_DRAFT_API
|
||||
// @end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Deprecated method aliases
|
||||
#define zcert_dump(s) zcert_print(s)
|
||||
|
||||
#endif
|
||||
@@ -1,92 +0,0 @@
|
||||
/* =========================================================================
|
||||
zcertstore - work with CURVE security certificate stores
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZCERTSTORE_H_INCLUDED__
|
||||
#define __ZCERTSTORE_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zcertstore.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
// This class has draft methods, which may change over time. They are not
|
||||
// in stable releases, by default. Use --enable-drafts to enable.
|
||||
// Create a new certificate store from a disk directory, loading and
|
||||
// indexing all certificates in that location. The directory itself may be
|
||||
// absent, and created later, or modified at any time. The certificate store
|
||||
// is automatically refreshed on any zcertstore_lookup() call. If the
|
||||
// location is specified as NULL, creates a pure-memory store, which you
|
||||
// can work with by inserting certificates at runtime.
|
||||
CZMQ_EXPORT zcertstore_t *
|
||||
zcertstore_new (const char *location);
|
||||
|
||||
// Destroy a certificate store object in memory. Does not affect anything
|
||||
// stored on disk.
|
||||
CZMQ_EXPORT void
|
||||
zcertstore_destroy (zcertstore_t **self_p);
|
||||
|
||||
// Look up certificate by public key, returns zcert_t object if found,
|
||||
// else returns NULL. The public key is provided in Z85 text format.
|
||||
CZMQ_EXPORT zcert_t *
|
||||
zcertstore_lookup (zcertstore_t *self, const char *public_key);
|
||||
|
||||
// Insert certificate into certificate store in memory. Note that this
|
||||
// does not save the certificate to disk. To do that, use zcert_save()
|
||||
// directly on the certificate. Takes ownership of zcert_t object.
|
||||
CZMQ_EXPORT void
|
||||
zcertstore_insert (zcertstore_t *self, zcert_t **cert_p);
|
||||
|
||||
// Print list of certificates in store to logging facility
|
||||
CZMQ_EXPORT void
|
||||
zcertstore_print (zcertstore_t *self);
|
||||
|
||||
// Self test of this class
|
||||
CZMQ_EXPORT void
|
||||
zcertstore_test (bool verbose);
|
||||
|
||||
#ifdef CZMQ_BUILD_DRAFT_API
|
||||
// Loaders retrieve certificates from an arbitrary source.
|
||||
typedef void (zcertstore_loader) (
|
||||
zcertstore_t *self);
|
||||
|
||||
// Destructor for loader state.
|
||||
typedef void (zcertstore_destructor) (
|
||||
void **self_p);
|
||||
|
||||
// *** Draft method, for development use, may change without warning ***
|
||||
// Override the default disk loader with a custom loader fn.
|
||||
CZMQ_EXPORT void
|
||||
zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state);
|
||||
|
||||
// *** Draft method, for development use, may change without warning ***
|
||||
// Empty certificate hashtable. This wrapper exists to be friendly to bindings,
|
||||
// which don't usually have access to struct internals.
|
||||
CZMQ_EXPORT void
|
||||
zcertstore_empty (zcertstore_t *self);
|
||||
|
||||
#endif // CZMQ_BUILD_DRAFT_API
|
||||
// @end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Deprecated method aliases
|
||||
#define zcertstore_dump(s) zcertstore_print(s)
|
||||
|
||||
#endif
|
||||
@@ -1,163 +0,0 @@
|
||||
/* =========================================================================
|
||||
zchunk - work with memory chunks
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZCHUNK_H_INCLUDED__
|
||||
#define __ZCHUNK_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zchunk.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
// Create a new chunk of the specified size. If you specify the data, it
|
||||
// is copied into the chunk. If you do not specify the data, the chunk is
|
||||
// allocated and left empty, and you can then add data using zchunk_append.
|
||||
CZMQ_EXPORT zchunk_t *
|
||||
zchunk_new (const void *data, size_t size);
|
||||
|
||||
// Destroy a chunk
|
||||
CZMQ_EXPORT void
|
||||
zchunk_destroy (zchunk_t **self_p);
|
||||
|
||||
// Resizes chunk max_size as requested; chunk_cur size is set to zero
|
||||
CZMQ_EXPORT void
|
||||
zchunk_resize (zchunk_t *self, size_t size);
|
||||
|
||||
// Return chunk cur size
|
||||
CZMQ_EXPORT size_t
|
||||
zchunk_size (zchunk_t *self);
|
||||
|
||||
// Return chunk max size
|
||||
CZMQ_EXPORT size_t
|
||||
zchunk_max_size (zchunk_t *self);
|
||||
|
||||
// Return chunk data
|
||||
CZMQ_EXPORT byte *
|
||||
zchunk_data (zchunk_t *self);
|
||||
|
||||
// Set chunk data from user-supplied data; truncate if too large. Data may
|
||||
// be null. Returns actual size of chunk
|
||||
CZMQ_EXPORT size_t
|
||||
zchunk_set (zchunk_t *self, const void *data, size_t size);
|
||||
|
||||
// Fill chunk data from user-supplied octet
|
||||
CZMQ_EXPORT size_t
|
||||
zchunk_fill (zchunk_t *self, byte filler, size_t size);
|
||||
|
||||
// Append user-supplied data to chunk, return resulting chunk size. If the
|
||||
// data would exceeded the available space, it is truncated. If you want to
|
||||
// grow the chunk to accommodate new data, use the zchunk_extend method.
|
||||
CZMQ_EXPORT size_t
|
||||
zchunk_append (zchunk_t *self, const void *data, size_t size);
|
||||
|
||||
// Append user-supplied data to chunk, return resulting chunk size. If the
|
||||
// data would exceeded the available space, the chunk grows in size.
|
||||
CZMQ_EXPORT size_t
|
||||
zchunk_extend (zchunk_t *self, const void *data, size_t size);
|
||||
|
||||
// Copy as much data from 'source' into the chunk as possible; returns the
|
||||
// new size of chunk. If all data from 'source' is used, returns exhausted
|
||||
// on the source chunk. Source can be consumed as many times as needed until
|
||||
// it is exhausted. If source was already exhausted, does not change chunk.
|
||||
CZMQ_EXPORT size_t
|
||||
zchunk_consume (zchunk_t *self, zchunk_t *source);
|
||||
|
||||
// Returns true if the chunk was exhausted by consume methods, or if the
|
||||
// chunk has a size of zero.
|
||||
CZMQ_EXPORT bool
|
||||
zchunk_exhausted (zchunk_t *self);
|
||||
|
||||
// Read chunk from an open file descriptor
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zchunk_t *
|
||||
zchunk_read (FILE *handle, size_t bytes);
|
||||
|
||||
// Write chunk to an open file descriptor
|
||||
CZMQ_EXPORT int
|
||||
zchunk_write (zchunk_t *self, FILE *handle);
|
||||
|
||||
// Try to slurp an entire file into a chunk. Will read up to maxsize of
|
||||
// the file. If maxsize is 0, will attempt to read the entire file and
|
||||
// fail with an assertion if that cannot fit into memory. Returns a new
|
||||
// chunk containing the file data, or NULL if the file could not be read.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zchunk_t *
|
||||
zchunk_slurp (const char *filename, size_t maxsize);
|
||||
|
||||
// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t
|
||||
// object, or null if there was not enough heap memory. If chunk is null,
|
||||
// returns null.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zchunk_t *
|
||||
zchunk_dup (zchunk_t *self);
|
||||
|
||||
// Return chunk data encoded as printable hex string. Caller must free
|
||||
// string when finished with it.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT char *
|
||||
zchunk_strhex (zchunk_t *self);
|
||||
|
||||
// Return chunk data copied into freshly allocated string
|
||||
// Caller must free string when finished with it.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT char *
|
||||
zchunk_strdup (zchunk_t *self);
|
||||
|
||||
// Return TRUE if chunk body is equal to string, excluding terminator
|
||||
CZMQ_EXPORT bool
|
||||
zchunk_streq (zchunk_t *self, const char *string);
|
||||
|
||||
// Transform zchunk into a zframe that can be sent in a message.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zframe_t *
|
||||
zchunk_pack (zchunk_t *self);
|
||||
|
||||
// Transform a zframe into a zchunk.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zchunk_t *
|
||||
zchunk_unpack (zframe_t *frame);
|
||||
|
||||
// Calculate SHA1 digest for chunk, using zdigest class.
|
||||
CZMQ_EXPORT const char *
|
||||
zchunk_digest (zchunk_t *self);
|
||||
|
||||
// Dump chunk to FILE stream, for debugging and tracing.
|
||||
CZMQ_EXPORT void
|
||||
zchunk_fprint (zchunk_t *self, FILE *file);
|
||||
|
||||
// Dump message to stderr, for debugging and tracing.
|
||||
// See zchunk_fprint for details
|
||||
CZMQ_EXPORT void
|
||||
zchunk_print (zchunk_t *self);
|
||||
|
||||
// Probe the supplied object, and report if it looks like a zchunk_t.
|
||||
CZMQ_EXPORT bool
|
||||
zchunk_is (void *self);
|
||||
|
||||
// Self test of this class.
|
||||
CZMQ_EXPORT void
|
||||
zchunk_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/* =========================================================================
|
||||
zclock - millisecond clocks and delays
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZCLOCK_H_INCLUDED__
|
||||
#define __ZCLOCK_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zclock.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
// Sleep for a number of milliseconds
|
||||
CZMQ_EXPORT void
|
||||
zclock_sleep (int msecs);
|
||||
|
||||
// Return current system clock as milliseconds. Note that this clock can
|
||||
// jump backwards (if the system clock is changed) so is unsafe to use for
|
||||
// timers and time offsets. Use zclock_mono for that instead.
|
||||
CZMQ_EXPORT int64_t
|
||||
zclock_time (void);
|
||||
|
||||
// Return current monotonic clock in milliseconds. Use this when you compute
|
||||
// time offsets. The monotonic clock is not affected by system changes and
|
||||
// so will never be reset backwards, unlike a system clock.
|
||||
CZMQ_EXPORT int64_t
|
||||
zclock_mono (void);
|
||||
|
||||
// Return current monotonic clock in microseconds. Use this when you compute
|
||||
// time offsets. The monotonic clock is not affected by system changes and
|
||||
// so will never be reset backwards, unlike a system clock.
|
||||
CZMQ_EXPORT int64_t
|
||||
zclock_usecs (void);
|
||||
|
||||
// Return formatted date/time as fresh string. Free using zstr_free().
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT char *
|
||||
zclock_timestr (void);
|
||||
|
||||
// Self test of this class.
|
||||
CZMQ_EXPORT void
|
||||
zclock_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
|
||||
// DEPRECATED in favor of zsys logging, see issue #519
|
||||
// Print formatted string to stdout, prefixed by date/time and
|
||||
// terminated with a newline.
|
||||
CZMQ_EXPORT void
|
||||
zclock_log (const char *format, ...);
|
||||
|
||||
// Compiler hints
|
||||
CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,185 +0,0 @@
|
||||
/* =========================================================================
|
||||
zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL.
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZCONFIG_H_INCLUDED__
|
||||
#define __ZCONFIG_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zconfig.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
//
|
||||
typedef int (zconfig_fct) (
|
||||
zconfig_t *self, void *arg, int level);
|
||||
|
||||
// Create new config item
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_new (const char *name, zconfig_t *parent);
|
||||
|
||||
// Load a config tree from a specified ZPL text file; returns a zconfig_t
|
||||
// reference for the root, if the file exists and is readable. Returns NULL
|
||||
// if the file does not exist.
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_load (const char *filename);
|
||||
|
||||
// Equivalent to zconfig_load, taking a format string instead of a fixed
|
||||
// filename.
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_loadf (const char *format, ...) CHECK_PRINTF (1);
|
||||
|
||||
// Destroy a config item and all its children
|
||||
CZMQ_EXPORT void
|
||||
zconfig_destroy (zconfig_t **self_p);
|
||||
|
||||
// Return name of config item
|
||||
CZMQ_EXPORT char *
|
||||
zconfig_name (zconfig_t *self);
|
||||
|
||||
// Return value of config item
|
||||
CZMQ_EXPORT char *
|
||||
zconfig_value (zconfig_t *self);
|
||||
|
||||
// Insert or update configuration key with value
|
||||
CZMQ_EXPORT void
|
||||
zconfig_put (zconfig_t *self, const char *path, const char *value);
|
||||
|
||||
// Equivalent to zconfig_put, accepting a format specifier and variable
|
||||
// argument list, instead of a single string value.
|
||||
CZMQ_EXPORT void
|
||||
zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3);
|
||||
|
||||
// Get value for config item into a string value; leading slash is optional
|
||||
// and ignored.
|
||||
CZMQ_EXPORT char *
|
||||
zconfig_get (zconfig_t *self, const char *path, const char *default_value);
|
||||
|
||||
// Set config item name, name may be NULL
|
||||
CZMQ_EXPORT void
|
||||
zconfig_set_name (zconfig_t *self, const char *name);
|
||||
|
||||
// Set new value for config item. The new value may be a string, a printf
|
||||
// format, or NULL. Note that if string may possibly contain '%', or if it
|
||||
// comes from an insecure source, you must use '%s' as the format, followed
|
||||
// by the string.
|
||||
CZMQ_EXPORT void
|
||||
zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
|
||||
|
||||
// Find our first child, if any
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_child (zconfig_t *self);
|
||||
|
||||
// Find our first sibling, if any
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_next (zconfig_t *self);
|
||||
|
||||
// Find a config item along a path; leading slash is optional and ignored.
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_locate (zconfig_t *self, const char *path);
|
||||
|
||||
// Locate the last config item at a specified depth
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_at_depth (zconfig_t *self, int level);
|
||||
|
||||
// Execute a callback for each config item in the tree; returns zero if
|
||||
// successful, else -1.
|
||||
CZMQ_EXPORT int
|
||||
zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg);
|
||||
|
||||
// Add comment to config item before saving to disk. You can add as many
|
||||
// comment lines as you like. If you use a null format, all comments are
|
||||
// deleted.
|
||||
CZMQ_EXPORT void
|
||||
zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
|
||||
|
||||
// Return comments of config item, as zlist.
|
||||
CZMQ_EXPORT zlist_t *
|
||||
zconfig_comments (zconfig_t *self);
|
||||
|
||||
// Save a config tree to a specified ZPL text file, where a filename
|
||||
// "-" means dump to standard output.
|
||||
CZMQ_EXPORT int
|
||||
zconfig_save (zconfig_t *self, const char *filename);
|
||||
|
||||
// Equivalent to zconfig_save, taking a format string instead of a fixed
|
||||
// filename.
|
||||
CZMQ_EXPORT int
|
||||
zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
|
||||
|
||||
// Report filename used during zconfig_load, or NULL if none
|
||||
CZMQ_EXPORT const char *
|
||||
zconfig_filename (zconfig_t *self);
|
||||
|
||||
// Reload config tree from same file that it was previously loaded from.
|
||||
// Returns 0 if OK, -1 if there was an error (and then does not change
|
||||
// existing data).
|
||||
CZMQ_EXPORT int
|
||||
zconfig_reload (zconfig_t **self_p);
|
||||
|
||||
// Load a config tree from a memory chunk
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_chunk_load (zchunk_t *chunk);
|
||||
|
||||
// Save a config tree to a new memory chunk
|
||||
CZMQ_EXPORT zchunk_t *
|
||||
zconfig_chunk_save (zconfig_t *self);
|
||||
|
||||
// Load a config tree from a null-terminated string
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zconfig_t *
|
||||
zconfig_str_load (const char *string);
|
||||
|
||||
// Save a config tree to a new null terminated string
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT char *
|
||||
zconfig_str_save (zconfig_t *self);
|
||||
|
||||
// Return true if a configuration tree was loaded from a file and that
|
||||
// file has changed in since the tree was loaded.
|
||||
CZMQ_EXPORT bool
|
||||
zconfig_has_changed (zconfig_t *self);
|
||||
|
||||
// Print the config file to open stream
|
||||
CZMQ_EXPORT void
|
||||
zconfig_fprint (zconfig_t *self, FILE *file);
|
||||
|
||||
// Print properties of object
|
||||
CZMQ_EXPORT void
|
||||
zconfig_print (zconfig_t *self);
|
||||
|
||||
// Self test of this class
|
||||
CZMQ_EXPORT void
|
||||
zconfig_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
// Self test of this class
|
||||
CZMQ_EXPORT void
|
||||
zconfig_test (bool verbose);
|
||||
|
||||
// Compiler hints
|
||||
CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Deprecated method aliases
|
||||
#define zconfig_dump(s) zconfig_print(s)
|
||||
#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d))
|
||||
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
/* =========================================================================
|
||||
zdigest - provides hashing functions (SHA-1 at present)
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZDIGEST_H_INCLUDED__
|
||||
#define __ZDIGEST_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zdigest.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
// Constructor - creates new digest object, which you use to build up a
|
||||
// digest by repeatedly calling zdigest_update() on chunks of data.
|
||||
CZMQ_EXPORT zdigest_t *
|
||||
zdigest_new (void);
|
||||
|
||||
// Destroy a digest object
|
||||
CZMQ_EXPORT void
|
||||
zdigest_destroy (zdigest_t **self_p);
|
||||
|
||||
// Add buffer into digest calculation
|
||||
CZMQ_EXPORT void
|
||||
zdigest_update (zdigest_t *self, const byte *buffer, size_t length);
|
||||
|
||||
// Return final digest hash data. If built without crypto support,
|
||||
// returns NULL.
|
||||
CZMQ_EXPORT const byte *
|
||||
zdigest_data (zdigest_t *self);
|
||||
|
||||
// Return final digest hash size
|
||||
CZMQ_EXPORT size_t
|
||||
zdigest_size (zdigest_t *self);
|
||||
|
||||
// Return digest as printable hex string; caller should not modify nor
|
||||
// free this string. After calling this, you may not use zdigest_update()
|
||||
// on the same digest. If built without crypto support, returns NULL.
|
||||
CZMQ_EXPORT char *
|
||||
zdigest_string (zdigest_t *self);
|
||||
|
||||
// Self test of this class.
|
||||
CZMQ_EXPORT void
|
||||
zdigest_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,149 +0,0 @@
|
||||
/* =========================================================================
|
||||
zdir - work with file-system directories
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZDIR_H_INCLUDED__
|
||||
#define __ZDIR_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zdir.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
// Create a new directory item that loads in the full tree of the specified
|
||||
// path, optionally located under some parent path. If parent is "-", then
|
||||
// loads only the top-level directory, and does not use parent as a path.
|
||||
CZMQ_EXPORT zdir_t *
|
||||
zdir_new (const char *path, const char *parent);
|
||||
|
||||
// Destroy a directory tree and all children it contains.
|
||||
CZMQ_EXPORT void
|
||||
zdir_destroy (zdir_t **self_p);
|
||||
|
||||
// Return directory path
|
||||
CZMQ_EXPORT const char *
|
||||
zdir_path (zdir_t *self);
|
||||
|
||||
// Return last modification time for directory.
|
||||
CZMQ_EXPORT time_t
|
||||
zdir_modified (zdir_t *self);
|
||||
|
||||
// Return total hierarchy size, in bytes of data contained in all files
|
||||
// in the directory tree.
|
||||
CZMQ_EXPORT off_t
|
||||
zdir_cursize (zdir_t *self);
|
||||
|
||||
// Return directory count
|
||||
CZMQ_EXPORT size_t
|
||||
zdir_count (zdir_t *self);
|
||||
|
||||
// Returns a sorted list of zfile objects; Each entry in the list is a pointer
|
||||
// to a zfile_t item already allocated in the zdir tree. Do not destroy the
|
||||
// original zdir tree until you are done with this list.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zlist_t *
|
||||
zdir_list (zdir_t *self);
|
||||
|
||||
// Remove directory, optionally including all files that it contains, at
|
||||
// all levels. If force is false, will only remove the directory if empty.
|
||||
// If force is true, will remove all files and all subdirectories.
|
||||
CZMQ_EXPORT void
|
||||
zdir_remove (zdir_t *self, bool force);
|
||||
|
||||
// Calculate differences between two versions of a directory tree.
|
||||
// Returns a list of zdir_patch_t patches. Either older or newer may
|
||||
// be null, indicating the directory is empty/absent. If alias is set,
|
||||
// generates virtual filename (minus path, plus alias).
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zlist_t *
|
||||
zdir_diff (zdir_t *older, zdir_t *newer, const char *alias);
|
||||
|
||||
// Return full contents of directory as a zdir_patch list.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zlist_t *
|
||||
zdir_resync (zdir_t *self, const char *alias);
|
||||
|
||||
// Load directory cache; returns a hash table containing the SHA-1 digests
|
||||
// of every file in the tree. The cache is saved between runs in .cache.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zhash_t *
|
||||
zdir_cache (zdir_t *self);
|
||||
|
||||
// Print contents of directory to open stream
|
||||
CZMQ_EXPORT void
|
||||
zdir_fprint (zdir_t *self, FILE *file, int indent);
|
||||
|
||||
// Print contents of directory to stdout
|
||||
CZMQ_EXPORT void
|
||||
zdir_print (zdir_t *self, int indent);
|
||||
|
||||
// Create a new zdir_watch actor instance:
|
||||
//
|
||||
// zactor_t *watch = zactor_new (zdir_watch, NULL);
|
||||
//
|
||||
// Destroy zdir_watch instance:
|
||||
//
|
||||
// zactor_destroy (&watch);
|
||||
//
|
||||
// Enable verbose logging of commands and activity:
|
||||
//
|
||||
// zstr_send (watch, "VERBOSE");
|
||||
//
|
||||
// Subscribe to changes to a directory path:
|
||||
//
|
||||
// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path");
|
||||
//
|
||||
// Unsubscribe from changes to a directory path:
|
||||
//
|
||||
// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path");
|
||||
//
|
||||
// Receive directory changes:
|
||||
// zsock_recv (watch, "sp", &path, &patches);
|
||||
//
|
||||
// // Delete the received data.
|
||||
// free (path);
|
||||
// zlist_destroy (&patches);
|
||||
CZMQ_EXPORT void
|
||||
zdir_watch (zsock_t *pipe, void *unused);
|
||||
|
||||
// Self test of this class.
|
||||
CZMQ_EXPORT void
|
||||
zdir_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
|
||||
// Returns a sorted array of zfile objects; returns a single block of memory,
|
||||
// that you destroy by calling zstr_free(). Each entry in the array is a pointer
|
||||
// to a zfile_t item already allocated in the zdir tree. The array ends with
|
||||
// a null pointer. Do not destroy the original zdir tree until you are done
|
||||
// with this array.
|
||||
CZMQ_EXPORT zfile_t **
|
||||
zdir_flatten (zdir_t *self);
|
||||
|
||||
// Free a provided string, and nullify the parent pointer. Safe to call on
|
||||
// a null pointer.
|
||||
CZMQ_EXPORT void
|
||||
zdir_flatten_free (zfile_t ***files_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Deprecated method aliases
|
||||
#define zdir_dump(s,i) zdir_print(s,i)
|
||||
|
||||
#endif
|
||||
@@ -1,82 +0,0 @@
|
||||
/* =========================================================================
|
||||
zdir_patch - work with directory patches
|
||||
|
||||
Copyright (c) the Contributors as noted in the AUTHORS file.
|
||||
This file is part of CZMQ, the high-level C binding for 0MQ:
|
||||
http://czmq.zeromq.org.
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __ZDIR_PATCH_H_INCLUDED__
|
||||
#define __ZDIR_PATCH_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// un-namespaced enumeration values
|
||||
#define patch_create ZDIR_PATCH_CREATE
|
||||
#define patch_delete ZDIR_PATCH_DELETE
|
||||
|
||||
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
||||
// @warning Please edit the model at "api/zdir_patch.api" to make changes.
|
||||
// @interface
|
||||
// This is a stable class, and may not change except for emergencies. It
|
||||
// is provided in stable builds.
|
||||
#define ZDIR_PATCH_CREATE 1 // Creates a new file
|
||||
#define ZDIR_PATCH_DELETE 2 // Delete a file
|
||||
|
||||
// Create new patch
|
||||
CZMQ_EXPORT zdir_patch_t *
|
||||
zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias);
|
||||
|
||||
// Destroy a patch
|
||||
CZMQ_EXPORT void
|
||||
zdir_patch_destroy (zdir_patch_t **self_p);
|
||||
|
||||
// Create copy of a patch. If the patch is null, or memory was exhausted,
|
||||
// returns null.
|
||||
// Caller owns return value and must destroy it when done.
|
||||
CZMQ_EXPORT zdir_patch_t *
|
||||
zdir_patch_dup (zdir_patch_t *self);
|
||||
|
||||
// Return patch file directory path
|
||||
CZMQ_EXPORT const char *
|
||||
zdir_patch_path (zdir_patch_t *self);
|
||||
|
||||
// Return patch file item
|
||||
CZMQ_EXPORT zfile_t *
|
||||
zdir_patch_file (zdir_patch_t *self);
|
||||
|
||||
// Return operation
|
||||
CZMQ_EXPORT int
|
||||
zdir_patch_op (zdir_patch_t *self);
|
||||
|
||||
// Return patch virtual file path
|
||||
CZMQ_EXPORT const char *
|
||||
zdir_patch_vpath (zdir_patch_t *self);
|
||||
|
||||
// Calculate hash digest for file (create only)
|
||||
CZMQ_EXPORT void
|
||||
zdir_patch_digest_set (zdir_patch_t *self);
|
||||
|
||||
// Return hash digest for patch file
|
||||
CZMQ_EXPORT const char *
|
||||
zdir_patch_digest (zdir_patch_t *self);
|
||||
|
||||
// Self test of this class.
|
||||
CZMQ_EXPORT void
|
||||
zdir_patch_test (bool verbose);
|
||||
|
||||
// @end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user