Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MATLAB Unit Tests and GitHub CI #20

Merged
merged 5 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
disp('Computing the regressor...')
tic
% Compute the symbolic regressor
Y_transposed = computeSymbolicRegressor(q(1,:).', qd(1,:).', qdd(1,:).', g, smds,regressor_opts);
Y_transposed = urdf2casadi.Identification.auxiliarySymbolicDynamicsFunctions.computeSymbolicRegressor(q(1,:).', qd(1,:).', qdd(1,:).', g, smds,regressor_opts);
% Stack of regressors, one per trajectory point
stackOfRegressorsTransposed = Y_transposed.map(nrOfTrajectoryPoints);
toc
Expand Down
6 changes: 6 additions & 0 deletions +urdf2casadi/+Utils/+Spatial/mcI.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

function rbi = mcI_to_rbi( m, c, I )

% Import skew function
import urdf2casadi.Utils.Spatial.skew

if length(c) == 3 % spatial

C = skew(c);
Expand All @@ -41,6 +44,9 @@

function [m,c,I] = rbi_to_mcI( rbi )

% Import skew function
import urdf2casadi.Utils.Spatial.skew

if all(size(rbi)==[6 6]) % spatial

m = rbi(6,6);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
function R = fromRotationAxisToRotationMatrix(a,q)
%Compute rotation matrix from rotation axis using Rodriguez formula
% a,q ---> R

% Import skew function
import urdf2casadi.Utils.Spatial.skew

if all(size(a)==[1,3])
a = a.';
end
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/matlab_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: MATLAB tests

on:
push:
branches:
- master
pull_request:
branches:
- master


jobs:

run-matlab-test:

name: Install dependencies and run MATLAB tests
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

env:
CONDA_ENV_NAME: urdf2casadi_conda_env
MATLAB_VERSION: R2020b
defaults:
run:
shell: bash -l {0}

steps:

- name: Check out repository
uses: actions/checkout@v2

- name: Install miniforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
activate-environment: ${GITHUB_WORKSPACE}/${{env.CONDA_ENV_NAME}}

- name: Install casadi, casadi-matlab-bindings and idyntree-matlab-bindings
run: conda install -c conda-forge -c robotology casadi casadi-matlab-bindings idyntree-matlab-bindings

- name: conda info
run: |
conda info
conda list
conda config --show-sources
conda config --show

- name: Set configuration enviromental variables [Ubuntu]
if: matrix.os == 'ubuntu-latest'
run: |
echo "URDF2CASADI_PACKAGE_PATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
echo "URDF2CASADI_TEST_FOLDER=${GITHUB_WORKSPACE}/tests" >> $GITHUB_ENV
echo "CONDA_ENV_LOCATION=${GITHUB_WORKSPACE}/${{env.CONDA_ENV_NAME}}" >> $GITHUB_ENV
echo "IDYNTREE_AND_CASADI_MATLAB_BINDINGS_PATH=${GITHUB_WORKSPACE}/${{env.CONDA_ENV_NAME}}/mex" >> $GITHUB_ENV
echo 'LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6' >> $GITHUB_ENV

- name: Install MATLAB
uses: matlab-actions/setup-matlab@v1
with:
release: ${{env.MATLAB_VERSION }}

- name: Run MATLAB to modify libstdc++.so.6
uses: matlab-actions/run-command@v1
with:
command: disp(matlabroot); dir([matlabroot, '/sys/os/glnxa64/']);

- name: Check the path variables
if: matrix.os == 'ubuntu-latest'
run: |
# Print the current directory and the other env variables
echo "$(pwd)"
echo $GITHUB_WORKSPACE
echo "$(ls)"
echo $CASADI_BINDINGS_PATH
echo $URDF2CASADI_PACKAGE_PATH
echo $URDF2CASADI_TEST_FOLDER

cd $CONDA_PKGS_DIR
ls
echo $CONDA_ENV_LOCATION
cd $CONDA_ENV_LOCATION
ls
cd

- name: Run MATLAB tests
uses: matlab-actions/run-command@v1
with:
command: addpath( getenv('IDYNTREE_AND_CASADI_MATLAB_BINDINGS_PATH') ); addpath(getenv('URDF2CASADI_PACKAGE_PATH')); addpath( genpath(getenv('URDF2CASADI_TEST_FOLDER')) ); cd(getenv('URDF2CASADI_TEST_FOLDER')); result=runtests; assertSuccess(result);

This file was deleted.

Loading