├── 03478.pdf ├── Ch5.pdf ├── Makefile ├── README.md ├── gui_project ├── arrow-down.png ├── color_pallete.xml ├── libicons.qrc ├── libocct │ ├── draw_primitives.cpp │ ├── draw_primitives.h │ ├── opencascade.cpp │ └── opencascade.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── motion.pro └── pallete.xml ├── libscurve.so ├── libscurve.so.1 ├── libscurve.so.1.0 ├── libscurve.so.1.0.0 ├── scurve.cpp ├── scurve.h ├── scurve.o └── scurve.pro /03478.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grotius-cnc/s-curve-motion-planning/2d716ad59e6fd79b65df2d93dacac4eebfd0fd6f/03478.pdf -------------------------------------------------------------------------------- /Ch5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grotius-cnc/s-curve-motion-planning/2d716ad59e6fd79b65df2d93dacac4eebfd0fd6f/Ch5.pdf -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # Makefile for building: libscurve.so.1.0.0 3 | # Generated by qmake (3.1) (Qt 5.15.1) 4 | # Project: scurve.pro 5 | # Template: lib 6 | # Command: /opt/qt-creator/5.15.1/gcc_64/bin/qmake -o Makefile scurve.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug 7 | ############################################################################# 8 | 9 | MAKEFILE = Makefile 10 | 11 | EQ = = 12 | 13 | ####### Compiler, tools and options 14 | 15 | CC = gcc 16 | CXX = g++ 17 | DEFINES = -DSCURVE_LIBRARY -DQT_QML_DEBUG 18 | CFLAGS = -pipe -g -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES) 19 | CXXFLAGS = -pipe -g -std=gnu++11 -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES) 20 | INCPATH = -I. -I/opt/qt-creator/5.15.1/gcc_64/mkspecs/linux-g++ 21 | QMAKE = /opt/qt-creator/5.15.1/gcc_64/bin/qmake 22 | DEL_FILE = rm -f 23 | CHK_DIR_EXISTS= test -d 24 | MKDIR = mkdir -p 25 | COPY = cp -f 26 | COPY_FILE = cp -f 27 | COPY_DIR = cp -f -R 28 | INSTALL_FILE = install -m 644 -p 29 | INSTALL_PROGRAM = install -m 755 -p 30 | INSTALL_DIR = cp -f -R 31 | QINSTALL = /opt/qt-creator/5.15.1/gcc_64/bin/qmake -install qinstall 32 | QINSTALL_PROGRAM = /opt/qt-creator/5.15.1/gcc_64/bin/qmake -install qinstall -exe 33 | DEL_FILE = rm -f 34 | SYMLINK = ln -f -s 35 | DEL_DIR = rmdir 36 | MOVE = mv -f 37 | TAR = tar -cf 38 | COMPRESS = gzip -9f 39 | DISTNAME = scurve1.0.0 40 | DISTDIR = /opt/hal-core/src/hal/components/matrix/cpp_interface/libscurve/.tmp/scurve1.0.0 41 | LINK = g++ 42 | LFLAGS = -shared -Wl,-soname,libscurve.so.1 43 | LIBS = $(SUBLIBS) -lpthread 44 | AR = ar cqs 45 | RANLIB = 46 | SED = sed 47 | STRIP = strip 48 | 49 | ####### Output directory 50 | 51 | OBJECTS_DIR = ./ 52 | 53 | ####### Files 54 | 55 | SOURCES = scurve.cpp 56 | OBJECTS = scurve.o 57 | DIST = /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/spec_pre.prf \ 58 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/unix.conf \ 59 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/linux.conf \ 60 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/sanitize.conf \ 61 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/gcc-base.conf \ 62 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/gcc-base-unix.conf \ 63 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/g++-base.conf \ 64 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/g++-unix.conf \ 65 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/qconfig.pri \ 66 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3danimation.pri \ 67 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3danimation_private.pri \ 68 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dcore.pri \ 69 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dcore_private.pri \ 70 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dextras.pri \ 71 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dextras_private.pri \ 72 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dinput.pri \ 73 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dinput_private.pri \ 74 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dlogic.pri \ 75 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dlogic_private.pri \ 76 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquick.pri \ 77 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquick_private.pri \ 78 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation.pri \ 79 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation_private.pri \ 80 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras.pri \ 81 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras_private.pri \ 82 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput.pri \ 83 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput_private.pri \ 84 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender.pri \ 85 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender_private.pri \ 86 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d.pri \ 87 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d_private.pri \ 88 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3drender.pri \ 89 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3drender_private.pri \ 90 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_accessibility_support_private.pri \ 91 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bluetooth.pri \ 92 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bluetooth_private.pri \ 93 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bootstrap_private.pri \ 94 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_concurrent.pri \ 95 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_concurrent_private.pri \ 96 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_core.pri \ 97 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_core_private.pri \ 98 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_dbus.pri \ 99 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_dbus_private.pri \ 100 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designer.pri \ 101 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designer_private.pri \ 102 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designercomponents_private.pri \ 103 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ 104 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_edid_support_private.pri \ 105 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_egl_support_private.pri \ 106 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ 107 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ 108 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ 109 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_fb_support_private.pri \ 110 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ 111 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gamepad.pri \ 112 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gamepad_private.pri \ 113 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_glx_support_private.pri \ 114 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gui.pri \ 115 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gui_private.pri \ 116 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_help.pri \ 117 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_help_private.pri \ 118 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_input_support_private.pri \ 119 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_kms_support_private.pri \ 120 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ 121 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_location.pri \ 122 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_location_private.pri \ 123 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimedia.pri \ 124 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimedia_private.pri \ 125 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediagsttools_private.pri \ 126 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets.pri \ 127 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets_private.pri \ 128 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_network.pri \ 129 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_network_private.pri \ 130 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_nfc.pri \ 131 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_nfc_private.pri \ 132 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_opengl.pri \ 133 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_opengl_private.pri \ 134 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_openglextensions.pri \ 135 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_openglextensions_private.pri \ 136 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_packetprotocol_private.pri \ 137 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ 138 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioning.pri \ 139 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioning_private.pri \ 140 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioningquick.pri \ 141 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioningquick_private.pri \ 142 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_printsupport.pri \ 143 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_printsupport_private.pri \ 144 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qml.pri \ 145 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qml_private.pri \ 146 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmldebug_private.pri \ 147 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmldevtools_private.pri \ 148 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlmodels.pri \ 149 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlmodels_private.pri \ 150 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmltest.pri \ 151 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmltest_private.pri \ 152 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlworkerscript.pri \ 153 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlworkerscript_private.pri \ 154 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \ 155 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quick.pri \ 156 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quick_private.pri \ 157 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2.pri \ 158 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri \ 159 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickparticles_private.pri \ 160 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickshapes_private.pri \ 161 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quicktemplates2.pri \ 162 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri \ 163 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets.pri \ 164 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets_private.pri \ 165 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_remoteobjects.pri \ 166 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_remoteobjects_private.pri \ 167 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_repparser.pri \ 168 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_repparser_private.pri \ 169 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_scxml.pri \ 170 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_scxml_private.pri \ 171 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sensors.pri \ 172 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sensors_private.pri \ 173 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialbus.pri \ 174 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialbus_private.pri \ 175 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialport.pri \ 176 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialport_private.pri \ 177 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_service_support_private.pri \ 178 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sql.pri \ 179 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sql_private.pri \ 180 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_svg.pri \ 181 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_svg_private.pri \ 182 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_testlib.pri \ 183 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_testlib_private.pri \ 184 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_texttospeech.pri \ 185 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_texttospeech_private.pri \ 186 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_theme_support_private.pri \ 187 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uiplugin.pri \ 188 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uitools.pri \ 189 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uitools_private.pri \ 190 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_vulkan_support_private.pri \ 191 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_waylandclient.pri \ 192 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_waylandclient_private.pri \ 193 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webchannel.pri \ 194 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webchannel_private.pri \ 195 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_websockets.pri \ 196 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_websockets_private.pri \ 197 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webview.pri \ 198 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webview_private.pri \ 199 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_widgets.pri \ 200 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_widgets_private.pri \ 201 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_x11extras.pri \ 202 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_x11extras_private.pri \ 203 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ 204 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \ 205 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xml.pri \ 206 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xml_private.pri \ 207 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns.pri \ 208 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns_private.pri \ 209 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt_functions.prf \ 210 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt_config.prf \ 211 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/linux-g++/qmake.conf \ 212 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/spec_post.prf \ 213 | ../.qmake.stash \ 214 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/exclusive_builds.prf \ 215 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/toolchain.prf \ 216 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/default_pre.prf \ 217 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/resolve_config.prf \ 218 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/default_post.prf \ 219 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qml_debug.prf \ 220 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/warn_on.prf \ 221 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt.prf \ 222 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/unix/thread.prf \ 223 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qmake_use.prf \ 224 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/file_copies.prf \ 225 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/testcase_targets.prf \ 226 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/exceptions.prf \ 227 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/yacc.prf \ 228 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/lex.prf \ 229 | scurve.pro scurve.h scurve.cpp 230 | QMAKE_TARGET = scurve 231 | DESTDIR = 232 | TARGET = libscurve.so.1.0.0 233 | TARGETA = libscurve.a 234 | TARGET0 = libscurve.so 235 | TARGETD = libscurve.so.1.0.0 236 | TARGET1 = libscurve.so.1 237 | TARGET2 = libscurve.so.1.0 238 | 239 | 240 | first: all 241 | ####### Build rules 242 | 243 | libscurve.so.1.0.0: $(OBJECTS) $(SUBLIBS) $(OBJCOMP) 244 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) 245 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) 246 | -ln -s $(TARGET) $(TARGET0) 247 | -ln -s $(TARGET) $(TARGET1) 248 | -ln -s $(TARGET) $(TARGET2) 249 | 250 | 251 | 252 | staticlib: libscurve.a 253 | 254 | libscurve.a: $(OBJECTS) $(OBJCOMP) 255 | -$(DEL_FILE) $(TARGETA) 256 | $(AR) $(TARGETA) $(OBJECTS) 257 | 258 | Makefile: scurve.pro /opt/qt-creator/5.15.1/gcc_64/mkspecs/linux-g++/qmake.conf /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/spec_pre.prf \ 259 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/unix.conf \ 260 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/linux.conf \ 261 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/sanitize.conf \ 262 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/gcc-base.conf \ 263 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/gcc-base-unix.conf \ 264 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/g++-base.conf \ 265 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/g++-unix.conf \ 266 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/qconfig.pri \ 267 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3danimation.pri \ 268 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3danimation_private.pri \ 269 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dcore.pri \ 270 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dcore_private.pri \ 271 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dextras.pri \ 272 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dextras_private.pri \ 273 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dinput.pri \ 274 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dinput_private.pri \ 275 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dlogic.pri \ 276 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dlogic_private.pri \ 277 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquick.pri \ 278 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquick_private.pri \ 279 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation.pri \ 280 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation_private.pri \ 281 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras.pri \ 282 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras_private.pri \ 283 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput.pri \ 284 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput_private.pri \ 285 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender.pri \ 286 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender_private.pri \ 287 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d.pri \ 288 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d_private.pri \ 289 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3drender.pri \ 290 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3drender_private.pri \ 291 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_accessibility_support_private.pri \ 292 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bluetooth.pri \ 293 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bluetooth_private.pri \ 294 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bootstrap_private.pri \ 295 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_concurrent.pri \ 296 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_concurrent_private.pri \ 297 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_core.pri \ 298 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_core_private.pri \ 299 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_dbus.pri \ 300 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_dbus_private.pri \ 301 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designer.pri \ 302 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designer_private.pri \ 303 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designercomponents_private.pri \ 304 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ 305 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_edid_support_private.pri \ 306 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_egl_support_private.pri \ 307 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ 308 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ 309 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ 310 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_fb_support_private.pri \ 311 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ 312 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gamepad.pri \ 313 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gamepad_private.pri \ 314 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_glx_support_private.pri \ 315 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gui.pri \ 316 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gui_private.pri \ 317 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_help.pri \ 318 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_help_private.pri \ 319 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_input_support_private.pri \ 320 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_kms_support_private.pri \ 321 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ 322 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_location.pri \ 323 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_location_private.pri \ 324 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimedia.pri \ 325 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimedia_private.pri \ 326 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediagsttools_private.pri \ 327 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets.pri \ 328 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets_private.pri \ 329 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_network.pri \ 330 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_network_private.pri \ 331 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_nfc.pri \ 332 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_nfc_private.pri \ 333 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_opengl.pri \ 334 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_opengl_private.pri \ 335 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_openglextensions.pri \ 336 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_openglextensions_private.pri \ 337 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_packetprotocol_private.pri \ 338 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ 339 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioning.pri \ 340 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioning_private.pri \ 341 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioningquick.pri \ 342 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioningquick_private.pri \ 343 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_printsupport.pri \ 344 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_printsupport_private.pri \ 345 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qml.pri \ 346 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qml_private.pri \ 347 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmldebug_private.pri \ 348 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmldevtools_private.pri \ 349 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlmodels.pri \ 350 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlmodels_private.pri \ 351 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmltest.pri \ 352 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmltest_private.pri \ 353 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlworkerscript.pri \ 354 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlworkerscript_private.pri \ 355 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \ 356 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quick.pri \ 357 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quick_private.pri \ 358 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2.pri \ 359 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri \ 360 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickparticles_private.pri \ 361 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickshapes_private.pri \ 362 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quicktemplates2.pri \ 363 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri \ 364 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets.pri \ 365 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets_private.pri \ 366 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_remoteobjects.pri \ 367 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_remoteobjects_private.pri \ 368 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_repparser.pri \ 369 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_repparser_private.pri \ 370 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_scxml.pri \ 371 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_scxml_private.pri \ 372 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sensors.pri \ 373 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sensors_private.pri \ 374 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialbus.pri \ 375 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialbus_private.pri \ 376 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialport.pri \ 377 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialport_private.pri \ 378 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_service_support_private.pri \ 379 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sql.pri \ 380 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sql_private.pri \ 381 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_svg.pri \ 382 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_svg_private.pri \ 383 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_testlib.pri \ 384 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_testlib_private.pri \ 385 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_texttospeech.pri \ 386 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_texttospeech_private.pri \ 387 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_theme_support_private.pri \ 388 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uiplugin.pri \ 389 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uitools.pri \ 390 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uitools_private.pri \ 391 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_vulkan_support_private.pri \ 392 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_waylandclient.pri \ 393 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_waylandclient_private.pri \ 394 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webchannel.pri \ 395 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webchannel_private.pri \ 396 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_websockets.pri \ 397 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_websockets_private.pri \ 398 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webview.pri \ 399 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webview_private.pri \ 400 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_widgets.pri \ 401 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_widgets_private.pri \ 402 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_x11extras.pri \ 403 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_x11extras_private.pri \ 404 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ 405 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \ 406 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xml.pri \ 407 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xml_private.pri \ 408 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns.pri \ 409 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns_private.pri \ 410 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt_functions.prf \ 411 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt_config.prf \ 412 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/linux-g++/qmake.conf \ 413 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/spec_post.prf \ 414 | ../.qmake.stash \ 415 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/exclusive_builds.prf \ 416 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/toolchain.prf \ 417 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/default_pre.prf \ 418 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/resolve_config.prf \ 419 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/default_post.prf \ 420 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qml_debug.prf \ 421 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/warn_on.prf \ 422 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt.prf \ 423 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/unix/thread.prf \ 424 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qmake_use.prf \ 425 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/file_copies.prf \ 426 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/testcase_targets.prf \ 427 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/exceptions.prf \ 428 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/yacc.prf \ 429 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/lex.prf \ 430 | scurve.pro 431 | $(QMAKE) -o Makefile scurve.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug 432 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/spec_pre.prf: 433 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/unix.conf: 434 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/linux.conf: 435 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/sanitize.conf: 436 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/gcc-base.conf: 437 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/gcc-base-unix.conf: 438 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/g++-base.conf: 439 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/common/g++-unix.conf: 440 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/qconfig.pri: 441 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3danimation.pri: 442 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3danimation_private.pri: 443 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dcore.pri: 444 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dcore_private.pri: 445 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dextras.pri: 446 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dextras_private.pri: 447 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dinput.pri: 448 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dinput_private.pri: 449 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dlogic.pri: 450 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dlogic_private.pri: 451 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquick.pri: 452 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquick_private.pri: 453 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation.pri: 454 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation_private.pri: 455 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras.pri: 456 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras_private.pri: 457 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput.pri: 458 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput_private.pri: 459 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender.pri: 460 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender_private.pri: 461 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d.pri: 462 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d_private.pri: 463 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3drender.pri: 464 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_3drender_private.pri: 465 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_accessibility_support_private.pri: 466 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bluetooth.pri: 467 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bluetooth_private.pri: 468 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_bootstrap_private.pri: 469 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_concurrent.pri: 470 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_concurrent_private.pri: 471 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_core.pri: 472 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_core_private.pri: 473 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_dbus.pri: 474 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_dbus_private.pri: 475 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designer.pri: 476 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designer_private.pri: 477 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_designercomponents_private.pri: 478 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri: 479 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_edid_support_private.pri: 480 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_egl_support_private.pri: 481 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri: 482 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri: 483 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri: 484 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_fb_support_private.pri: 485 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_fontdatabase_support_private.pri: 486 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gamepad.pri: 487 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gamepad_private.pri: 488 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_glx_support_private.pri: 489 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gui.pri: 490 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_gui_private.pri: 491 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_help.pri: 492 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_help_private.pri: 493 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_input_support_private.pri: 494 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_kms_support_private.pri: 495 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri: 496 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_location.pri: 497 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_location_private.pri: 498 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimedia.pri: 499 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimedia_private.pri: 500 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediagsttools_private.pri: 501 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets.pri: 502 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets_private.pri: 503 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_network.pri: 504 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_network_private.pri: 505 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_nfc.pri: 506 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_nfc_private.pri: 507 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_opengl.pri: 508 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_opengl_private.pri: 509 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_openglextensions.pri: 510 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_openglextensions_private.pri: 511 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_packetprotocol_private.pri: 512 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_platformcompositor_support_private.pri: 513 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioning.pri: 514 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioning_private.pri: 515 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioningquick.pri: 516 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_positioningquick_private.pri: 517 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_printsupport.pri: 518 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_printsupport_private.pri: 519 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qml.pri: 520 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qml_private.pri: 521 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmldebug_private.pri: 522 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmldevtools_private.pri: 523 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlmodels.pri: 524 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlmodels_private.pri: 525 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmltest.pri: 526 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmltest_private.pri: 527 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlworkerscript.pri: 528 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qmlworkerscript_private.pri: 529 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri: 530 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quick.pri: 531 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quick_private.pri: 532 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2.pri: 533 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri: 534 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickparticles_private.pri: 535 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickshapes_private.pri: 536 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quicktemplates2.pri: 537 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri: 538 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets.pri: 539 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets_private.pri: 540 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_remoteobjects.pri: 541 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_remoteobjects_private.pri: 542 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_repparser.pri: 543 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_repparser_private.pri: 544 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_scxml.pri: 545 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_scxml_private.pri: 546 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sensors.pri: 547 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sensors_private.pri: 548 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialbus.pri: 549 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialbus_private.pri: 550 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialport.pri: 551 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_serialport_private.pri: 552 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_service_support_private.pri: 553 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sql.pri: 554 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_sql_private.pri: 555 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_svg.pri: 556 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_svg_private.pri: 557 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_testlib.pri: 558 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_testlib_private.pri: 559 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_texttospeech.pri: 560 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_texttospeech_private.pri: 561 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_theme_support_private.pri: 562 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uiplugin.pri: 563 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uitools.pri: 564 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_uitools_private.pri: 565 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_vulkan_support_private.pri: 566 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_waylandclient.pri: 567 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_waylandclient_private.pri: 568 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webchannel.pri: 569 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webchannel_private.pri: 570 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_websockets.pri: 571 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_websockets_private.pri: 572 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webview.pri: 573 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_webview_private.pri: 574 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_widgets.pri: 575 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_widgets_private.pri: 576 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_x11extras.pri: 577 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_x11extras_private.pri: 578 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri: 579 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xkbcommon_support_private.pri: 580 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xml.pri: 581 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xml_private.pri: 582 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns.pri: 583 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns_private.pri: 584 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt_functions.prf: 585 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt_config.prf: 586 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/linux-g++/qmake.conf: 587 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/spec_post.prf: 588 | ../.qmake.stash: 589 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/exclusive_builds.prf: 590 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/toolchain.prf: 591 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/default_pre.prf: 592 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/resolve_config.prf: 593 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/default_post.prf: 594 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qml_debug.prf: 595 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/warn_on.prf: 596 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qt.prf: 597 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/unix/thread.prf: 598 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/qmake_use.prf: 599 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/file_copies.prf: 600 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/testcase_targets.prf: 601 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/exceptions.prf: 602 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/yacc.prf: 603 | /opt/qt-creator/5.15.1/gcc_64/mkspecs/features/lex.prf: 604 | scurve.pro: 605 | qmake: FORCE 606 | @$(QMAKE) -o Makefile scurve.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug 607 | 608 | qmake_all: FORCE 609 | 610 | 611 | all: Makefile libscurve.so.1.0.0 612 | 613 | dist: distdir FORCE 614 | (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR) 615 | 616 | distdir: FORCE 617 | @test -d $(DISTDIR) || mkdir -p $(DISTDIR) 618 | $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ 619 | 620 | 621 | clean: compiler_clean 622 | -$(DEL_FILE) $(OBJECTS) 623 | -$(DEL_FILE) *~ core *.core 624 | 625 | 626 | distclean: clean 627 | -$(DEL_FILE) $(TARGET) 628 | -$(DEL_FILE) $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) 629 | -$(DEL_FILE) Makefile 630 | 631 | 632 | ####### Sub-libraries 633 | 634 | check: first 635 | 636 | benchmark: first 637 | 638 | compiler_yacc_decl_make_all: 639 | compiler_yacc_decl_clean: 640 | compiler_yacc_impl_make_all: 641 | compiler_yacc_impl_clean: 642 | compiler_lex_make_all: 643 | compiler_lex_clean: 644 | compiler_clean: 645 | 646 | ####### Compile 647 | 648 | scurve.o: scurve.cpp scurve.h 649 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o scurve.o scurve.cpp 650 | 651 | ####### Install 652 | 653 | install_target: first FORCE 654 | @test -d $(INSTALL_ROOT)/usr/lib || mkdir -p $(INSTALL_ROOT)/usr/lib 655 | $(QINSTALL_PROGRAM) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET) 656 | -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET0) 657 | -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET1) 658 | -$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/$(TARGET2) 659 | 660 | uninstall_target: FORCE 661 | -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET) 662 | -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET0) 663 | -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET1) 664 | -$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/$(TARGET2) 665 | -$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/ 666 | 667 | 668 | install: install_target FORCE 669 | 670 | uninstall: uninstall_target FORCE 671 | 672 | FORCE: 673 | 674 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # S-curve-motion-planning. 2 | 3 | [![grotius-cnc - s-curve-motion-planning](https://img.shields.io/static/v1?label=grotius-cnc&message=s-curve-motion-planning&color=blue&logo=github)](https://github.com/grotius-cnc/s-curve-motion-planning "Go to GitHub repo") 4 | [![stars - s-curve-motion-planning](https://img.shields.io/github/stars/grotius-cnc/s-curve-motion-planning?style=social)](https://github.com/grotius-cnc/s-curve-motion-planning) 5 | [![forks - s-curve-motion-planning](https://img.shields.io/github/forks/grotius-cnc/s-curve-motion-planning?style=social)](https://github.com/grotius-cnc/s-curve-motion-planning) 6 | 7 | [![GitHub release](https://img.shields.io/github/release/grotius-cnc/s-curve-motion-planning?include_prereleases=&sort=semver&color=blue)](https://github.com/grotius-cnc/s-curve-motion-planning/releases/) 8 | [![License](https://img.shields.io/badge/License-MIT-blue)](#license) 9 | 10 | The purpose of this material is to impart an understanding of polynomial transitions for a trajectory generator. The ideal constant jerk S-curve 11 | (jerk is the derivate of acceleration and a measure of impact) can be represented by a second-order polynomial in velocity (3rd in position). 12 | Its shape is governed by the motion conditions at the start and end of the transition. 13 | 14 | An S-curve with an intermediate constant acceleration (lineair portion) is often used to reduce the time to make large speed changes. The jerk can be 15 | used to determine how much of the rise or fall period can be made under constant acceleration. 16 | 17 | ## Implementation: 18 | 19 | - Velocity up s-curve [acc period]. 20 | - Velocity down s-curve [dcc period]. 21 | - Acceleration begin value. 22 | - Acceleration end value. 23 | - Velocity begin. 24 | - Velocity end. 25 | - Max acceleration. 26 | - Lineair stage. 27 | - Scientific papers included. 28 | 29 | ## Functions: 30 | 31 | //! Inputs: 32 | //! at_time=request displacment at a certain time stamp. 33 | //! vs=velocity max. 34 | //! cs=curve displacement 35 | RESULT scurve_lineair(double at_time, double vs, double cs); 36 | 37 | //! Inputs: 38 | //! sct=scurve type [0=acc, 1=dcc] 39 | //! vo=velocity start 40 | //! vs=velocity max 41 | //! ve=velocity end 42 | //! am=acceleration max 43 | //! acs=acceleration start 44 | //! ace=acceleration end 45 | //! Results: 46 | //! at_time=request curve at [t] 47 | RESULT scurve_acc_dcc(int sct, double vo, double ve, double am, double acs, double ace, double at_time); 48 | 49 | //! Inputs: 50 | //! vs=velocity max. 51 | //! am=acceleration max. 52 | //! vo=velocity begin. 53 | //! acs=acceleration begin. 54 | //! ltot=pathlenght. 55 | //! ve=velocity end. 56 | //! ace=acceleration end. 57 | //! at_time=curve request at time [t] 58 | RESULT motion(double vs, double am, double vo, double acs, double ltot, double ve, double ace, double at_time); 59 | 60 | ## Result: 61 | 62 | struct RESULT{ 63 | //! Displacement result. 64 | double sr=0; 65 | //! Velocity result. 66 | double vr=0; 67 | //! Acceleration result. 68 | double ar=0; 69 | //! Curve time. 70 | double ct=0; 71 | //! Curve displacment. 72 | double cs=0; 73 | //! Error. 74 | bool error=0; 75 | }; 76 | 77 | ## Build in Logic: 78 | 79 | - If maximum velocity can not be reached for a motion, curves are sampled to fit. 80 | - Debug information when input values are out of scope. 81 | - In the /gui_project is a simple path planner example. 82 | 83 | ## Performance: 84 | 85 | Time taken by function nanoseconds: ~1955 milliseconds: ~0.002 86 | 87 | ## Graphics 88 | 89 | ~/gui_project/motion/ 90 | 91 | ![scurve_example2](https://user-images.githubusercontent.com/44880102/147384849-678131e3-c85a-467c-847b-0b81ac620250.jpg) 92 | 93 | To use the opencascade graphics along with the gui project, follow these instructions : 94 | https://github.com/grotius-cnc/oce/releases/tag/1.0.1 95 | 96 | ## Summary 97 | Constant jerk S-curves are used to transition robot moves. The S-curve is used to eliminate discontinuities in acceleration that are detrimental 98 | to robot performance. 99 | 100 | ## License 101 | 102 | Released under [MIT](/LICENSE) by [@grotius-cnc](https://github.com/grotius-cnc). 103 | -------------------------------------------------------------------------------- /gui_project/arrow-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grotius-cnc/s-curve-motion-planning/2d716ad59e6fd79b65df2d93dacac4eebfd0fd6f/gui_project/arrow-down.png -------------------------------------------------------------------------------- /gui_project/color_pallete.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 255 8 | 255 9 | 255 10 | 11 | 12 | 13 | 14 | 15 | 16 | 65 17 | 65 18 | 65 19 | 20 | 21 | 22 | 23 | 24 | 25 | 255 26 | 255 27 | 255 28 | 29 | 30 | 31 | 32 | 33 | 34 | 255 35 | 255 36 | 255 37 | 38 | 39 | 40 | 41 | 42 | 43 | 65 44 | 65 45 | 65 46 | 47 | 48 | 49 | 50 | 51 | 52 | 65 53 | 65 54 | 65 55 | 56 | 57 | 58 | 59 | 60 | 61 | 255 62 | 255 63 | 255 64 | 65 | 66 | 67 | 68 | 69 | 70 | 255 71 | 255 72 | 255 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 255 82 | 255 83 | 255 84 | 85 | 86 | 87 | 88 | 89 | 90 | 65 91 | 65 92 | 65 93 | 94 | 95 | 96 | 97 | 98 | 99 | 255 100 | 255 101 | 255 102 | 103 | 104 | 105 | 106 | 107 | 108 | 255 109 | 255 110 | 255 111 | 112 | 113 | 114 | 115 | 116 | 117 | 65 118 | 65 119 | 65 120 | 121 | 122 | 123 | 124 | 125 | 126 | 65 127 | 65 128 | 65 129 | 130 | 131 | 132 | 133 | 134 | 135 | 255 136 | 255 137 | 255 138 | 139 | 140 | 141 | 142 | 143 | 144 | 255 145 | 255 146 | 255 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 190 156 | 190 157 | 190 158 | 159 | 160 | 161 | 162 | 163 | 164 | 65 165 | 65 166 | 65 167 | 168 | 169 | 170 | 171 | 172 | 173 | 190 174 | 190 175 | 190 176 | 177 | 178 | 179 | 180 | 181 | 182 | 190 183 | 190 184 | 190 185 | 186 | 187 | 188 | 189 | 190 | 191 | 65 192 | 65 193 | 65 194 | 195 | 196 | 197 | 198 | 199 | 200 | 65 201 | 65 202 | 65 203 | 204 | 205 | 206 | 207 | 208 | 209 | 255 210 | 255 211 | 255 212 | 213 | 214 | 215 | 216 | 217 | 218 | 0 219 | 0 220 | 0 221 | 222 | 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /gui_project/libicons.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | arrow-down.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /gui_project/libocct/draw_primitives.cpp: -------------------------------------------------------------------------------- 1 | #include "draw_primitives.h" 2 | 3 | //! Make conversion's easy: 4 | #define toRadians M_PI/180.0 5 | #define toDegrees (180.0/M_PI) 6 | 7 | draw_primitives::draw_primitives() 8 | { 9 | 10 | } 11 | 12 | // Draw 3d solids 13 | Handle(AIS_Shape) draw_primitives::draw_3d_cone(gp_Pnt centerpoint, double bottomdiameter, double topdiameter, double height){ 14 | gp_Dir axis=gp::DX(); 15 | gp_Ax2 aplace(centerpoint,axis); 16 | TopoDS_Shape t_topo_cone = BRepPrimAPI_MakeCone(aplace,bottomdiameter,topdiameter,height).Shape(); 17 | return new AIS_Shape(t_topo_cone); 18 | } 19 | 20 | Handle(AIS_Shape) draw_primitives::draw_3d_tcp_cone(gp_Pnt centerpoint, double bottomdiameter, double topdiameter, double height){ 21 | gp_Dir axis=-gp::DX(); 22 | gp_Ax2 aplace(centerpoint,axis); 23 | TopoDS_Shape t_topo_cone = BRepPrimAPI_MakeCone(aplace,bottomdiameter,topdiameter,height).Shape(); 24 | return new AIS_Shape(t_topo_cone); 25 | } 26 | 27 | Handle(AIS_Shape) draw_primitives::draw_3d_cilinder(double radius, double height){ 28 | TopoDS_Shape t_topo_cylinder = BRepPrimAPI_MakeCylinder(radius , height).Shape(); 29 | return new AIS_Shape(t_topo_cylinder); 30 | } 31 | 32 | Handle(AIS_Shape) draw_primitives::draw_3d_sphere(double radius, gp_Pnt center){ 33 | TopoDS_Shape t_topo_sphere = BRepPrimAPI_MakeSphere(center,radius).Shape(); 34 | return new AIS_Shape(t_topo_sphere); 35 | } 36 | 37 | Handle(AIS_Shape) draw_primitives::draw_3d_box(double dx, double dy, double dz){ 38 | // Create workframe box. 39 | TopoDS_Shape t_topo_box = BRepPrimAPI_MakeBox(dx,dy,dz).Shape(); 40 | Handle(AIS_Shape) t_ais_box = new AIS_Shape(t_topo_box); 41 | return t_ais_box; 42 | } 43 | 44 | // Draw 2d primitives: 45 | Handle(AIS_Shape) draw_primitives::draw_2d_circle(gp_Pnt center,double radius){ 46 | gp_Dir dir(0,0,1); 47 | gp_Circ circle(gp_Ax2( center, dir),radius); 48 | BRepBuilderAPI_MakeEdge makeEdge(circle); 49 | Handle(AIS_Shape) shape = new AIS_Shape(TopoDS_Edge()); 50 | shape ->Set(makeEdge.Edge()); 51 | return shape; 52 | } 53 | 54 | Handle(AIS_Shape) draw_primitives::draw_cp_2d_arc(gp_Pnt center, gp_Pnt point1, gp_Pnt point2){ 55 | 56 | double radius=center.Distance(point2); 57 | gp_Dir dir(0,0,1); // you can change this 58 | gp_Circ circle(gp_Ax2( center, dir),radius); 59 | Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(circle,point1,point2,0); 60 | TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle); 61 | return new AIS_Shape(aEdge2); 62 | } 63 | 64 | Handle(AIS_Shape) draw_primitives::draw_2d_acad_arc(gp_Pnt center, double radius, const Standard_Real alpha1, const Standard_Real alpha2){ 65 | gp_Dir dir(0,0,1); // you can change this 66 | gp_Circ circle(gp_Ax2( center, dir),radius); 67 | Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(circle,alpha1,alpha2,0); 68 | TopoDS_Edge aEdge = BRepBuilderAPI_MakeEdge(aArcOfCircle); 69 | return new AIS_Shape(aEdge); 70 | } 71 | 72 | Handle(AIS_Shape) draw_primitives::draw_2d_ellipse(gp_Pnt center, gp_Pnt secpoint, double alpha_start, double alpha_end, double ratio){ 73 | 74 | //https://github.com/grotius-cnc/QT_CadCam_rev0/blob/master/display/display.h 75 | // Acad's ellipse nr's, https://github.com/grotius-cnc/cadcam/blob/master/dxf/read_ellipse_AC1027.cpp 76 | // x,y,z centerpoint 10,20,30 77 | // x,y,z endpoint mayor 11,21,31 ( coordinates relative to ellipse centerpoint..) 78 | // ratio 40 79 | // start angle 41 80 | // end angle 42 81 | 82 | //Standard_Real alpha1=alpha_start; 83 | //Standard_Real alpha2=alpha_end; 84 | 85 | //center point to endpoint mayor axis.. 86 | double MayorRadius = sqrt(pow(secpoint.X()-center.X(),2) + pow(secpoint.Y()-center.Y(),2) + pow(secpoint.Z()-center.Z(),2)); 87 | //ratio minor axis to mayor axis.. 88 | double MinorRadius = ratio*MayorRadius ; 89 | 90 | gp_Dir xDirection(secpoint.X()-center.X(),secpoint.Y()-center.Y(),secpoint.Z()-center.Z()); // Direction is auto normalized by occ. 91 | gp_Dir normalDirection(0,0,1); 92 | gp_Ax2 axis(center,normalDirection,xDirection); 93 | 94 | gp_Elips ellipse(axis,MayorRadius,MinorRadius); 95 | Handle(Geom_TrimmedCurve) aArcOfEllipse = GC_MakeArcOfEllipse(ellipse,alpha_start,alpha_end,0); 96 | TopoDS_Edge aEdge = BRepBuilderAPI_MakeEdge(aArcOfEllipse); 97 | 98 | return new AIS_Shape(aEdge); 99 | } 100 | 101 | // Draw 3d tools: 102 | Handle(AIS_Shape) draw_primitives::draw_3d_origin(gp_Pnt origin, double linelenght){ 103 | 104 | double x=origin.X(); 105 | double y=origin.Y(); 106 | double z=origin.Z(); 107 | 108 | TopoDS_Shape t_topo_sphere = BRepPrimAPI_MakeSphere(origin,2).Shape(); 109 | Handle(AIS_Shape) aisbody_tcp_sphere = new AIS_Shape(t_topo_sphere); 110 | aisbody_tcp_sphere->SetColor(Quantity_NOC_YELLOW); 111 | aisbody_tcp_sphere->SetTransparency(0.75); 112 | 113 | TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(origin,{x+linelenght,y,z}); 114 | Handle(AIS_Shape) aisbody_tcp_xaxis = new AIS_Shape(edge); 115 | aisbody_tcp_xaxis->SetColor(Quantity_NOC_RED); 116 | 117 | edge= BRepBuilderAPI_MakeEdge(origin,{x,y+linelenght,z}); 118 | Handle(AIS_Shape) aisbody_tcp_yaxis = new AIS_Shape(edge); 119 | aisbody_tcp_yaxis->SetColor(Quantity_NOC_GREEN); 120 | 121 | edge= BRepBuilderAPI_MakeEdge(origin,{x,y,z+linelenght}); 122 | Handle(AIS_Shape) aisbody_tcp_zaxis = new AIS_Shape(edge); 123 | aisbody_tcp_zaxis->SetColor(Quantity_NOC_BLUE); 124 | 125 | aisbody_tcp_sphere->AddChild(aisbody_tcp_xaxis); 126 | aisbody_tcp_sphere->AddChild(aisbody_tcp_yaxis); 127 | aisbody_tcp_sphere->AddChild(aisbody_tcp_zaxis); 128 | 129 | return aisbody_tcp_sphere; 130 | } 131 | 132 | Handle(AIS_Shape) draw_primitives::rotate_3d(Handle(AIS_Shape) shape, gp_Pnt center, double euler_z, double euler_y, double euler_x){ 133 | 134 | // ** For euler angles you have to follow the euler sequence of rotation. First around z, then around y, then around x. 135 | // Otherwise you will get wrong solutions. 136 | 137 | gp_Trsf trsf1,trsf2,trsf3; 138 | trsf1.SetRotation(gp_Ax1(center, 139 | gp_Dir(0, 140 | 0, 141 | 1)), euler_z); 142 | 143 | trsf2.SetRotation(gp_Ax1(center, 144 | gp_Dir(0, 145 | 1, 146 | 0)), euler_y); 147 | 148 | trsf3.SetRotation(gp_Ax1(center, 149 | gp_Dir(1, 150 | 0, 151 | 0)), euler_x); 152 | 153 | trsf1.Multiply(trsf2); 154 | trsf1.Multiply(trsf3); 155 | shape->SetLocalTransformation(trsf1); 156 | return shape; 157 | } 158 | 159 | Handle(AIS_Shape) draw_primitives::rotate_translate_3d_quaternion(Handle(AIS_Shape) shape, gp_Pnt translation, double euler_z, double euler_y, double euler_x){ 160 | 161 | // ** For euler angles you have to follow the euler sequence of rotation. First around z, then around y, then around x. 162 | // Otherwise you will get wrong solutions. 163 | 164 | gp_Trsf trsf; 165 | gp_Quaternion aQuat; 166 | 167 | aQuat.SetEulerAngles (gp_YawPitchRoll, euler_z, euler_y, euler_x); 168 | trsf.SetRotation(aQuat); 169 | 170 | gp_Trsf trsf1; 171 | trsf1.SetTranslation({0,0,0},translation); 172 | 173 | trsf1.Multiply(trsf); 174 | 175 | shape->SetLocalTransformation(trsf1); 176 | return shape; 177 | } 178 | 179 | Handle(AIS_Shape) draw_primitives::translate_3d(Handle(AIS_Shape) shape, gp_Pnt current, gp_Pnt target){ 180 | gp_Trsf trsf; 181 | trsf.SetTranslation(current,target); 182 | shape->SetLocalTransformation(trsf); 183 | return shape; 184 | } 185 | 186 | Handle(AIS_Shape) draw_primitives::colorize(Handle(AIS_Shape) shape, Quantity_Color color, double transparancy){ 187 | shape->SetTransparency(transparancy); // 0.0 - 1.0 188 | shape->SetColor(color); 189 | shape->SetMaterial(Graphic3d_NOM_PLASTIC); 190 | return shape; 191 | } 192 | 193 | // Draw 3d primitives: 194 | Handle(AIS_Shape) draw_primitives::draw_3d_point(gp_Pnt point){ 195 | TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(point); 196 | return new AIS_Shape(vertex); 197 | } 198 | 199 | Handle(AIS_Shape) draw_primitives::draw_3d_line(gp_Pnt point1, gp_Pnt point2){ 200 | 201 | // Avoid zero linelenghts. Will result in error. 202 | double lenght=sqrt(pow(point2.X()-point1.X(),2)+pow(point2.Y()-point1.Y(),2)+pow(point2.Z()-point1.Z(),2)); 203 | if(lenght==0){ 204 | point2.SetX(point2.X()+0.01); 205 | } 206 | 207 | TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(point1,point2); 208 | return new AIS_Shape(edge); 209 | } 210 | 211 | Handle(AIS_Shape) draw_primitives::draw_3d_line_wire(std::vector points){ 212 | BRepBuilderAPI_MakeWire wire; 213 | for(unsigned int i=0; i pointvec, int divisions){ 237 | 238 | // std::vector path; // libspline input 239 | // for(unsigned int i=0; i c_pathx(c_spline.GetPositionProfile().size()); 247 | // std::vector c_pathy(c_spline.GetPositionProfile().size()); 248 | // std::vector c_pathz(c_spline.GetPositionProfile().size()); 249 | 250 | // // Store wire points(p) into pointvector (pvec) 251 | // gp_Pnt p; 252 | // std::vector pvec; 253 | // // Get profile data for position, speed, acceleration, and curvature 254 | // std::vector ti(c_spline.GetPositionProfile().size()); 255 | // for(unsigned int i=0;iSetLocalTransformation(MyTrsf_trans*MyTrsf_rot); 292 | return ais_shape_text; 293 | } 294 | 295 | Handle(AIS_Shape) draw_primitives::draw_3d_point_origin_cone(gp_Pnt point, gp_Pnt euler){ 296 | 297 | Handle(AIS_Shape) Ais_shape=draw_3d_point(point); 298 | Ais_shape=colorize(Ais_shape,Quantity_NOC_BLUE,0); 299 | 300 | // Draw the origin 301 | Handle(AIS_Shape) Ais_child=draw_3d_origin({0,0,0},25); 302 | Ais_child=rotate_translate_3d_quaternion(Ais_child,point, 303 | euler.Z(), 304 | euler.Y(), 305 | euler.X()); 306 | Ais_shape->AddChild(Ais_child); 307 | 308 | // Draw the cone 309 | Ais_child=draw_3d_tcp_cone({0,0,0},0,5,25); 310 | Ais_child=rotate_translate_3d_quaternion(Ais_child,point, 311 | euler.Z(), 312 | euler.Y(), 313 | euler.X()); 314 | 315 | Ais_child=colorize(Ais_child,Quantity_NOC_RED,0.5); 316 | Ais_shape->AddChild(Ais_child); 317 | 318 | return Ais_shape; 319 | } 320 | 321 | Handle(AIS_Shape) draw_primitives::draw_3d_point_origin_cone_text(gp_Pnt point, gp_Pnt euler, std::string text, int textheight, int textrotation){ 322 | 323 | Handle(AIS_Shape) Ais_shape=draw_3d_point_origin_cone(point, euler); 324 | Ais_shape=colorize(Ais_shape,Quantity_NOC_RED,0); 325 | Handle(AIS_Shape) Ais_text=draw_2d_text(text, textheight, point, textrotation); 326 | Ais_text=colorize(Ais_text,Quantity_NOC_BLACK,0.5); 327 | Ais_shape->AddChild(Ais_text); 328 | return Ais_shape; 329 | } 330 | 331 | Handle(AIS_Shape) draw_primitives::draw_3d_line_origin_cone_text(gp_Pnt point1, gp_Pnt point2, gp_Pnt euler1, gp_Pnt euler2, std::string text, int textheight){ 332 | 333 | // Draw the line 334 | Handle(AIS_Shape) Ais_shape=draw_3d_line(point1,point2); 335 | Ais_shape=draw_primitives().colorize(Ais_shape,Quantity_NOC_BLUE,0); 336 | 337 | // Draw the first origin 338 | Handle(AIS_Shape) Ais_child=draw_primitives().draw_3d_origin({0,0,0},25); 339 | Ais_child=rotate_translate_3d_quaternion(Ais_child,point1, 340 | euler1.Z(), 341 | euler1.Y(), 342 | euler1.X()); 343 | Ais_shape->AddChild(Ais_child); 344 | 345 | // Draw the second origin 346 | Ais_child=draw_primitives().draw_3d_origin({0,0,0},50); 347 | Ais_child=rotate_translate_3d_quaternion(Ais_child,point2, 348 | euler2.Z(), 349 | euler2.Y(), 350 | euler2.X()); 351 | Ais_shape->AddChild(Ais_child); 352 | 353 | // Draw the first cone 354 | Ais_child=draw_primitives().draw_3d_tcp_cone({0,0,0},0,5,25); 355 | Ais_child=draw_primitives().colorize(Ais_child,Quantity_NOC_GREEN,0.5); 356 | Ais_child=draw_primitives().rotate_translate_3d_quaternion(Ais_child,point1, 357 | euler1.Z(), 358 | euler1.Y(), 359 | euler1.X()); 360 | Ais_shape->AddChild(Ais_child); 361 | 362 | // Draw the second cone 363 | Ais_child=draw_primitives().draw_3d_tcp_cone({0,0,0},0,5,25); 364 | Ais_child=draw_primitives().colorize(Ais_child,Quantity_NOC_BLACK,0.5); 365 | Ais_child=draw_primitives().rotate_translate_3d_quaternion(Ais_child,point2, 366 | euler2.Z(), 367 | euler2.Y(), 368 | euler2.X()); 369 | Ais_shape->AddChild(Ais_child); 370 | 371 | // Draw the text id. 372 | Handle(AIS_Shape) Ais_text=draw_2d_text(text, textheight, midpoint(point1,point2), 0); 373 | Ais_text=colorize(Ais_text,Quantity_NOC_BLACK,0.5); 374 | Ais_shape->AddChild(Ais_text); 375 | 376 | return Ais_shape; 377 | } 378 | 379 | Handle(AIS_Shape) draw_primitives::draw_3d_wire_origin_cone_text(std::vector points, std::vector euler, std::string text, int textheight){ 380 | BRepBuilderAPI_MakeWire wire; 381 | for(unsigned int i=0; iAddChild(Ais_child); 396 | 397 | // Draw the cone 398 | Ais_child=draw_3d_tcp_cone({0,0,0},0,5,25); 399 | Ais_child=rotate_translate_3d_quaternion(Ais_child,points.at(i), 400 | euler.at(i).Z(), 401 | euler.at(i).Y(), 402 | euler.at(i).X()); 403 | if(i==0){ 404 | Ais_child=colorize(Ais_child,Quantity_NOC_GREEN,0.5); 405 | } else if(i==points.size()-1){ 406 | Ais_child=colorize(Ais_child,Quantity_NOC_BLACK,0.5); 407 | } else { 408 | Ais_child=colorize(Ais_child,Quantity_NOC_BLUE,0.5); 409 | } 410 | 411 | Ais_shape->AddChild(Ais_child); 412 | 413 | } 414 | 415 | // Draw the text id. 416 | for(unsigned int i=0; iAddChild(Ais_text); 421 | } 422 | 423 | return Ais_shape; 424 | } 425 | 426 | Handle(AIS_Shape) draw_primitives::draw_3d_arc_origin_cone_text(std::vector points, std::vector euler, std::string text, int textheight){ 427 | 428 | Handle(AIS_Shape) Ais_shape=draw_3p_3d_arc(points.at(0),points.at(1),points.at(2)); 429 | Ais_shape=colorize(Ais_shape,Quantity_NOC_BLUE,0); 430 | 431 | for(unsigned int i=0; iAddChild(Ais_child); 439 | 440 | // Draw the cone 441 | Ais_child=draw_3d_tcp_cone({0,0,0},0,5,25); 442 | Ais_child=rotate_translate_3d_quaternion(Ais_child,points.at(i), 443 | euler.at(i).Z(), 444 | euler.at(i).Y(), 445 | euler.at(i).X()); 446 | if(i==0){ 447 | Ais_child=colorize(Ais_child,Quantity_NOC_GREEN,0.5); 448 | } else if(i==points.size()-1){ 449 | Ais_child=colorize(Ais_child,Quantity_NOC_BLACK,0.5); 450 | } else { 451 | Ais_child=colorize(Ais_child,Quantity_NOC_BLUE,0.5); 452 | } 453 | 454 | Ais_shape->AddChild(Ais_child); 455 | } 456 | 457 | 458 | 459 | 460 | // Draw the text id. 461 | Handle(AIS_Shape) Ais_text=draw_2d_text(text, textheight, points.at(1) /*midpoint*/, 0); 462 | Ais_text=colorize(Ais_text,Quantity_NOC_BLACK,0.5); 463 | Ais_shape->AddChild(Ais_text); 464 | 465 | //std::vector shapevec=draw_primitives::draw_3d_arc_lenght(points.at(0), points.at(1), points.at(2)); 466 | //for(unsigned int i=0; iAddChild(shapevec.at(i)); 468 | //} 469 | 470 | return Ais_shape; 471 | } 472 | 473 | Handle(AIS_Shape) draw_primitives::draw_3d_circle_origin_cone_text(std::vector points, std::vector euler, std::string text, int textheight){ 474 | 475 | Handle(AIS_Shape) Ais_shape=draw_3p_3d_circle(points.at(0),points.at(1),points.at(2)); 476 | Ais_shape=colorize(Ais_shape,Quantity_NOC_BLUE,0); 477 | 478 | for(unsigned int i=0; iAddChild(Ais_child); 486 | 487 | // Draw the cone 488 | Ais_child=draw_3d_tcp_cone({0,0,0},0,5,25); 489 | Ais_child=rotate_translate_3d_quaternion(Ais_child,points.at(i), 490 | euler.at(i).Z(), 491 | euler.at(i).Y(), 492 | euler.at(i).X()); 493 | if(i==0){ 494 | Ais_child=colorize(Ais_child,Quantity_NOC_GREEN,0.5); 495 | } else if(i==points.size()-1){ 496 | Ais_child=colorize(Ais_child,Quantity_NOC_BLACK,0.5); 497 | } else { 498 | Ais_child=colorize(Ais_child,Quantity_NOC_BLUE,0.5); 499 | } 500 | 501 | Ais_shape->AddChild(Ais_child); 502 | } 503 | 504 | // Draw the text id. 505 | Handle(AIS_Shape) Ais_text=draw_2d_text(text, textheight, points.at(1) /*midpoint*/, 0); 506 | Ais_text=colorize(Ais_text,Quantity_NOC_BLACK,0.5); 507 | Ais_shape->AddChild(Ais_text); 508 | 509 | return Ais_shape; 510 | } 511 | 512 | Handle(AIS_Shape) draw_primitives::draw_3d_spline_origin_cone_text(std::vector points, std::vector euler, int divisions, std::string text, int textheight){ 513 | 514 | Handle(AIS_Shape) Ais_shape=draw_3d_spline(points, divisions); 515 | Ais_shape=colorize(Ais_shape,Quantity_NOC_BLUE,0); 516 | 517 | for(unsigned int i=0; iAddChild(Ais_child); 525 | 526 | // Draw the cone 527 | Ais_child=draw_3d_tcp_cone({0,0,0},0,5,25); 528 | Ais_child=rotate_translate_3d_quaternion(Ais_child,points.at(i), 529 | euler.at(i).Z(), 530 | euler.at(i).Y(), 531 | euler.at(i).X()); 532 | if(i==0){ 533 | Ais_child=colorize(Ais_child,Quantity_NOC_GREEN,0.5); 534 | } else if(i==points.size()-1){ 535 | Ais_child=colorize(Ais_child,Quantity_NOC_BLACK,0.5); 536 | } else { 537 | Ais_child=colorize(Ais_child,Quantity_NOC_BLUE,0.5); 538 | } 539 | 540 | Ais_shape->AddChild(Ais_child); 541 | } 542 | 543 | // Draw the text id. 544 | Handle(AIS_Shape) Ais_text=draw_2d_text(text, textheight, points.at(int(points.size()/2)) /* ~midpoint of vector */, 0); 545 | Ais_text=colorize(Ais_text,Quantity_NOC_BLACK,0.5); 546 | Ais_shape->AddChild(Ais_text); 547 | 548 | return Ais_shape; 549 | } 550 | 551 | gp_Pnt draw_primitives::midpoint(gp_Pnt point1, gp_Pnt point2){ 552 | gp_Pnt midpoint; 553 | midpoint.SetX((point1.X()+point2.X())/2); 554 | midpoint.SetY((point1.Y()+point2.Y())/2); 555 | midpoint.SetZ((point1.Z()+point2.Z())/2); 556 | return midpoint; 557 | } 558 | 559 | std::vector draw_primitives::draw_3d_arc_lenght(gp_Pnt point1,gp_Pnt point2,gp_Pnt point3){ 560 | 561 | std::vector shapevec; 562 | 563 | Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(point1,point2,point3); 564 | 565 | TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle); 566 | 567 | GeomAdaptor_Curve acrv(aArcOfCircle); 568 | TColgp_Array1OfPnt pkte(0, 10); 569 | GCPnts_UniformAbscissa algo(acrv, 10); 570 | if(algo.IsDone() && algo.NbPoints() > 0) 571 | { 572 | int n = algo.NbPoints(); 573 | std::cout<<"total points:"<Value(param); 579 | std::cout<<"Px:"< 0) 607 | { 608 | int n = algo.NbPoints(); 609 | //std::cout<<"total points:"<Value(param); 616 | //std::cout<<"Px:"<Value(param); 639 | std::cout<<"Px:"<show_shape(shape); 653 | */ 654 | 655 | /* Example two: 656 | Handle(AIS_Shape) shape; 657 | shape = draw_primitives().draw_3d_origin({0,0,0},50); 658 | double x,y,z; 659 | cart.M.GetEulerZYX(z,y,x); 660 | shape = draw_primitives().rotate_3d_quaternion(shape,pointvec.back(),z,y,x); 661 | OpencascadeWidget->show_shape(shape); 662 | */ 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | -------------------------------------------------------------------------------- /gui_project/libocct/draw_primitives.h: -------------------------------------------------------------------------------- 1 | #ifndef DRAW_PRIMITIVES_H 2 | #define DRAW_PRIMITIVES_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include "Geom_Axis2Placement.hxx" 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #include 85 | #include 86 | #include 87 | #include 88 | #include 89 | #include 90 | 91 | #include "XCAFPrs_DocumentExplorer.hxx" 92 | #include 93 | #include 94 | #include 95 | 96 | #include 97 | #include 98 | #include 99 | 100 | #include "gp_Elips.hxx" 101 | 102 | #include 103 | #include 104 | #include 105 | #include 106 | #include 107 | 108 | #include 109 | #include 110 | 111 | #include 112 | #include 113 | #include 114 | #include 115 | 116 | #ifdef Success 117 | #undef Success 118 | #endif 119 | 120 | //using namespace Eigen; 121 | 122 | class draw_primitives 123 | { 124 | public: 125 | draw_primitives(); 126 | 127 | // Draw 2d primitives: 128 | Handle(AIS_Shape) draw_2d_circle(gp_Pnt center,double radius); 129 | Handle(AIS_Shape) draw_cp_2d_arc(gp_Pnt center, gp_Pnt point1, gp_Pnt point2); 130 | Handle(AIS_Shape) draw_2d_acad_arc(gp_Pnt center, double radius, const Standard_Real alpha1, const Standard_Real alpha2); 131 | Handle(AIS_Shape) draw_2d_ellipse(gp_Pnt center, gp_Pnt secpoint, double alpha_start, double alpha_end, double ratio); 132 | Handle(AIS_Shape) draw_2d_text(std::string str, double textheight, gp_Pnt point, double rot_deg); 133 | 134 | // Draw 3d primitives: 135 | Handle(AIS_Shape) draw_3d_point(gp_Pnt point); 136 | Handle(AIS_Shape) draw_3d_line(gp_Pnt point1, gp_Pnt point2); 137 | Handle(AIS_Shape) draw_3d_line_wire(std::vector points); 138 | Handle(AIS_Shape) draw_3p_3d_arc(gp_Pnt point1, gp_Pnt point2, gp_Pnt point3); 139 | Handle(AIS_Shape) draw_3p_3d_circle(gp_Pnt point1,gp_Pnt point2,gp_Pnt point3); 140 | Handle(AIS_Shape) draw_3d_spline(std::vector pointvec, int divisions); // Divisions is spline resolution (number of line fragments / segmentation value). 141 | 142 | // Draw 3d solids: 143 | Handle(AIS_Shape) draw_3d_cone(gp_Pnt centerpoint, double bottomdiameter, double topdiameter, double height); 144 | Handle(AIS_Shape) draw_3d_tcp_cone(gp_Pnt centerpoint, double bottomdiameter, double topdiameter, double height); 145 | Handle(AIS_Shape) draw_3d_cilinder(double radius, double height); 146 | Handle(AIS_Shape) draw_3d_sphere(double radius, gp_Pnt center); 147 | Handle(AIS_Shape) draw_3d_box(double dx, double dy, double dz); 148 | 149 | // Draw 3d tools: 150 | std::vector draw_3d_arc_lenght(gp_Pnt point1,gp_Pnt point2,gp_Pnt point3); 151 | double get_3d_arc_lenght(gp_Pnt point1,gp_Pnt point2,gp_Pnt point3, int divisions); 152 | gp_Pnt get_3d_arc_point_given_arclenght_fromstartpoint(gp_Pnt point1,gp_Pnt point2,gp_Pnt point3, double arclenght_from_startpoint); 153 | Handle(AIS_Shape) rotate_3d(Handle(AIS_Shape) shape, gp_Pnt center, double euler_z, double euler_y, double euler_x); 154 | Handle(AIS_Shape) rotate_translate_3d_quaternion(Handle(AIS_Shape) shape, gp_Pnt translation, double euler_z, double euler_y, double euler_x); 155 | Handle(AIS_Shape) translate_3d(Handle(AIS_Shape) shape, gp_Pnt current, gp_Pnt target); 156 | Handle(AIS_Shape) colorize(Handle(AIS_Shape) shape, Quantity_Color color, double transparancy); 157 | gp_Pnt midpoint(gp_Pnt point1, gp_Pnt point2); 158 | 159 | // Draw 3d sets: 160 | Handle(AIS_Shape) draw_3d_origin(gp_Pnt origin, double linelenght); 161 | Handle(AIS_Shape) draw_3d_point_origin_cone(gp_Pnt point, gp_Pnt euler); 162 | Handle(AIS_Shape) draw_3d_point_origin_cone_text(gp_Pnt point, gp_Pnt euler, std::string text, int textheight, int textrotation); 163 | Handle(AIS_Shape) draw_3d_line_origin_cone_text(gp_Pnt point1, gp_Pnt point2, gp_Pnt euler1, gp_Pnt euler2, std::string text, int textheight); 164 | Handle(AIS_Shape) draw_3d_wire_origin_cone_text(std::vector points, std::vector euler, std::string text, int textheight); 165 | Handle(AIS_Shape) draw_3d_arc_origin_cone_text(std::vector points, std::vector euler, std::string text, int textheight); 166 | Handle(AIS_Shape) draw_3d_circle_origin_cone_text(std::vector points, std::vector euler, std::string text, int textheight); 167 | Handle(AIS_Shape) draw_3d_spline_origin_cone_text(std::vector points, std::vector euler, int divisions, std::string text, int textheight); 168 | 169 | 170 | }; 171 | 172 | #endif // DRAW_PRIMITIVES_H 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /gui_project/libocct/opencascade.cpp: -------------------------------------------------------------------------------- 1 | #include "opencascade.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include "Geom_Axis2Placement.hxx" 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | 84 | #include "XCAFPrs_DocumentExplorer.hxx" 85 | #include 86 | #include 87 | #include 88 | 89 | #include 90 | #include 91 | #include 92 | #include 93 | 94 | #include "gp_Elips.hxx" 95 | #include 96 | #include 97 | 98 | //! Make conversion's easy: 99 | #define toRadians M_PI/180.0 100 | #define toDegrees (180.0/M_PI) 101 | 102 | using namespace occ; 103 | 104 | Opencascade::Opencascade(QWidget *parent) : QGLWidget(parent) 105 | { 106 | setBackgroundRole( QPalette::NoRole ); 107 | setMouseTracking( true ); 108 | } 109 | 110 | void Opencascade::setup_tcp_origin(){ 111 | double toollenght=105; 112 | TopoDS_Edge edge = BRepBuilderAPI_MakeEdge({525+toollenght,0,890},{525+toollenght+100,0,890}); 113 | aisBody_tcp_xaxis = new AIS_Shape(edge); 114 | //aisBody_tcp_xaxis->SetLocalTransformation(level0x1x2x3x4x5x6); 115 | m_context->SetColor(aisBody_tcp_xaxis,Quantity_NOC_RED,Standard_False); 116 | m_context->SetMaterial(aisBody_tcp_xaxis,Graphic3d_NOM_PLASTIC,Standard_False); 117 | m_context->Display(aisBody_tcp_xaxis,Standard_False); 118 | 119 | edge= BRepBuilderAPI_MakeEdge({525+toollenght,0,890},{525+toollenght,0+100,890}); 120 | aisBody_tcp_yaxis = new AIS_Shape(edge); 121 | //aisBody_tcp_yaxis->SetLocalTransformation(level0x1x2x3x4x5x6); 122 | m_context->SetColor(aisBody_tcp_yaxis,Quantity_NOC_GREEN,Standard_False); 123 | m_context->SetMaterial(aisBody_tcp_yaxis,Graphic3d_NOM_PLASTIC,Standard_False); 124 | m_context->Display(aisBody_tcp_yaxis,Standard_False); 125 | 126 | edge= BRepBuilderAPI_MakeEdge({525+toollenght,0,890},{525+toollenght,0,890+100}); 127 | aisBody_tcp_zaxis = new AIS_Shape(edge); 128 | //aisBody_tcp_zaxis->SetLocalTransformation(level0x1x2x3x4x5x6); 129 | m_context->SetColor(aisBody_tcp_zaxis,Quantity_NOC_BLUE,Standard_False); 130 | m_context->SetMaterial(aisBody_tcp_zaxis,Graphic3d_NOM_PLASTIC,Standard_False); 131 | m_context->Display(aisBody_tcp_zaxis,Standard_False); 132 | } 133 | 134 | void Opencascade::show_shape(Handle(AIS_Shape) shape){ 135 | m_context->Display(shape,Standard_False); 136 | } 137 | 138 | void Opencascade::draw_preview_cone(std::string type, gp_Trsf trsf){ 139 | 140 | gp_Pnt point={525+toollenght-coneheight,0,890}; 141 | gp_Dir xDirection(1,0,0); // Direction is auto normalized by occ. 142 | gp_Dir normalDirection(0,0,1); 143 | gp_Ax2 aplace(point,normalDirection,xDirection); 144 | 145 | TopoDS_Shape t_topo_cone = BRepPrimAPI_MakeCone(aplace,conebottomdiameter,conetopdiameter,coneheight).Shape(); 146 | 147 | // Draw toolpos cone at startpoint 148 | previewbucketvec.push_back(new AIS_Shape(t_topo_cone)); 149 | 150 | gp_Trsf MyTrsf_Local_Rot; 151 | MyTrsf_Local_Rot.SetRotation(gp_Ax1(gp_Pnt( 152 | 525+toollenght-coneheight, 153 | 0, 154 | 890), gp_Dir( 155 | 0, //rotation flag x 156 | 1, //rotation flag y 157 | 0)), 90 * toRadians); 158 | 159 | previewbucketvec.back()->SetLocalTransformation(trsf*MyTrsf_Local_Rot); 160 | 161 | if(type=="startpoint"){ 162 | m_context->SetColor(previewbucketvec.back(),Quantity_NOC_GREEN,Standard_False); 163 | } 164 | if(type=="io"){ 165 | m_context->SetColor(previewbucketvec.back(),Quantity_NOC_RED,Standard_False); 166 | } 167 | if(type=="waypoint"){ 168 | m_context->SetColor(previewbucketvec.back(),Quantity_NOC_BLUE,Standard_False); 169 | } 170 | if(type=="endpoint"){ 171 | m_context->SetColor(previewbucketvec.back(),Quantity_NOC_BLACK,Standard_False); 172 | } 173 | 174 | m_context->SetTransparency(previewbucketvec.back(),0.5,false); 175 | m_context->SetMaterial(previewbucketvec.back(),Graphic3d_NOM_PLASTIC,Standard_False); 176 | m_context->Display(previewbucketvec.back(),Standard_False); 177 | } 178 | 179 | void Opencascade::empty_preview_bucket(){ 180 | for(unsigned int i=0; i0){ // At least one is selected. 183 | m_context->SetSelected(previewbucketvec.at(i),false); 184 | m_context->EraseSelected(false); 185 | } 186 | } 187 | previewbucketvec.clear(); 188 | } 189 | 190 | void Opencascade::get_selections(){ // Updated by jointpos function from mainwindow. 191 | 192 | for(m_context->InitSelected(); m_context->MoreSelected(); m_context->NextSelected()){ 193 | 194 | const TopoDS_Shape& aSelShape = m_context->SelectedShape(); 195 | std::cout<<"selected shape type:"<SelectedShape()==bucketvec.at(i).Ais_shape->Shape()){ 200 | std::cout<<"match found at Ais_bucket i:"< 7 248 | // TopAbs_SHAPE 249 | // */ 250 | 251 | // std::cout<<"inside shape enum 7"<InitSelected(); m_context->MoreSelected(); m_context->NextSelected()){ 277 | 278 | // Find the match of selected item in the Ais_databucket. 279 | // In this case one item can be removed each time. 280 | for(unsigned int i=0; iSelectedShape()==bucketvec.at(i).Ais_shape->Shape()){ 283 | //std::cout<<"match found, remove this item from Ais_bucket"<EraseSelected(false); 292 | 293 | // For check print content. 294 | 295 | for(unsigned int i=0; iShape(), TopAbs_EDGE); explorer.More(); explorer.Next()){ 299 | 300 | const TopoDS_Edge& edge = TopoDS::Edge(explorer.Current()); 301 | 302 | TopoDS_Vertex v1,v2; 303 | TopExp::Vertices(edge,v1,v2); 304 | gp_Pnt p1= BRep_Tool::Pnt(v1); 305 | gp_Pnt p2= BRep_Tool::Pnt(v2); 306 | 307 | std::cout<<"content left edge p1 x: "<CurrentViewer()->Redraw(); 316 | m_view->Redraw(); 317 | } 318 | 319 | 320 | void Opencascade::Zoom_all(){ 321 | m_view->ZFitAll(); 322 | m_view->FitAll(); 323 | m_view->Redraw(); 324 | } 325 | 326 | void Opencascade::Erase_all(){ 327 | m_context->EraseAll(true); 328 | 329 | 330 | } 331 | 332 | void Opencascade::Remove_all(){ 333 | 334 | m_context->RemoveAll(true); 335 | m_context->UpdateCurrentViewer(); 336 | } 337 | 338 | void Opencascade::m_initialize_context() 339 | { 340 | if (m_context.IsNull()) 341 | { 342 | 343 | Handle(Aspect_DisplayConnection) m_display_donnection = new Aspect_DisplayConnection(); 344 | 345 | if (m_graphic_driver.IsNull()) 346 | { 347 | m_graphic_driver = new OpenGl_GraphicDriver(m_display_donnection); 348 | } 349 | 350 | WId window_handle = (WId) winId(); 351 | #ifdef _WIN32 352 | Handle(WNT_Window) wind = new WNT_Window((Aspect_Handle) window_handle); 353 | #else 354 | Handle(Xw_Window) wind = new Xw_Window(m_display_donnection, (Window) window_handle); 355 | #endif 356 | m_viewer = new V3d_Viewer(m_graphic_driver); 357 | 358 | m_view = m_viewer->CreateView(); 359 | m_view->SetWindow(wind); 360 | 361 | /*! Set the camera in perspective mode */ 362 | m_view->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective); 363 | 364 | if (!wind->IsMapped()) 365 | { 366 | wind->Map(); 367 | } 368 | m_context = new AIS_InteractiveContext(m_viewer); 369 | 370 | m_viewer->SetDefaultLights(); 371 | m_viewer->SetLightOn(); 372 | 373 | /// This is the interactivve 3d box 374 | // View : top, bottom, side, 3d, etc. 375 | 376 | opencascade::handle aisViewCube = new AIS_ViewCube; 377 | aisViewCube->SetBoxColor(Quantity_NOC_GRAY75); 378 | //aisViewCube->SetFixedAnimationLoop(false); 379 | aisViewCube->SetDrawAxes(false); 380 | aisViewCube->SetSize(55); 381 | aisViewCube->SetFontHeight(12); 382 | aisViewCube->SetTransformPersistence( 383 | new Graphic3d_TransformPers( 384 | Graphic3d_TMF_TriedronPers, 385 | Aspect_TOTP_LEFT_UPPER, 386 | Graphic3d_Vec2i(85, 85))); 387 | m_context->Display(aisViewCube, false); 388 | //aisViewCube->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_RED2); 389 | //const Handle_Prs3d_DatumAspect& datumAspect = aisViewCube->Attributes()->DatumAspect(); 390 | //datumAspect->ShadingAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_RED2); 391 | //datumAspect->ShadingAspect(Prs3d_DP_YAxis)->SetColor(Quantity_NOC_GREEN2); 392 | //datumAspect->ShadingAspect(Prs3d_DP_ZAxis)->SetColor(Quantity_NOC_BLUE2); 393 | //m_aisViewCube = aisViewCube; 394 | 395 | /// Set background homogenius, one color. 396 | // m_view->SetBackgroundColor(Quantity_NOC_GRAY49); 397 | // m_viewer->SetDefaultShadingModel(Graphic3d_TypeOfShadingModel::V3d_COLOR); 398 | 399 | /// Set background with gradient stylesheet 400 | // Gradient sheme's for SetBgGradientColors: 401 | // Aspect_GFM_CORNER1 402 | // Aspect_GFM_CORNER2 403 | // Aspect_GFM_CORNER3 404 | // Aspect_GFM_CORNER4 405 | // Aspect_GFM_DIAG1 406 | // Aspect_GFM_DIAG2 407 | // Aspect_GFM_HOR 408 | // Aspect_GFM_NONE 409 | // Aspect_GFM_VER 410 | 411 | Quantity_Color cola,colb; 412 | cola.SetValues(0.3,0.3,0.3,Quantity_TOC_RGB); 413 | colb.SetValues(0.6,0.6,0.6,Quantity_TOC_RGB); 414 | m_view->SetBgGradientColors(cola,colb,Aspect_GFM_DIAG2 , false); 415 | 416 | /// View as wireframe or shaded 417 | //m_context->SetDisplayMode(AIS_WireFrame, Standard_False); 418 | m_context->SetDisplayMode(AIS_Shaded, Standard_False); 419 | 420 | Handle(Prs3d_Drawer) t_hilight_style = m_context->HighlightStyle(); 421 | t_hilight_style->SetMethod(Aspect_TOHM_COLOR); 422 | t_hilight_style->SetColor(Quantity_NOC_LIGHTYELLOW); 423 | t_hilight_style->SetDisplayMode(1); 424 | t_hilight_style->SetTransparency(0.2f); 425 | 426 | Handle(Prs3d_Drawer) t_select_style = m_context->SelectionStyle(); 427 | t_select_style->SetMethod(Aspect_TOHM_COLOR); 428 | t_select_style->SetColor(Quantity_NOC_LIGHTSEAGREEN); 429 | t_select_style->SetDisplayMode(1); 430 | t_select_style->SetTransparency(0.4f); 431 | 432 | /// Show grid 433 | m_viewer->SetRectangularGridValues(0,0,1,1,0); 434 | m_viewer->SetRectangularGridGraphicValues(2.01,2.01,0); 435 | m_viewer->ActivateGrid(Aspect_GT_Rectangular,Aspect_GDM_Lines); 436 | 437 | /// Show triedron. This is the 3d axis cross at the lower left of the screen. 438 | m_view->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_GOLD, 0.08, V3d_ZBUFFER); 439 | 440 | /* 441 | /// Show triedron at a specific place on the screen 442 | axis = new Geom_Axis2Placement(gp::XOY()); 443 | aisTrihedron = new AIS_Trihedron(axis); 444 | aisTrihedron->SetDatumDisplayMode(Prs3d_DM_WireFrame); 445 | aisTrihedron->SetDrawArrows(true); 446 | aisTrihedron->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(2.5); 447 | aisTrihedron->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(2.5); 448 | aisTrihedron->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(2.5); 449 | aisTrihedron->SetDatumPartColor(Prs3d_DP_XAxis, Quantity_NOC_RED2); 450 | aisTrihedron->SetDatumPartColor(Prs3d_DP_YAxis, Quantity_NOC_GREEN2); 451 | aisTrihedron->SetDatumPartColor(Prs3d_DP_ZAxis, Quantity_NOC_BLUE2); 452 | aisTrihedron->SetLabel(Prs3d_DP_XAxis, ""); 453 | aisTrihedron->SetLabel(Prs3d_DP_YAxis, ""); 454 | aisTrihedron->SetLabel(Prs3d_DP_ZAxis, ""); 455 | //aisTrihedron->SetTextColor(Quantity_NOC_GRAY40); 456 | aisTrihedron->SetSize(60); 457 | aisTrihedron->SetTransformPersistence( 458 | new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, axis->Ax2().Location())); 459 | aisTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost); 460 | aisTrihedron->SetInfiniteState(true); 461 | m_context->Display(aisTrihedron,Standard_False); 462 | */ 463 | 464 | m_view->MustBeResized(); 465 | 466 | Set_orthographic(); 467 | set_view_top(); 468 | } 469 | ready=1; 470 | } 471 | 472 | void Opencascade::Set_orthographic(){ 473 | m_view->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Orthographic); 474 | m_view->Update(); 475 | } 476 | 477 | void Opencascade::Set_perspective(){ 478 | m_view->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective); 479 | m_view->Redraw(); 480 | //m_view->Update(); 481 | } 482 | 483 | void Opencascade::paintEvent(QPaintEvent *) 484 | { 485 | if (m_context.IsNull()) 486 | { 487 | m_initialize_context(); 488 | } 489 | m_view->Redraw(); 490 | } 491 | 492 | void Opencascade::resizeEvent(QResizeEvent *) 493 | { 494 | if( !m_view.IsNull() ) 495 | { 496 | m_view->MustBeResized(); 497 | } 498 | } 499 | 500 | void Opencascade::mousePressEvent(QMouseEvent *event) 501 | { 502 | if((event->buttons()&Qt::LeftButton) && (event->buttons()&Qt::RightButton)) 503 | { 504 | m_x_max=event->x(); 505 | m_y_max=event->y(); 506 | } 507 | else if(event->buttons()&Qt::LeftButton) 508 | { 509 | m_context->MoveTo(event->pos().x(),event->pos().y(),m_view,Standard_True); 510 | 511 | AIS_StatusOfPick t_pick_status = AIS_SOP_NothingSelected; 512 | if(qApp->keyboardModifiers()==Qt::ControlModifier) 513 | { 514 | t_pick_status = m_context->ShiftSelect(true); 515 | } 516 | else 517 | { 518 | t_pick_status = m_context->Select(true); 519 | } 520 | } 521 | else if(event->buttons()&Qt::MidButton) 522 | { 523 | m_x_max=event->x(); 524 | m_y_max=event->y(); 525 | m_view->StartRotation(event->x(),event->y()); 526 | } 527 | } 528 | 529 | void Opencascade::mouseReleaseEvent(QMouseEvent *event) 530 | { 531 | m_context->MoveTo(event->pos().x(),event->pos().y(),m_view,Standard_True); 532 | } 533 | 534 | void Opencascade::mouseMoveEvent(QMouseEvent *event) 535 | { 536 | if((event->buttons()&Qt::LeftButton) && (event->buttons()&Qt::RightButton)) 537 | { 538 | m_view->Pan(event->pos().x()-m_x_max,m_y_max-event->pos().y()); 539 | m_x_max=event->x(); 540 | m_y_max=event->y(); 541 | } 542 | else if(event->buttons()&Qt::MidButton) 543 | { 544 | if(qApp->keyboardModifiers()==Qt::ShiftModifier) 545 | { 546 | m_view->Pan(event->pos().x()-m_x_max,m_y_max-event->pos().y()); 547 | m_x_max=event->x(); 548 | m_y_max=event->y(); 549 | } 550 | else 551 | { 552 | m_view->Rotation(event->x(),event->y()); 553 | } 554 | } 555 | else 556 | { 557 | m_context->MoveTo(event->pos().x(),event->pos().y(),m_view,Standard_True); 558 | } 559 | } 560 | 561 | void Opencascade::wheelEvent(QWheelEvent *event) 562 | { 563 | m_view->StartZoomAtPoint(event->position().x(),event->position().y()); 564 | m_view->ZoomAtPoint(0, 0, event->angleDelta().y(), 0); 565 | } 566 | 567 | void Opencascade::set_view_front() 568 | { 569 | m_view->SetProj( V3d_Yneg ); 570 | } 571 | 572 | void Opencascade::set_view_back() 573 | { 574 | m_view->SetProj( V3d_Ypos ); 575 | } 576 | 577 | void Opencascade::set_view_top() 578 | { 579 | m_view->SetProj( V3d_Zpos ); 580 | } 581 | 582 | void Opencascade::set_view_bottom() 583 | { 584 | m_view->SetProj( V3d_Zneg ); 585 | } 586 | 587 | void Opencascade::set_view_left() 588 | { 589 | m_view->SetProj( V3d_Xneg ); 590 | } 591 | void Opencascade::set_view_right() 592 | { 593 | m_view->SetProj( V3d_Xpos ); 594 | } 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | -------------------------------------------------------------------------------- /gui_project/libocct/opencascade.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCASCADE_H 2 | #define OPENCASCADE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #ifdef _WIN32 19 | #include 20 | #else 21 | #undef None 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | //show xyz axis 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | namespace occ { 39 | class Opencascade: public QGLWidget 40 | { 41 | Q_OBJECT 42 | public: 43 | explicit Opencascade(QWidget *parent = nullptr); 44 | 45 | struct io { 46 | std::string halcommand={""}; 47 | }; 48 | 49 | struct bucket { 50 | std::string primitivetype; // line,wire,arc,circle,spline. 51 | std::vector pointvec; 52 | std::vector eulervec; 53 | Handle(AIS_Shape) Ais_shape; 54 | std::string info; 55 | 56 | // Hal io 57 | std::vector iovec; 58 | 59 | double vo=0,ve=0,velmax=0,accmax=0; 60 | }; 61 | std::vector bucketvec; 62 | 63 | std::vector previewbucketvec; 64 | 65 | int ready=0; 66 | 67 | void Init_robot(); 68 | void setup_tcp_origin(); 69 | 70 | void show_shape(Handle(AIS_Shape) shape); 71 | void Redraw(); 72 | 73 | // Preview line 74 | void draw_preview_cone(std::string type, gp_Trsf trsf); 75 | void empty_preview_bucket(); 76 | 77 | // View 78 | void Zoom_all(); 79 | void Set_orthographic(); 80 | void Set_perspective(); 81 | void set_view_front(); 82 | void set_view_back(); 83 | void set_view_left(); 84 | void set_view_right(); 85 | void set_view_top(); 86 | void set_view_bottom(); 87 | 88 | // Selection 89 | void get_selections(); 90 | void delete_selections(); 91 | 92 | void Erase_all(); 93 | void Remove_all(); 94 | 95 | public: 96 | //Handle(AIS_InteractiveContext) m_context; 97 | private: 98 | void m_initialize_context(); 99 | Handle(AIS_InteractiveContext) m_context; 100 | Handle(V3d_Viewer) m_viewer; 101 | Handle(V3d_View) m_view; 102 | Handle(Graphic3d_GraphicDriver) m_graphic_driver; 103 | Handle(AIS_InteractiveObject) m_aisViewCube; 104 | 105 | // Xyz axis sign. 106 | Handle(Geom_Axis2Placement) axis; 107 | Handle(AIS_Trihedron) aisTrihedron; 108 | std::vector aisTrihedrons; 109 | 110 | protected: 111 | void paintEvent(QPaintEvent *); 112 | void resizeEvent(QResizeEvent *); 113 | void mousePressEvent(QMouseEvent *event); 114 | void mouseReleaseEvent(QMouseEvent *event); 115 | void mouseMoveEvent(QMouseEvent *event); 116 | void wheelEvent(QWheelEvent *event); 117 | 118 | protected: 119 | enum CurrentAction3d 120 | { 121 | CurAction3d_Nothing, 122 | CurAction3d_DynamicPanning, 123 | CurAction3d_DynamicZooming, 124 | CurAction3d_DynamicRotation 125 | }; 126 | 127 | private: 128 | Standard_Integer m_x_max; 129 | Standard_Integer m_y_max; 130 | CurrentAction3d m_current_mode; 131 | //gp_Trsf current_tcp; 132 | 133 | Handle(AIS_Shape) aisBody_tcp_xaxis, aisBody_tcp_yaxis, aisBody_tcp_zaxis; 134 | 135 | // Create the euler lines 136 | double toollenght=105; 137 | double linelenght=25; 138 | double coneheight=25; 139 | double conetopdiameter=1; 140 | double conebottomdiameter=5; 141 | double textheight=25; 142 | 143 | 144 | TopoDS_Edge edge_linepreview; 145 | Handle(AIS_Shape) aisBody_linepreview; 146 | 147 | signals: 148 | 149 | public slots: 150 | }; 151 | } 152 | 153 | #endif // OPENCASCADE_H 154 | 155 | 156 | -------------------------------------------------------------------------------- /gui_project/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /gui_project/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace occ; 9 | 10 | MainWindow::MainWindow(QWidget *parent) 11 | : QMainWindow(parent) 12 | , ui(new Ui::MainWindow) 13 | { 14 | ui->setupUi(this); 15 | 16 | OpencascadeWidget = new Opencascade(this); 17 | ui->gridLayout_opencascade->addWidget(OpencascadeWidget); 18 | } 19 | 20 | MainWindow::~MainWindow() 21 | { 22 | delete ui; 23 | } 24 | /* 25 | struct CONTROL{ 26 | //! Maximum velocity - or + 27 | double vs=0; 28 | //! Velocity overide 0-100% 29 | double vso=0; 30 | //! Maximum acceleration 31 | double am=0; 32 | }; 33 | 34 | struct PATH{ 35 | //! Maximum velocity. 36 | double vs=0; 37 | //! Velocity begin. 38 | double vo=0; 39 | //! Acceleration start. 40 | double acs=0; 41 | //! Path lenght. 42 | double ltot=0; 43 | //! Velocity end. 44 | double ve=0; 45 | //! Acceleration end. 46 | double ace=0; 47 | //! Distance to go. 48 | double dtg=0; 49 | }; 50 | std::vector pathvec; 51 | */ 52 | 53 | void MainWindow::on_pushButton_simulate_path_pressed() 54 | { 55 | OpencascadeWidget->Remove_all(); 56 | simulate(); 57 | } 58 | 59 | void MainWindow::simulate(){ 60 | 61 | CONTROL c; 62 | c.vs=10; 63 | c.vso=0; 64 | c.am=2; 65 | c.i_time=0.01; 66 | c.tr_time=0; 67 | 68 | std::vector pathvec; 69 | PATH p; 70 | //! A Path 71 | p.vs=5; 72 | p.vo=0; 73 | p.ve=4; 74 | p.acs=0; 75 | p.ace=0; 76 | p.ltot=50; 77 | pathvec.push_back(p); 78 | 79 | //! A Path 80 | p.vs=12; 81 | p.vo=4; 82 | p.ve=0; 83 | p.acs=0; 84 | p.ace=0; 85 | p.ltot=50; 86 | pathvec.push_back(p); 87 | 88 | //! A Path 89 | p.vs=8; 90 | p.vo=0; 91 | p.ve=0; 92 | p.acs=0; 93 | p.ace=0; 94 | p.ltot=75; 95 | pathvec.push_back(p); 96 | 97 | //! A Path 98 | p.vs=12; 99 | p.vo=0; 100 | p.ve=8; 101 | p.acs=0; 102 | p.ace=0; 103 | p.ltot=50; 104 | pathvec.push_back(p); 105 | 106 | //! A Path 107 | p.vs=12; 108 | p.vo=8; 109 | p.ve=8; 110 | p.acs=0; 111 | p.ace=0; 112 | p.ltot=50; 113 | pathvec.push_back(p); 114 | 115 | //! A Path (instand stop) 116 | p.vs=0; 117 | p.vo=8; 118 | p.ve=0; 119 | p.acs=0; 120 | p.ace=0; 121 | p.ltot=200; 122 | pathvec.push_back(p); 123 | 124 | runner(c,pathvec); 125 | } 126 | 127 | void MainWindow::runner(CONTROL c,std::vector pathvec){ 128 | 129 | std::cout.precision(3); 130 | Handle(AIS_Shape) awire; 131 | std::vector pvec_v, pvec_s, pvec_a; 132 | for(unsigned int i=0; i0){ 177 | awire=draw_primitives().draw_3d_line_wire(pvec_v); 178 | awire=draw_primitives().colorize(awire,Quantity_NOC_BLACK,0); 179 | OpencascadeWidget->show_shape(awire); 180 | } 181 | if(pvec_s.size()>0){ 182 | awire=draw_primitives().draw_3d_line_wire(pvec_s); 183 | awire=draw_primitives().colorize(awire,Quantity_NOC_BLUE,0); 184 | OpencascadeWidget->show_shape(awire); 185 | } 186 | if(pvec_a.size()>0){ 187 | awire=draw_primitives().draw_3d_line_wire(pvec_a); 188 | awire=draw_primitives().colorize(awire,Quantity_NOC_RED,0); 189 | OpencascadeWidget->show_shape(awire); 190 | 191 | OpencascadeWidget->Redraw(); 192 | } 193 | } 194 | 195 | void MainWindow::on_pushButton_create_motion_block_pressed(){ 196 | std::cout.precision(3); 197 | Handle(AIS_Shape) awire; 198 | std::vector pvec_v, pvec_s, pvec_a; 199 | 200 | //! Velocity max. 201 | double vs=ui->doubleSpinBox_mb_velocity_max->value(); 202 | //! Acceleration max. 203 | double am=ui->doubleSpinBox_mb_acc_max->value(); 204 | 205 | //! Pathlenght. 206 | double ltot=ui->doubleSpinBox_mb_pathlenght->value(); 207 | 208 | //! Velocity begin. 209 | double vo=ui->doubleSpinBox_mb_velocity_start->value(); 210 | //! Acceleration begin. 211 | double acs=ui->doubleSpinBox_mb_acc_begin->value(); 212 | 213 | //! Velocity end. 214 | double ve=ui->doubleSpinBox_mb_velocity_end->value(); 215 | //! Acceleration end. 216 | double ace=ui->doubleSpinBox_mb_acc_end->value(); 217 | 218 | double t=0; 219 | 220 | //! A motion. 221 | bool ok=1; 222 | while(ok){ 223 | auto start = std::chrono::high_resolution_clock::now(); 224 | RESULT r=motion(vs, am, vo, acs, ltot, ve, ace, t); 225 | auto stop = std::chrono::high_resolution_clock::now(); 226 | auto duration = std::chrono::duration_cast(stop - start); 227 | std::cout << "Time taken by function nanoseconds : ~" << duration.count() << " milliseconds: ~" << duration.count()*0.000001 <=r.ct){ 231 | ok=0; 232 | } 233 | 234 | std::cout<0){ 243 | awire=draw_primitives().draw_3d_line_wire(pvec_v); 244 | awire=draw_primitives().colorize(awire,Quantity_NOC_BLACK,0); 245 | OpencascadeWidget->show_shape(awire); 246 | } 247 | if(pvec_s.size()>0){ 248 | awire=draw_primitives().draw_3d_line_wire(pvec_s); 249 | awire=draw_primitives().colorize(awire,Quantity_NOC_BLUE,0); 250 | OpencascadeWidget->show_shape(awire); 251 | } 252 | if(pvec_a.size()>0){ 253 | awire=draw_primitives().draw_3d_line_wire(pvec_a); 254 | awire=draw_primitives().colorize(awire,Quantity_NOC_RED,0); 255 | OpencascadeWidget->show_shape(awire); 256 | 257 | OpencascadeWidget->Redraw(); 258 | } 259 | } 260 | 261 | MainWindow::RESULT MainWindow::motion(double vs, double am, double vo, double acs, double ltot, double ve, double ace, double at_time){ 262 | 263 | RESULT r; 264 | double t=0; 265 | 266 | if(ltot<=0){ 267 | r.error=1; 268 | return r; 269 | } 270 | if(ve>vs){ 271 | ve=vs; 272 | } 273 | 274 | //! Priority, starting at acc<0, controlled stop, goto to vs. 275 | if(acs<=0 && vs=0, controlled stop, goto to vs. 284 | if(acs>0 && vs=a.ct){ 310 | t-=a.ct; 311 | r=scurve_acc_dcc(1,vo+gain, vs, am, 0/*acs*/, ace ,t); 312 | r.sr+=a.cs; 313 | } 314 | 315 | r.ct=ct; 316 | // std::cout<<"mode 1"<0 321 | if(acs>=0 && vs>=vo && vs>=ve){ 322 | //! Get curve time. 323 | t=0; 324 | RESULT a,b,c; 325 | double ct=0; 326 | a=scurve_acc_dcc(0,vo, vs, am, acs, 0/*ace*/ ,t); 327 | c=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 328 | 329 | double lb=ltot-(a.cs+c.cs); 330 | b=scurve_lineair(0,vs,lb); 331 | ct=a.ct+b.ct+c.ct; 332 | 333 | /* 334 | std::cout<<"l0:"<ltot){ 347 | vs-=0.1; 348 | a=scurve_acc_dcc(0,vo, vs, am, acs, 0/*ace*/ ,t); 349 | c=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 350 | } 351 | lb=ltot-(a.cs+c.cs); 352 | 353 | b=scurve_lineair(t,vs,lb); 354 | ct=a.ct+b.ct+c.ct; 355 | } 356 | 357 | t=at_time; 358 | if(t<=a.ct){ 359 | r=scurve_acc_dcc(0,vo, vs, am, acs, 0/*ace*/ ,t); 360 | } 361 | if(t>a.ct && t<(a.ct+b.ct)){ 362 | t-=a.ct; 363 | r=scurve_lineair(t,vs,lb); 364 | r.sr+=a.cs; 365 | } 366 | if(t>=a.ct+b.ct && t<=a.ct+b.ct+c.ct){ 367 | t-=a.ct; 368 | t-=b.ct; 369 | r=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 370 | r.sr+=a.cs; 371 | r.sr+=b.cs; 372 | 373 | 374 | } 375 | r.ct=ct; 376 | // std::cout<<"mode 2"<=vo && vs>=ve){ 382 | //! Get curve time. 383 | t=0; 384 | RESULT a,b,c,d; 385 | double ct=0; 386 | a=scurve_acc_dcc(1,vo, vo-1, am, acs, 0/*ace*/ ,t); 387 | b=scurve_acc_dcc(0,vo-1, vs, am, 0/*acs*/, 0/*ace*/ ,t); 388 | d=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 389 | 390 | double lc=ltot-(a.cs+b.cs+d.cs); 391 | c=scurve_lineair(0,vs,lc); 392 | ct=a.ct+b.ct+c.ct+d.ct; 393 | 394 | /* 395 | std::cout<<"l0:"<ltot){ 410 | vs-=0.1; 411 | a=scurve_acc_dcc(1,vo, vo-1, am, acs, 0/*ace*/ ,t); 412 | b=scurve_acc_dcc(0,vo-1, vs, am, 0/*acs*/, 0/*ace*/ ,t); 413 | d=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 414 | } 415 | lc=ltot-(a.cs+b.cs+d.cs); 416 | 417 | c=scurve_lineair(t,vs,lc); 418 | ct=a.ct+b.ct+c.ct+d.ct; 419 | } 420 | 421 | t=at_time; 422 | if(t=a.ct && t<(a.ct+b.ct)){ 426 | t-=a.ct; 427 | r=scurve_acc_dcc(0,vo-1, vs, am, 0/*acs*/, 0/*ace*/ ,t); 428 | r.sr+=a.cs; 429 | } 430 | if(t>=a.ct+b.ct && t=a.ct+b.ct+c.ct && t<=a.ct+b.ct+c.ct+d.ct){ 438 | t-=a.ct; 439 | t-=b.ct; 440 | t-=c.ct; 441 | r=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 442 | r.sr+=a.cs; 443 | r.sr+=b.cs; 444 | r.sr+=c.cs; 445 | } 446 | r.ct=ct; 447 | // std::cout<<"mode 3"<(2*am)){ 493 | acs=2*am; 494 | std::cout<<"acs limited to:"<2*am){ 497 | ace=2*am; 498 | std::cout<<"ace limited to:"< velocity start. 501 | if(vo>=ve){ 502 | std::cout<<"impossible situation for acc curve. vo>ve"<0){ 528 | ts=acs/jm; //! Time[t] on concave period. a=jm*t; 529 | } else { 530 | ts=0; 531 | } 532 | //! Curve has acceleration end value. Find end time[t]. 533 | if(ace>0){ 534 | te=(as-ace)/jm; //! Time[t] on concvex period. a=jm*t; 535 | } else { 536 | te=t1/2; 537 | } 538 | 539 | //! Concave period. 540 | t=ts; //! at start of curve. 541 | double sa=vo*t+jm*(t*t*t)/6; //! Netto displacment concave front. 542 | t=t1/2; //! at end of curve. 543 | vece=vo+jm*(t*t)/2; //! velocity end. 544 | double sb=vo*t+jm*(t*t*t)/6; //! Bruto displacement concave front. 545 | sce=sb-sa; //! Netto displacment convace back. 546 | 547 | 548 | //! Convex period. 549 | th=t1/2; 550 | vh=vo+jm*(th*th)/2; 551 | t=te; 552 | vecx=vh + as*t - jm*(t*t)/2; //! Convex velocity end. 553 | scx=vh*t + as*(t*t)/2 - jm*(t*t*t)/6; //! Netto displacement convex front. 554 | t=t1/2; 555 | double sc=vh*t + as*(t*t)/2 - jm*(t*t*t)/6; //! Bruto displacement. 556 | double sd=sc-scx; //! Netto displacement convex back. 557 | 558 | double stn=0; //! Curve total netto displacment, excl. acc & dcc start value displacments. 559 | stn+=sce; 560 | stn+=scx; 561 | r.cs=stn; //! Curve displacment 562 | 563 | double concave=(t1/2)-ts; 564 | double convex=te; 565 | double ct=concave+convex; //! Netto curve time [ct] 566 | 567 | if(sct==1){ 568 | //! ***** Mirror time. 569 | at_time=ct-at_time; 570 | if(at_time<0){at_time=0;} 571 | } 572 | 573 | if(at_time<=ct){ 574 | if(at_time<=concave){ 575 | //! ts is relative startpos if start acc is used. 576 | t=at_time+ts; 577 | r.sr=vo*t+jm*(t*t*t)/6; //! Displacement. 578 | r.sr-=vo*ts+jm*(ts*ts*ts)/6; //! Substract front acc. 579 | r.vr=vo+jm*(t*t)/2; //! Velocity. 580 | r.ar=jm*t; //! Acceleration. 581 | 582 | if(sct==1){ //! **** Scurve type : dcc. 583 | r.ar=-std::abs(r.ar); //! **** Dcc curve. 584 | r.sr=stn-r.sr; //! **** Dcc curve, mirror displacment. 585 | } 586 | 587 | } 588 | if(at_time>concave){ 589 | t=at_time-concave; 590 | 591 | th=t1/2; 592 | vh=vo+jm*(th*th)/2; //! Velocity at start of convex period. Velocity at first inflection point. 593 | 594 | r.sr=vh*t + as*(t*t)/2 - jm*(t*t*t)/6; 595 | r.sr+=sce; //! Add displacement concave period. 596 | r.vr=vh + as*t - jm*(t*t)/2; 597 | r.ar=as-jm*t; 598 | 599 | if(sct==1){ //! **** Scurve type : dcc. 600 | r.ar=-std::abs(r.ar); //! ***** Dcc curve. 601 | r.sr=stn-r.sr; //! **** Dcc curve, mirror displacment. 602 | } 603 | } 604 | } 605 | 606 | //! This does nothing now, but i leave it here just for info. 607 | bool debug=0; 608 | if(debug){ 609 | std::cout<<"Check displacements"<Remove_all(); 662 | } 663 | 664 | void MainWindow::on_pushButton_clear_lin_curve_pressed() 665 | { 666 | OpencascadeWidget->Remove_all(); 667 | } 668 | 669 | void MainWindow::on_pushButton_mb_clear_pressed() 670 | { 671 | OpencascadeWidget->Remove_all(); 672 | } 673 | 674 | void MainWindow::on_doubleSpinBox_velocity_start_valueChanged(double arg1) 675 | { 676 | OpencascadeWidget->Remove_all(); 677 | on_pushButton_show_acc_dcc_curve_pressed(); 678 | } 679 | 680 | void MainWindow::on_doubleSpinBox_velocity_end_valueChanged(double arg1) 681 | { 682 | OpencascadeWidget->Remove_all(); 683 | on_pushButton_show_acc_dcc_curve_pressed(); 684 | } 685 | 686 | void MainWindow::on_doubleSpinBox_acceleration_max_valueChanged(double arg1) 687 | { 688 | OpencascadeWidget->Remove_all(); 689 | on_pushButton_show_acc_dcc_curve_pressed(); 690 | } 691 | 692 | void MainWindow::on_doubleSpinBox_acceleration_end_valueChanged(double arg1) 693 | { 694 | OpencascadeWidget->Remove_all(); 695 | on_pushButton_show_acc_dcc_curve_pressed(); 696 | } 697 | 698 | void MainWindow::on_doubleSpinBox_acceleration_begin_valueChanged(double arg1) 699 | { 700 | OpencascadeWidget->Remove_all(); 701 | on_pushButton_show_acc_dcc_curve_pressed(); 702 | } 703 | 704 | void MainWindow::on_comboBox_scruve_type_currentIndexChanged(int index) 705 | { 706 | //! Swap velocity values to avoid impossible situation. 707 | double vo=ui->doubleSpinBox_velocity_start->value(); 708 | double ve=ui->doubleSpinBox_velocity_end->value(); 709 | ui->doubleSpinBox_velocity_start->setValue(ve); 710 | ui->doubleSpinBox_velocity_end->setValue(vo); 711 | } 712 | 713 | void MainWindow::on_doubleSpinBox_lin_velocity_valueChanged(double arg1) 714 | { 715 | OpencascadeWidget->Remove_all(); 716 | on_pushButton_show_lin_curve_pressed(); 717 | } 718 | 719 | void MainWindow::on_doubleSpinBox_lin_displacment_valueChanged(double arg1) 720 | { 721 | OpencascadeWidget->Remove_all(); 722 | on_pushButton_show_lin_curve_pressed(); 723 | } 724 | 725 | void MainWindow::on_doubleSpinBox_mb_velocity_start_valueChanged(double arg1) 726 | { 727 | OpencascadeWidget->Remove_all(); 728 | on_pushButton_create_motion_block_pressed(); 729 | } 730 | 731 | void MainWindow::on_doubleSpinBox_mb_velocity_end_valueChanged(double arg1) 732 | { 733 | OpencascadeWidget->Remove_all(); 734 | on_pushButton_create_motion_block_pressed(); 735 | } 736 | 737 | void MainWindow::on_doubleSpinBox_mb_velocity_max_valueChanged(double arg1) 738 | { 739 | OpencascadeWidget->Remove_all(); 740 | on_pushButton_create_motion_block_pressed(); 741 | } 742 | 743 | void MainWindow::on_doubleSpinBox_mb_acc_max_valueChanged(double arg1) 744 | { 745 | OpencascadeWidget->Remove_all(); 746 | on_pushButton_create_motion_block_pressed(); 747 | } 748 | 749 | void MainWindow::on_doubleSpinBox_mb_acc_begin_valueChanged(double arg1) 750 | { 751 | OpencascadeWidget->Remove_all(); 752 | on_pushButton_create_motion_block_pressed(); 753 | } 754 | 755 | void MainWindow::on_doubleSpinBox_mb_acc_end_valueChanged(double arg1) 756 | { 757 | OpencascadeWidget->Remove_all(); 758 | on_pushButton_create_motion_block_pressed(); 759 | } 760 | 761 | void MainWindow::on_doubleSpinBox_mb_pathlenght_valueChanged(double arg1) 762 | { 763 | OpencascadeWidget->Remove_all(); 764 | on_pushButton_create_motion_block_pressed(); 765 | } 766 | 767 | void MainWindow::on_pushButton_show_acc_dcc_curve_pressed() 768 | { 769 | 770 | } 771 | 772 | void MainWindow::on_pushButton_show_lin_curve_pressed() 773 | { 774 | 775 | } 776 | 777 | 778 | -------------------------------------------------------------------------------- /gui_project/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | #ifdef Success 7 | #undef Success 8 | #endif 9 | 10 | // libocc 11 | #include 12 | using namespace occ; 13 | 14 | #include 15 | 16 | QT_BEGIN_NAMESPACE 17 | namespace Ui { class MainWindow; } 18 | QT_END_NAMESPACE 19 | 20 | class MainWindow : public QMainWindow 21 | { 22 | Q_OBJECT 23 | 24 | public: 25 | MainWindow(QWidget *parent = nullptr); 26 | ~MainWindow(); 27 | 28 | struct RESULT{ 29 | //! Displacement result. 30 | double sr=0; 31 | //! Velocity result. 32 | double vr=0; 33 | //! Acceleration result. 34 | double ar=0; 35 | //! Curve time. 36 | double ct=0; 37 | //! Curve displacment. 38 | double cs=0; 39 | //! Error. 40 | bool error=0; 41 | }; 42 | 43 | RESULT scurve_lineair(double at_time, double vs, double cs); 44 | RESULT scurve_acc_dcc(int sct, double vo, double ve, double am, double acs, double ace, double at_time); 45 | RESULT motion(double vs, double am, double vo, double acs, double ltot, double ve, double ace, double at_time); 46 | 47 | struct CONTROL{ 48 | //! Maximum velocity 49 | double vs=0; 50 | //! Velocity overide 0-100% 51 | double vso=0; 52 | //! Maximum acceleration 53 | double am=0; 54 | //! Interval time. 55 | double i_time=0; 56 | //! Traject time. 57 | double tr_time=0; 58 | //! Traject displacment. 59 | double tr_s=0; 60 | }; 61 | 62 | struct PATH{ 63 | //! Maximum velocity. 64 | double vs=0; 65 | //! Velocity begin. 66 | double vo=0; 67 | //! Acceleration start. 68 | double acs=0; 69 | //! Path lenght. 70 | double ltot=0; 71 | //! Velocity end. 72 | double ve=0; 73 | //! Acceleration end. 74 | double ace=0; 75 | //! Distance to go. 76 | double dtg=0; 77 | }; 78 | 79 | void simulate(); 80 | void runner(CONTROL c, std::vector pathvec); 81 | 82 | private slots: 83 | 84 | void on_pushButton_show_acc_dcc_curve_pressed(); 85 | 86 | void on_doubleSpinBox_velocity_start_valueChanged(double arg1); 87 | 88 | void on_doubleSpinBox_velocity_end_valueChanged(double arg1); 89 | 90 | void on_doubleSpinBox_acceleration_max_valueChanged(double arg1); 91 | 92 | void on_doubleSpinBox_acceleration_begin_valueChanged(double arg1); 93 | 94 | void on_comboBox_scruve_type_currentIndexChanged(int index); 95 | 96 | void on_doubleSpinBox_lin_velocity_valueChanged(double arg1); 97 | 98 | void on_doubleSpinBox_lin_displacment_valueChanged(double arg1); 99 | 100 | void on_pushButton_show_lin_curve_pressed(); 101 | 102 | void on_pushButton_clear_lin_curve_pressed(); 103 | 104 | void on_pushButton_create_motion_block_pressed(); 105 | 106 | void on_pushButton_clear_dcc_curve_pressed(); 107 | 108 | void on_doubleSpinBox_mb_velocity_start_valueChanged(double arg1); 109 | 110 | void on_doubleSpinBox_mb_velocity_end_valueChanged(double arg1); 111 | 112 | void on_doubleSpinBox_mb_velocity_max_valueChanged(double arg1); 113 | 114 | void on_doubleSpinBox_mb_acc_max_valueChanged(double arg1); 115 | 116 | void on_doubleSpinBox_mb_acc_begin_valueChanged(double arg1); 117 | 118 | void on_doubleSpinBox_mb_acc_end_valueChanged(double arg1); 119 | 120 | void on_pushButton_mb_clear_pressed(); 121 | 122 | void on_doubleSpinBox_mb_pathlenght_valueChanged(double arg1); 123 | 124 | void on_doubleSpinBox_acceleration_end_valueChanged(double arg1); 125 | 126 | void on_pushButton_simulate_path_pressed(); 127 | 128 | private: 129 | Ui::MainWindow *ui; 130 | Opencascade *OpencascadeWidget; 131 | 132 | }; 133 | #endif // MAINWINDOW_H 134 | 135 | -------------------------------------------------------------------------------- /gui_project/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1215 10 | 740 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 202 20 | 202 21 | 202 22 | 23 | 24 | 25 | 26 | 27 | 28 | 33 29 | 38 30 | 45 31 | 32 | 33 | 34 | 35 | 36 | 37 | 255 38 | 255 39 | 255 40 | 41 | 42 | 43 | 44 | 45 | 46 | 163 47 | 163 48 | 163 49 | 50 | 51 | 52 | 53 | 54 | 55 | 13 56 | 17 57 | 23 58 | 59 | 60 | 61 | 62 | 63 | 64 | 13 65 | 17 66 | 23 67 | 68 | 69 | 70 | 71 | 72 | 73 | 56 74 | 56 75 | 56 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 202 85 | 202 86 | 202 87 | 88 | 89 | 90 | 91 | 92 | 93 | 33 94 | 38 95 | 45 96 | 97 | 98 | 99 | 100 | 101 | 102 | 255 103 | 255 104 | 255 105 | 106 | 107 | 108 | 109 | 110 | 111 | 163 112 | 163 113 | 163 114 | 115 | 116 | 117 | 118 | 119 | 120 | 13 121 | 17 122 | 23 123 | 124 | 125 | 126 | 127 | 128 | 129 | 13 130 | 17 131 | 23 132 | 133 | 134 | 135 | 136 | 137 | 138 | 56 139 | 56 140 | 56 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 190 150 | 190 151 | 190 152 | 153 | 154 | 155 | 156 | 157 | 158 | 33 159 | 38 160 | 45 161 | 162 | 163 | 164 | 165 | 166 | 167 | 190 168 | 190 169 | 190 170 | 171 | 172 | 173 | 174 | 175 | 176 | 190 177 | 190 178 | 190 179 | 180 | 181 | 182 | 183 | 184 | 185 | 13 186 | 17 187 | 23 188 | 189 | 190 | 191 | 192 | 193 | 194 | 13 195 | 17 196 | 23 197 | 198 | 199 | 200 | 201 | 202 | 203 | 56 204 | 56 205 | 56 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | Skynet cyberdyne s-curve builder 214 | 215 | 216 | 217 | :/arrow-down.png:/arrow-down.png 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | -10000.000000000000000 230 | 231 | 232 | 10000.000000000000000 233 | 234 | 235 | 0.500000000000000 236 | 237 | 238 | 0.000000000000000 239 | 240 | 241 | 242 | 243 | 244 | 245 | Velocity max (Vs) 246 | 247 | 248 | 249 | 250 | 251 | 252 | Velocity start (Vo) 253 | 254 | 255 | 256 | 257 | 258 | 259 | Result = Time [t] 260 | 261 | 262 | 263 | 264 | 265 | 266 | Acceleration End 267 | 268 | 269 | 270 | 271 | 272 | 273 | Curve acc,dcc 274 | 275 | 276 | 277 | 278 | 279 | 280 | -10000.000000000000000 281 | 282 | 283 | 10000.000000000000000 284 | 285 | 286 | 3.000000000000000 287 | 288 | 289 | 290 | 291 | 292 | 293 | -10000.000000000000000 294 | 295 | 296 | 10000.000000000000000 297 | 298 | 299 | 0.100000000000000 300 | 301 | 302 | 1.000000000000000 303 | 304 | 305 | 306 | 307 | 308 | 309 | Velocity start (Vo) 310 | 311 | 312 | 313 | 314 | 315 | 316 | Acceleration Begin 317 | 318 | 319 | 320 | 321 | 322 | 323 | -10000.000000000000000 324 | 325 | 326 | 10000.000000000000000 327 | 328 | 329 | 0.000000000000000 330 | 331 | 332 | 333 | 334 | 335 | 336 | -10000.000000000000000 337 | 338 | 339 | 10000.000000000000000 340 | 341 | 342 | 10.000000000000000 343 | 344 | 345 | 346 | 347 | 348 | 349 | Velocity (Ve) 350 | 351 | 352 | 353 | 354 | 355 | 356 | Acceleration Max (AccMax) 357 | 358 | 359 | 360 | 361 | 362 | 363 | Clear 364 | 365 | 366 | 367 | 368 | 369 | 370 | Acceleration Max (AccMax) 371 | 372 | 373 | 374 | 375 | 376 | 377 | Velocity end (Ve) 378 | 379 | 380 | 381 | 382 | 383 | 384 | -10000.000000000000000 385 | 386 | 387 | 10000.000000000000000 388 | 389 | 390 | 0.500000000000000 391 | 392 | 393 | 5.000000000000000 394 | 395 | 396 | 397 | 398 | 399 | 400 | -10000.000000000000000 401 | 402 | 403 | 10000.000000000000000 404 | 405 | 406 | 0.100000000000000 407 | 408 | 409 | 410 | 411 | 412 | 413 | Show dcc curve 414 | 415 | 416 | 417 | 418 | 419 | 420 | -10000.000000000000000 421 | 422 | 423 | 10000.000000000000000 424 | 425 | 426 | 5.000000000000000 427 | 428 | 429 | 430 | 431 | 432 | 433 | -10000.000000000000000 434 | 435 | 436 | 10000.000000000000000 437 | 438 | 439 | 0.100000000000000 440 | 441 | 442 | 443 | 444 | 445 | 446 | Clear 447 | 448 | 449 | 450 | 451 | 452 | 453 | Show linair curve 454 | 455 | 456 | 457 | 458 | 459 | 460 | Motion block 461 | 462 | 463 | 464 | 465 | 466 | 467 | Curve lineair 468 | 469 | 470 | 471 | 472 | 473 | 474 | -10000.000000000000000 475 | 476 | 477 | 10000.000000000000000 478 | 479 | 480 | 10.000000000000000 481 | 482 | 483 | 484 | 485 | 486 | 487 | Displacement (S) 488 | 489 | 490 | 491 | 492 | 493 | 494 | Velocity end (Ve) 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | Scurve type::acceleration. Velocity up. 503 | 504 | 505 | 506 | 507 | Scurve type::deceleration. Velocity down. 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | Acceleration Begin 516 | 517 | 518 | 519 | 520 | 521 | 522 | Acceleration End 523 | 524 | 525 | 526 | 527 | 528 | 529 | -10000.000000000000000 530 | 531 | 532 | 10000.000000000000000 533 | 534 | 535 | 0.000000000000000 536 | 537 | 538 | 539 | 540 | 541 | 542 | -10000.000000000000000 543 | 544 | 545 | 100000.000000000000000 546 | 547 | 548 | 2.000000000000000 549 | 550 | 551 | 552 | 553 | 554 | 555 | -10000.000000000000000 556 | 557 | 558 | 10000.000000000000000 559 | 560 | 561 | 562 | 563 | 564 | 565 | Pahtlenght 566 | 567 | 568 | 569 | 570 | 571 | 572 | -100000.000000000000000 573 | 574 | 575 | 100000.000000000000000 576 | 577 | 578 | 1.000000000000000 579 | 580 | 581 | 100.000000000000000 582 | 583 | 584 | 585 | 586 | 587 | 588 | Create motion block 589 | 590 | 591 | 592 | 593 | 594 | 595 | Clear 596 | 597 | 598 | 599 | 600 | 601 | 602 | Simulate path example 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 0 613 | 0 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | -------------------------------------------------------------------------------- /gui_project/motion.pro: -------------------------------------------------------------------------------- 1 | QT += core gui opengl 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | CONFIG += c++17 6 | 7 | # You can make your code fail to compile if it uses deprecated APIs. 8 | # In order to do so, uncomment the following line. 9 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 10 | 11 | SOURCES += \ 12 | libocct/draw_primitives.cpp \ 13 | libocct/opencascade.cpp \ 14 | main.cpp \ 15 | mainwindow.cpp 16 | 17 | HEADERS += \ 18 | libocct/draw_primitives.h \ 19 | libocct/opencascade.h \ 20 | mainwindow.h 21 | 22 | FORMS += \ 23 | mainwindow.ui 24 | 25 | INCLUDEPATH += /usr/include/ \ 26 | /usr/local/include/opencascade/ \ 27 | /usr/include/eigen3/ \ 28 | /usr/local/lib/ \ 29 | 30 | LIBS += -L/usr/local/lib/ \ 31 | 32 | # project 33 | INCLUDEPATH+= libspline/ \ 34 | libocct/ \ 35 | 36 | #Opencascade 37 | LIBS+= -L/usr/local/lib/ \ 38 | 39 | INCLUDEPATH += /usr/local/include/kdl/ \ 40 | /usr/local/include/opencascade/ \ 41 | /usr/include/eigen3/ \ 42 | /usr/include/ \ 43 | /usr/local/lib/ \ 44 | 45 | LIBS += -lorocos-kdl 46 | 47 | # Opencascade 48 | LIBS += -lTKPrim 49 | LIBS += -lTKernel -lTKMath -lTKTopAlgo -lTKService 50 | LIBS += -lTKG2d -lTKG3d -lTKV3d -lTKOpenGl 51 | LIBS += -lTKBRep -lTKXSBase -lTKGeomBase 52 | LIBS += -lTKMeshVS -lTKXSDRAW 53 | LIBS += -lTKLCAF -lTKXCAF -lTKCAF 54 | LIBS += -lTKCDF -lTKBin -lTKBinL -lTKBinXCAF -lTKXml -lTKXmlL -lTKXmlXCAF 55 | # -- IGES support 56 | LIBS += -lTKIGES 57 | # -- STEP support 58 | LIBS += -lTKSTEP -lTKXDESTEP -lTKXDEIGES 59 | # -- STL support 60 | LIBS += -lTKSTL 61 | # -- OBJ/glTF support 62 | 63 | LIBS += -lTKRWMesh 64 | 65 | #src/base/io_occ_base_mesh.cpp \ 66 | #src/base/io_occ_gltf.cpp \ 67 | #src/base/io_occ_obj.cpp 68 | 69 | # -- VRML support 70 | LIBS += -lTKVRML 71 | 72 | # this copies the configuration files etc to the build direcory. So user has only to edit the source directory. 73 | copydata.commands = $(COPY_DIR) $$PWD/* $$OUT_PWD 74 | first.depends = $(first) copydata 75 | export(first.depends) 76 | export(copydata.commands) 77 | QMAKE_EXTRA_TARGETS += first copydata 78 | 79 | # Default rules for deployment. 80 | qnx: target.path = /tmp/$${TARGET}/bin 81 | else: unix:!android: target.path = /opt/$${TARGET}/bin 82 | !isEmpty(target.path): INSTALLS += target 83 | 84 | RESOURCES += \ 85 | libicons.qrc 86 | -------------------------------------------------------------------------------- /gui_project/pallete.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 202 8 | 202 9 | 202 10 | 11 | 12 | 13 | 14 | 15 | 16 | 33 17 | 38 18 | 45 19 | 20 | 21 | 22 | 23 | 24 | 25 | 255 26 | 255 27 | 255 28 | 29 | 30 | 31 | 32 | 33 | 34 | 163 35 | 163 36 | 163 37 | 38 | 39 | 40 | 41 | 42 | 43 | 13 44 | 17 45 | 23 46 | 47 | 48 | 49 | 50 | 51 | 52 | 13 53 | 17 54 | 23 55 | 56 | 57 | 58 | 59 | 60 | 61 | 56 62 | 56 63 | 56 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 202 73 | 202 74 | 202 75 | 76 | 77 | 78 | 79 | 80 | 81 | 33 82 | 38 83 | 45 84 | 85 | 86 | 87 | 88 | 89 | 90 | 255 91 | 255 92 | 255 93 | 94 | 95 | 96 | 97 | 98 | 99 | 163 100 | 163 101 | 163 102 | 103 | 104 | 105 | 106 | 107 | 108 | 13 109 | 17 110 | 23 111 | 112 | 113 | 114 | 115 | 116 | 117 | 13 118 | 17 119 | 23 120 | 121 | 122 | 123 | 124 | 125 | 126 | 56 127 | 56 128 | 56 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 190 138 | 190 139 | 190 140 | 141 | 142 | 143 | 144 | 145 | 146 | 33 147 | 38 148 | 45 149 | 150 | 151 | 152 | 153 | 154 | 155 | 190 156 | 190 157 | 190 158 | 159 | 160 | 161 | 162 | 163 | 164 | 190 165 | 190 166 | 190 167 | 168 | 169 | 170 | 171 | 172 | 173 | 13 174 | 17 175 | 23 176 | 177 | 178 | 179 | 180 | 181 | 182 | 13 183 | 17 184 | 23 185 | 186 | 187 | 188 | 189 | 190 | 191 | 56 192 | 56 193 | 56 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /libscurve.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grotius-cnc/s-curve-motion-planning/2d716ad59e6fd79b65df2d93dacac4eebfd0fd6f/libscurve.so -------------------------------------------------------------------------------- /libscurve.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grotius-cnc/s-curve-motion-planning/2d716ad59e6fd79b65df2d93dacac4eebfd0fd6f/libscurve.so.1 -------------------------------------------------------------------------------- /libscurve.so.1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grotius-cnc/s-curve-motion-planning/2d716ad59e6fd79b65df2d93dacac4eebfd0fd6f/libscurve.so.1.0 -------------------------------------------------------------------------------- /libscurve.so.1.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grotius-cnc/s-curve-motion-planning/2d716ad59e6fd79b65df2d93dacac4eebfd0fd6f/libscurve.so.1.0.0 -------------------------------------------------------------------------------- /scurve.cpp: -------------------------------------------------------------------------------- 1 | #include "scurve.h" 2 | 3 | Scurve::Scurve() 4 | { 5 | } 6 | 7 | void Scurve::example(){ 8 | std::cout.precision(3); 9 | 10 | //! Velocity max. 11 | double vs=10; 12 | //! Acceleration max. 13 | double am=2; 14 | 15 | //! Pathlenght. 16 | double ltot=100; 17 | 18 | //! Velocity begin. 19 | double vo=0; 20 | //! Acceleration begin. 21 | double acs=0; 22 | 23 | //! Velocity end. 24 | double ve=0; 25 | //! Acceleration end. 26 | double ace=0; 27 | 28 | double t=0; 29 | 30 | //! A motion. 31 | bool ok=1; 32 | while(ok){ 33 | 34 | RESULT r=motion(vs, am, vo, acs, ltot, ve, ace, t); 35 | t+=0.1; 36 | //! Exit when time > result.curvetime. 37 | if(t>=r.ct){ 38 | ok=0; 39 | } 40 | 41 | std::cout<vs){ 55 | ve=vs; 56 | } 57 | 58 | //! Priority, starting at acc<0, controlled stop, goto to vs. 59 | if(acs<=0 && vs=0, controlled stop, goto to vs. 67 | if(acs>0 && vs=a.ct){ 86 | t-=a.ct; 87 | r=scurve_acc_dcc(1,vo+gain, vs, am, 0/*acs*/, ace ,t); 88 | r.sr+=a.cs; 89 | } 90 | 91 | r.ct=ct; 92 | return r; 93 | } 94 | 95 | //! Normal curve, starting with acc>0 96 | if(acs>=0 && vs>=vo && vs>=ve){ 97 | //! Get curve time. 98 | t=0; 99 | RESULT a,b,c; 100 | double ct=0; 101 | a=scurve_acc_dcc(0,vo, vs, am, acs, 0/*ace*/ ,t); 102 | c=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 103 | 104 | double lb=ltot-(a.cs+c.cs); 105 | b=scurve_lineair(0,vs,lb); 106 | ct=a.ct+b.ct+c.ct; 107 | 108 | if(lb<0){ 109 | std::cout<<"lin stage<0!"<ltot){ 112 | vs-=0.1; 113 | a=scurve_acc_dcc(0,vo, vs, am, acs, 0/*ace*/ ,t); 114 | c=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 115 | } 116 | lb=ltot-(a.cs+c.cs); 117 | 118 | b=scurve_lineair(t,vs,lb); 119 | ct=a.ct+b.ct+c.ct; 120 | } 121 | 122 | t=at_time; 123 | if(t<=a.ct){ 124 | r=scurve_acc_dcc(0,vo, vs, am, acs, 0/*ace*/ ,t); 125 | } 126 | if(t>a.ct && t<(a.ct+b.ct)){ 127 | t-=a.ct; 128 | r=scurve_lineair(t,vs,lb); 129 | r.sr+=a.cs; 130 | } 131 | if(t>=a.ct+b.ct && t<=a.ct+b.ct+c.ct){ 132 | t-=a.ct; 133 | t-=b.ct; 134 | r=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 135 | r.sr+=a.cs; 136 | r.sr+=b.cs; 137 | 138 | 139 | } 140 | r.ct=ct; 141 | return r; 142 | } 143 | 144 | //! Normal curve, starting with acc<0 145 | if(acs<0 && vs>=vo && vs>=ve){ 146 | //! Get curve time. 147 | t=0; 148 | RESULT a,b,c,d; 149 | double ct=0; 150 | a=scurve_acc_dcc(1,vo, vo-1, am, acs, 0/*ace*/ ,t); 151 | b=scurve_acc_dcc(0,vo-1, vs, am, 0/*acs*/, 0/*ace*/ ,t); 152 | d=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 153 | 154 | double lc=ltot-(a.cs+b.cs+d.cs); 155 | c=scurve_lineair(0,vs,lc); 156 | ct=a.ct+b.ct+c.ct+d.ct; 157 | 158 | if(lc<0){ 159 | std::cout<<"lin stage<0!"<ltot){ 162 | vs-=0.1; 163 | a=scurve_acc_dcc(1,vo, vo-1, am, acs, 0/*ace*/ ,t); 164 | b=scurve_acc_dcc(0,vo-1, vs, am, 0/*acs*/, 0/*ace*/ ,t); 165 | d=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 166 | } 167 | lc=ltot-(a.cs+b.cs+d.cs); 168 | 169 | c=scurve_lineair(t,vs,lc); 170 | ct=a.ct+b.ct+c.ct+d.ct; 171 | } 172 | 173 | t=at_time; 174 | if(t=a.ct && t<(a.ct+b.ct)){ 178 | t-=a.ct; 179 | r=scurve_acc_dcc(0,vo-1, vs, am, 0/*acs*/, 0/*ace*/ ,t); 180 | r.sr+=a.cs; 181 | } 182 | if(t>=a.ct+b.ct && t=a.ct+b.ct+c.ct && t<=a.ct+b.ct+c.ct+d.ct){ 190 | t-=a.ct; 191 | t-=b.ct; 192 | t-=c.ct; 193 | r=scurve_acc_dcc(1,vs, ve, am, 0/*acs*/, ace ,t); 194 | r.sr+=a.cs; 195 | r.sr+=b.cs; 196 | r.sr+=c.cs; 197 | } 198 | r.ct=ct; 199 | return r; 200 | } 201 | 202 | return r; 203 | } 204 | 205 | //! Inputs: 206 | //! sct=scurve type [0=acc, 1=dcc] 207 | //! vo=velocity start 208 | //! vs=velocity max 209 | //! ve=velocity end 210 | //! am=acceleration max 211 | //! acs=acceleration start 212 | //! ace=acceleration end 213 | //! at_time=request curve state at time stamp. 214 | Scurve::RESULT Scurve::scurve_acc_dcc(int sct, double vo, double ve, double am, double acs, double ace, double at_time){ 215 | 216 | RESULT r; 217 | 218 | //! ***** = Addons for scurve mirror effect. 219 | if(sct==1){ 220 | //! ***** mirror acceleration start, end. 221 | double temp_acs=std::abs(acs); 222 | acs=std::abs(ace); 223 | ace=temp_acs; 224 | 225 | //! ***** Mirror ve & vo. 226 | double temp_ve=ve; 227 | ve=vo; 228 | vo=temp_ve; 229 | } 230 | 231 | //! Minimal maximum acceleration. 232 | if(am<0.1){ 233 | am=0.1; 234 | std::cout<<"am set to:"<(2*am)){ 237 | acs=2*am; 238 | std::cout<<"acs limited to:"<2*am){ 241 | ace=2*am; 242 | std::cout<<"ace limited to:"< velocity start. 245 | if(vo>=ve){ 246 | std::cout<<"impossible situation for acc curve. vo>ve"<0){ 272 | ts=acs/jm; //! Time[t] on concave period. a=jm*t; 273 | } else { 274 | ts=0; 275 | } 276 | //! Curve has acceleration end value. Find end time[t]. 277 | if(ace>0){ 278 | te=(as-ace)/jm; //! Time[t] on concvex period. a=jm*t; 279 | } else { 280 | te=t1/2; 281 | } 282 | 283 | //! Concave period. 284 | t=ts; //! at start of curve. 285 | double sa=vo*t+jm*(t*t*t)/6; //! Netto displacment concave front. 286 | t=t1/2; //! at end of curve. 287 | vece=vo+jm*(t*t)/2; //! velocity end. 288 | double sb=vo*t+jm*(t*t*t)/6; //! Bruto displacement concave front. 289 | sce=sb-sa; //! Netto displacment convace back. 290 | 291 | 292 | //! Convex period. 293 | th=t1/2; 294 | vh=vo+jm*(th*th)/2; 295 | t=te; 296 | vecx=vh + as*t - jm*(t*t)/2; //! Convex velocity end. 297 | scx=vh*t + as*(t*t)/2 - jm*(t*t*t)/6; //! Netto displacement convex front. 298 | t=t1/2; 299 | double sc=vh*t + as*(t*t)/2 - jm*(t*t*t)/6; //! Bruto displacement. 300 | double sd=sc-scx; //! Netto displacement convex back. 301 | 302 | double stn=0; //! Curve total netto displacment, excl. acc & dcc start value displacments. 303 | stn+=sce; 304 | stn+=scx; 305 | r.cs=stn; //! Curve displacment 306 | 307 | double concave=(t1/2)-ts; 308 | double convex=te; 309 | double ct=concave+convex; //! Netto curve time [ct] 310 | 311 | if(sct==1){ 312 | //! ***** Mirror time. 313 | at_time=ct-at_time; 314 | if(at_time<0){at_time=0;} 315 | } 316 | 317 | if(at_time<=ct){ 318 | if(at_time<=concave){ 319 | //! ts is relative startpos if start acc is used. 320 | t=at_time+ts; 321 | r.sr=vo*t+jm*(t*t*t)/6; //! Displacement. 322 | r.sr-=vo*ts+jm*(ts*ts*ts)/6; //! Substract front acc. 323 | r.vr=vo+jm*(t*t)/2; //! Velocity. 324 | r.ar=jm*t; //! Acceleration. 325 | 326 | if(sct==1){ //! **** Scurve type : dcc. 327 | r.ar=-std::abs(r.ar); //! **** Dcc curve. 328 | r.sr=stn-r.sr; //! **** Dcc curve, mirror displacment. 329 | } 330 | 331 | } 332 | if(at_time>concave){ 333 | t=at_time-concave; 334 | 335 | th=t1/2; 336 | vh=vo+jm*(th*th)/2; //! Velocity at start of convex period. Velocity at first inflection point. 337 | 338 | r.sr=vh*t + as*(t*t)/2 - jm*(t*t*t)/6; 339 | r.sr+=sce; //! Add displacement concave period. 340 | r.vr=vh + as*t - jm*(t*t)/2; 341 | r.ar=as-jm*t; 342 | 343 | if(sct==1){ //! **** Scurve type : dcc. 344 | r.ar=-std::abs(r.ar); //! ***** Dcc curve. 345 | r.sr=stn-r.sr; //! **** Dcc curve, mirror displacment. 346 | } 347 | } 348 | } 349 | 350 | //! This does nothing now, but i leave it here just for info. 351 | bool debug=0; 352 | if(debug){ 353 | std::cout<<"Check displacements"<