From e7beec7da4367da6b48a1aa65bbb3e9879f63217 Mon Sep 17 00:00:00 2001 From: russt Date: Sat, 21 Jul 2012 15:17:19 +0000 Subject: [PATCH] Merge branch 'master' into cleanup Conflicts: Contents.m configure.m examples/Acrobot/runDircol.m runAllTests.m systems/@DynamicalSystem/runLCM.m systems/@PolynomialSystem/PolynomialSystem.m systems/@PolynomialTrajectorySystem/PolynomialTrajectorySystem.m systems/plants/Manipulator.m git-svn-id: https://svn.csail.mit.edu/locomotion/robotlib/branches/class-hierarchy-cleanup@3351 c9849af7-e679-4ec6-a44e-fc146a885bd3 --- Contents.m | 2 +- LICENSE.TXT | 30 +++++++++++ configure.m | 23 ++++++++- deploy.sh | 77 +++++++++++++++++++++++++++++ systems/@DrakeSystem/DrakeSystem.m | 22 +++++++-- systems/@DynamicalSystem/simulate.m | 4 ++ util/TaylorVar.m | 2 +- 7 files changed, 151 insertions(+), 9 deletions(-) create mode 100644 LICENSE.TXT create mode 100755 deploy.sh diff --git a/Contents.m b/Contents.m index 735b322d139c..1a2663ecda5b 100644 --- a/Contents.m +++ b/Contents.m @@ -1,5 +1,5 @@ % Drake Toolbox -% Version 3.1.0 11-May-2012 +% Version 4.0.0 (2019b) 21-July-2012 % % MIT Robot Locomotion Group % Drake Main Directory diff --git a/LICENSE.TXT b/LICENSE.TXT new file mode 100644 index 000000000000..6c61d95c8d72 --- /dev/null +++ b/LICENSE.TXT @@ -0,0 +1,30 @@ +All components of Drake are licensed under the BSD 3-Clause +License. + +Copyright (c) 2012, Robot Locomotion Group @ CSAIL 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 +the Massachusetts Institute of Technology 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. diff --git a/configure.m b/configure.m index b695decdcb05..494b9347f0cb 100644 --- a/configure.m +++ b/configure.m @@ -57,10 +57,10 @@ end end end -end +end -% add drake directories to the matlab path +% add package directories to the matlab path addpath([conf.root,'/systems']); addpath([conf.root,'/systems/plants']); addpath([conf.root,'/systems/controllers']); @@ -108,6 +108,25 @@ end conf.sedumi_enabled = logical(exist('sedumi')); +if (conf.sedumi_enabled) + disp('You seem to have SeDuMi installed, so I am just going to check that it runs properly.'); + disp('-------------------------------------------------------------------------------------'); + sedumiA=[10,2,3,4;5,7,6,4]; + sedumib=[4;6]; + sedumic=[0;1;0;1]; + sedumiT=sedumi(sedumiA,sedumib,sedumic); + if(~sedumiT) + disp('-------------------------------------------------------------------------------------'); + error('SeDuMi seems to have encountered a problem. Please verify that your SeDuMi install is working.'); + disp('-------------------------------------------------------------------------------------'); + else + disp('-------------------------------------------------------------------------------------'); + disp('SeDuMi seems to be working - that''s what all the output, above, is showing.'); + disp('-------------------------------------------------------------------------------------'); + end + +end + if (~conf.sedumi_enabled) disp(' SeDuMi not found. SeDuMi support will be disabled. To re-enable, add SeDuMi to your matlab path and rerun configure. SeDuMi can be downloaded for free from http://sedumi.ie.lehigh.edu/ '); end diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 000000000000..f6059aa4e66b --- /dev/null +++ b/deploy.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +## deploy.sh - a bash script that generates a +## deployable PUBLIC bundle of Drake. + +## DO NOT RUN THIS FROM THE TRUNK!!!!! +## You will need to run this from a working copy +## of the "drake" branch of robotlib. + +## You need to always make sure that the following +## number actually matches the last version +## before copy - svn log --verbose --stop-on-copy +## will tell you what that is + +SVN_LAST_REV_BEFORE_COPY=2845 +SVN_SRC="https://svn.csail.mit.edu/locomotion/robotlib/trunk" + +## TODO: change this once script is working +## this needs to be a working copy of the +## "drake" branch. + +SVN_WORKING_COPY=`pwd` + +## TODO: use credentials here. probably won't need this +## if we run from Hudson, or manually. +# SVN_USERNAME="" +# SNV_PASSWORD="" + +## start by getting trunk merged over to us +echo "Going to svn merge trunk over to us..." +cd $SVN_WORKING_COPY +svn merge -r $SVN_LAST_REV_BEFORE_COPY:HEAD $SVN_SRC +echo "Done." + +## Remove .svn directories. +echo "Removing all SVN housekeeping files..." +find . -depth -type d -name .svn -exec rm -rf {} \; +echo "Done." + +# Remove dev directories +echo "Removing all dev directories..." +find . -depth -type d -name dev -exec rm -rf {} \; +echo "Done." + +## Remove NORELEASE directories +echo "Getting rid of NORELEASE directories..." +for dir in `find . -type d -print`; +do + if [ -e $dir/.NORELEASE ] + then + echo "Removing $dir" + rm -rf $dir + fi +done +echo "Done." + +## Remove NORELEASE files +echo "Getting rid of NORELEASE files..." +for file in `find . -type f` +do grep -q NORELEASE $file && rm $file +done + +echo "Done." +echo "Release stripping is complete." + +echo "Making a .tar.gz now..." +cd ../ +tar cvf /tmp/drake.tar drake && gzip /tmp/drake.tar +echo "Done." +echo "The tar.gz is now at /tmp/drake.tar.gz." + +echo "Making a .zip file now..." +zip -r /tmp/drake.zip drake +echo "Done." +echo "The zipfile is now at /tmp/drake.zip." + +echo "All packaging is complete. Enjoy!" \ No newline at end of file diff --git a/systems/@DrakeSystem/DrakeSystem.m b/systems/@DrakeSystem/DrakeSystem.m index ba4c864fc8b3..a44258886b84 100644 --- a/systems/@DrakeSystem/DrakeSystem.m +++ b/systems/@DrakeSystem/DrakeSystem.m @@ -2,7 +2,7 @@ % A DynamicalSystem with the functionality (dynamics, update, outputs, % etc) implemented in matlab, so that it is amenable to, for instance, symbolic % manipulations. These functions are wrapped as an S-Function in -% RLCSFunction.cpp. +% DCSFunction.cpp. % constructor methods @@ -136,6 +136,13 @@ obj.direct_feedthrough_flag = tf; end function mdl = getModel(obj) + % First, make sure we have a compiled DCSFunction + if(exist('DCSFunction') ~=3) + errorMsg={'Sorry, you have not run ''make'' yet in the drake root,' + 'which means you do not have the compiled MEX files needed to run this program.' + 'Running configure and make in the drake root directory will fix this.'}; + error(sprintf('%s\n',errorMsg{:})) + end % make a simulink model from this block mdl = [class(obj),'_',obj.uid]; % use the class name + uid as the model name close_system(mdl,0); % close it if there is an instance already open @@ -171,7 +178,7 @@ end end - function x = resolveConstraints(obj,x0,v) + function [x,success] = resolveConstraints(obj,x0,v) % attempts to find a x which satisfies the constraints, % using x0 as the initial guess. % @@ -179,8 +186,9 @@ % @param v (optional) a visualizer that should be called while the % solver is doing it's thing - if (obj.num_con < 1) + if (obj.num_xcon < 1) x=x0; + success=true; return; end @@ -189,12 +197,16 @@ v.draw(0,x); end - if (nargin>1 && ~isempty(v)) % useful for debugging (only but only works for URDF manipulators) + if (nargin>2 && ~isempty(v)) % useful for debugging (only but only works for URDF manipulators) options=optimset('Display','iter','Algorithm','levenberg-marquardt','OutputFcn',@drawme,'TolX',1e-9); else options=optimset('Display','off','Algorithm','levenberg-marquardt'); end - x = fsolve(@(x)stateConstraints(obj,x),x0,options); + [x,~,exitflag] = fsolve(@(x)stateConstraints(obj,x),x0,options); + success=(exitflag==1); + if (nargout<2 && ~success) + error('failed to resolve constraints'); + end end end diff --git a/systems/@DynamicalSystem/simulate.m b/systems/@DynamicalSystem/simulate.m index 869e1be194ce..4d36ea3c00f3 100644 --- a/systems/@DynamicalSystem/simulate.m +++ b/systems/@DynamicalSystem/simulate.m @@ -10,6 +10,10 @@ % For variable step solver only % @option OutputTimes to generate output in the time sequence options.OutputTimes +if(exist('DCSFunction') ~=3) + error('Sorry, it looks like yo have not run make yet. Please run configure and make, then rerun drake.') +end + typecheck(tspan,'double'); if (length(tspan)<2) error('length(tspan) must be > 1'); end if (nargin<4) options=struct([]); end diff --git a/util/TaylorVar.m b/util/TaylorVar.m index 8a9fa45d6cbd..a9f12967cccb 100644 --- a/util/TaylorVar.m +++ b/util/TaylorVar.m @@ -44,7 +44,7 @@ d = reshape(obj.f,obj.dim); for o=1:length(obj.df) if (any(obj.df{o}(:))) - warning('converting taylorvar to double even though it has non-zero gradients. gradient information will be lost!'); + warning('Drake:TaylorVar:DoubleConversion','converting taylorvar to double even though it has non-zero gradients. gradient information will be lost!'); end end end