Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/manual/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ exclude_patterns = []

html_static_path = ['_static']
html_theme = "furo"
#html_logo = "_static/logos/logo_codac.svg"
html_logo = "_static/logos/logo_codac_christmas.png"
html_logo = "_static/logos/logo_codac.svg"
#html_logo = "_static/logos/logo_codac_christmas.png"
html_favicon = "_static/logos/logo_codac.ico"

# These paths are either relative to html_static_path
Expand Down
25 changes: 17 additions & 8 deletions python/src/core/domains/interval/codac2_py_Interval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <codac2_Interval.h>
#include "codac2_py_Interval_docs.h" // Generated file from Doxygen XML (doxygen2docstring.py):
#include "codac2_py_Interval_impl_docs.h" // Generated file from Doxygen XML (doxygen2docstring.py):
#include "codac2_py_matlab.h"

using namespace std;
using namespace codac2;
Expand Down Expand Up @@ -197,19 +198,27 @@ py::class_<Interval> export_Interval(py::module& m)
INTERVAL_REF_INTERVAL_OPERATORUNIONEQ_CONST_INTERVAL_REF,
"x"_a)

// For MATLAB compatibility
.def("self_union", &Interval::operator|=,
INTERVAL_REF_INTERVAL_OPERATORUNIONEQ_CONST_INTERVAL_REF,
"x"_a)

.def(py::self &= py::self,
INTERVAL_REF_INTERVAL_OPERATORINTEREQ_CONST_INTERVAL_REF,
"x"_a)
;

if constexpr(FOR_MATLAB)
{
// For MATLAB compatibility
.def("self_inter", &Interval::operator&=,
INTERVAL_REF_INTERVAL_OPERATORINTEREQ_CONST_INTERVAL_REF,
"x"_a)
exported_interval_class

.def("self_union", &Interval::operator|=,
INTERVAL_REF_INTERVAL_OPERATORUNIONEQ_CONST_INTERVAL_REF,
"x"_a)

.def("self_inter", &Interval::operator&=,
INTERVAL_REF_INTERVAL_OPERATORINTEREQ_CONST_INTERVAL_REF,
"x"_a)
;
}

exported_interval_class

.def(py::self += double(),
INTERVAL_REF_INTERVAL_OPERATORPLUSEQ_DOUBLE,
Expand Down
29 changes: 19 additions & 10 deletions python/src/core/domains/interval/codac2_py_Interval_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,28 @@ void export_Interval_operations(py::module& m, py::class_<Interval>& py_Interval
INTERVAL_OPERATORINTER_CONST_INTERVAL_REF_CONST_INTERVAL_REF,
"x"_a)

// For MATLAB compatibility
.def("inter", (Interval(*)(const Interval&,const Interval&)) &codac2::operator&,
INTERVAL_OPERATORINTER_CONST_INTERVAL_REF_CONST_INTERVAL_REF,
"x"_a)

.def(py::self | py::self,
INTERVAL_OPERATORUNION_CONST_INTERVAL_REF_CONST_INTERVAL_REF,
"x"_a)

// For MATLAB compatibility
.def("union", (Interval(*)(const Interval&,const Interval&)) &codac2::operator|,
INTERVAL_OPERATORUNION_CONST_INTERVAL_REF_CONST_INTERVAL_REF,
"x"_a)

;

if constexpr(FOR_MATLAB)
{
// For MATLAB compatibility
py_Interval

.def("inter", (Interval(*)(const Interval&,const Interval&)) &codac2::operator&,
INTERVAL_OPERATORINTER_CONST_INTERVAL_REF_CONST_INTERVAL_REF,
"x"_a)

.def("union", (Interval(*)(const Interval&,const Interval&)) &codac2::operator|,
INTERVAL_OPERATORUNION_CONST_INTERVAL_REF_CONST_INTERVAL_REF,
"x"_a)
;
}

py_Interval

.def(+ py::self,
CONST_INTERVAL_REF_OPERATORPLUS_CONST_INTERVAL_REF)
Expand Down
9 changes: 5 additions & 4 deletions src/core/tools/codac2_RobotSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ namespace codac2
assert_release(x0.size() == 4);

double t = 0., dtheta = 0.;
Vector xi = x0;
Vector xi = x0, ui(2);
SampledTraj<Vector> x;
x.set(xi,t);

bool away_from_wpt = false;
while(!wpts.empty())
{
const auto& wpt = wpts.front();
auto ui = controller(xi, wpt);
ui = controller(xi, wpt);

xi[3] += ui[1]*dt;
xi[3] = std::clamp(xi[3], v_min, v_max);
Expand All @@ -71,9 +71,9 @@ namespace codac2
dtheta += r;
xi[2] += r;

u.set(ui,t);
t += dt;
x.set(xi,t);
u.set(ui,t);

double dist_to_goal = std::sqrt(std::pow(wpt[0]-xi[0],2)+std::pow(wpt[1]-xi[1],2));
// If the new waypoint is already below the attainment threshold,
Expand All @@ -87,7 +87,8 @@ namespace codac2
wpts.pop_front();
}
}


u.set(ui,t);
return x;
}
}
2 changes: 1 addition & 1 deletion src/graphics/figures/codac2_Figure2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void Figure2D::draw_box(const IntervalVector& x, const StyleProperties& style)
if(x.max_diam() == 0.)
output_fig->draw_point({x[0].lb(),x[1].lb()}, style);
else
output_fig->draw_box(x,style);
output_fig->draw_box(x & IntervalVector::constant(x.size(),{-9e10,9e10}),style);
}
}

Expand Down