Repository: steffanlloyd/quik
Branch: main
Commit: a9ebd1f21dfd
Files: 38
Total size: 52.9 KB
Directory structure:
gitextract_fqme_rma/
├── .git/
│ ├── HEAD
│ ├── config
│ ├── description
│ ├── hooks/
│ │ ├── applypatch-msg.sample
│ │ ├── commit-msg.sample
│ │ ├── fsmonitor-watchman.sample
│ │ ├── post-update.sample
│ │ ├── pre-applypatch.sample
│ │ ├── pre-commit.sample
│ │ ├── pre-merge-commit.sample
│ │ ├── pre-push.sample
│ │ ├── pre-rebase.sample
│ │ ├── pre-receive.sample
│ │ ├── prepare-commit-msg.sample
│ │ ├── push-to-checkout.sample
│ │ ├── sendemail-validate.sample
│ │ └── update.sample
│ ├── index
│ ├── info/
│ │ └── exclude
│ ├── logs/
│ │ ├── HEAD
│ │ └── refs/
│ │ ├── heads/
│ │ │ └── main
│ │ └── remotes/
│ │ └── origin/
│ │ └── HEAD
│ ├── objects/
│ │ └── pack/
│ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.idx
│ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.pack
│ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.promisor
│ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.rev
│ │ ├── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.idx
│ │ ├── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.pack
│ │ ├── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.promisor
│ │ └── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.rev
│ ├── packed-refs
│ ├── refs/
│ │ ├── heads/
│ │ │ └── main
│ │ └── remotes/
│ │ └── origin/
│ │ └── HEAD
│ └── shallow
├── .gitignore
├── CMakeLists.txt
├── ReadMe.md
└── package.xml
================================================
FILE CONTENTS
================================================
================================================
FILE: .git/HEAD
================================================
ref: refs/heads/main
================================================
FILE: .git/config
================================================
[core]
repositoryformatversion = 1
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/steffanlloyd/quik
tagOpt = --no-tags
fetch = +refs/heads/main:refs/remotes/origin/main
promisor = true
partialclonefilter = blob:limit=1048576
[branch "main"]
remote = origin
merge = refs/heads/main
================================================
FILE: .git/description
================================================
Unnamed repository; edit this file 'description' to name the repository.
================================================
FILE: .git/hooks/applypatch-msg.sample
================================================
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:
================================================
FILE: .git/hooks/commit-msg.sample
================================================
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}
================================================
FILE: .git/hooks/fsmonitor-watchman.sample
================================================
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;
# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";
# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree = get_working_dir();
my $retry = 1;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
launch_watchman();
sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}
sub output_result {
my ($clockid, @files) = @_;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;
binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}
sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
return $json_pkg->new->utf8->decode($response);
}
sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
my $last_update_line = "";
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
$last_update_line = qq[\n"since": $last_update_token,];
}
my $query = <<" END";
["query", "$git_work_tree", {$last_update_line
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END
# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
return $json_pkg->new->utf8->decode($response);
}
sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};
eval { launch_watchman() };
return 0;
}
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
return 1;
}
sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}
return $working_dir;
}
================================================
FILE: .git/hooks/post-update.sample
================================================
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info
================================================
FILE: .git/hooks/pre-applypatch.sample
================================================
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:
================================================
FILE: .git/hooks/pre-commit.sample
================================================
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff-index --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
================================================
FILE: .git/hooks/pre-merge-commit.sample
================================================
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:
================================================
FILE: .git/hooks/pre-push.sample
================================================
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
while read local_ref local_oid remote_ref remote_oid
do
if test "$local_oid" = "$zero"
then
# Handle delete
:
else
if test "$remote_oid" = "$zero"
then
# New branch, examine all commits
range="$local_oid"
else
# Update to existing branch, examine new commits
range="$remote_oid..$local_oid"
fi
# Check for WIP commit
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
if test -n "$commit"
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0
================================================
FILE: .git/hooks/pre-rebase.sample
================================================
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END
================================================
FILE: .git/hooks/pre-receive.sample
================================================
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi
================================================
FILE: .git/hooks/prepare-commit-msg.sample
================================================
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi
================================================
FILE: .git/hooks/push-to-checkout.sample
================================================
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
# updateInstead.
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 "$*"
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git's push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding "cd .." or using relative paths.
if ! git update-index -q --ignore-submodules --refresh
then
die "Up-to-date check failed"
fi
if ! git diff-files --quiet --ignore-submodules --
then
die "Working directory has unstaged changes"
fi
# This is a rough translation of:
#
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
if git cat-file -e HEAD 2>/dev/null
then
head=HEAD
else
head=$(git hash-object -t tree --stdin </dev/null)
fi
if ! git diff-index --quiet --cached --ignore-submodules $head --
then
die "Working directory has staged changes"
fi
if ! git read-tree -u -m "$commit"
then
die "Could not update working tree to new HEAD"
fi
================================================
FILE: .git/hooks/sendemail-validate.sample
================================================
#!/bin/sh
# An example hook script to validate a patch (and/or patch series) before
# sending it via email.
#
# The hook should exit with non-zero status after issuing an appropriate
# message if it wants to prevent the email(s) from being sent.
#
# To enable this hook, rename this file to "sendemail-validate".
#
# By default, it will only check that the patch(es) can be applied on top of
# the default upstream branch without conflicts in a secondary worktree. After
# validation (successful or not) of the last patch of a series, the worktree
# will be deleted.
#
# The following config variables can be set to change the default remote and
# remote ref that are used to apply the patches against:
#
# sendemail.validateRemote (default: origin)
# sendemail.validateRemoteRef (default: HEAD)
#
# Replace the TODO placeholders with appropriate checks according to your
# needs.
validate_cover_letter () {
file="$1"
# TODO: Replace with appropriate checks (e.g. spell checking).
true
}
validate_patch () {
file="$1"
# Ensure that the patch applies without conflicts.
git am -3 "$file" || return
# TODO: Replace with appropriate checks for this patch
# (e.g. checkpatch.pl).
true
}
validate_series () {
# TODO: Replace with appropriate checks for the whole series
# (e.g. quick build, coding style checks, etc.).
true
}
# main -------------------------------------------------------------------------
if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1
then
remote=$(git config --default origin --get sendemail.validateRemote) &&
ref=$(git config --default HEAD --get sendemail.validateRemoteRef) &&
worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) &&
git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" &&
git config --replace-all sendemail.validateWorktree "$worktree"
else
worktree=$(git config --get sendemail.validateWorktree)
fi || {
echo "sendemail-validate: error: failed to prepare worktree" >&2
exit 1
}
unset GIT_DIR GIT_WORK_TREE
cd "$worktree" &&
if grep -q "^diff --git " "$1"
then
validate_patch "$1"
else
validate_cover_letter "$1"
fi &&
if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL"
then
git config --unset-all sendemail.validateWorktree &&
trap 'git worktree remove -ff "$worktree"' EXIT &&
validate_series
fi
================================================
FILE: .git/hooks/update.sample
================================================
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --type=bool hooks.allowunannotated)
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0
================================================
FILE: .git/info/exclude
================================================
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
================================================
FILE: .git/logs/HEAD
================================================
0000000000000000000000000000000000000000 a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc appuser <appuser@7c99e0e64a07.(none)> 1779396077 +0000 clone: from https://github.com/steffanlloyd/quik
================================================
FILE: .git/logs/refs/heads/main
================================================
0000000000000000000000000000000000000000 a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc appuser <appuser@7c99e0e64a07.(none)> 1779396077 +0000 clone: from https://github.com/steffanlloyd/quik
================================================
FILE: .git/logs/refs/remotes/origin/HEAD
================================================
0000000000000000000000000000000000000000 a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc appuser <appuser@7c99e0e64a07.(none)> 1779396077 +0000 clone: from https://github.com/steffanlloyd/quik
================================================
FILE: .git/objects/pack/pack-4053744f65cc88ed0e06b753c1e70251da189553.promisor
================================================
a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc refs/heads/main
================================================
FILE: .git/objects/pack/pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.promisor
================================================
================================================
FILE: .git/packed-refs
================================================
# pack-refs with: peeled fully-peeled sorted
a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc refs/remotes/origin/main
================================================
FILE: .git/refs/heads/main
================================================
a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc
================================================
FILE: .git/refs/remotes/origin/HEAD
================================================
ref: refs/remotes/origin/main
================================================
FILE: .git/shallow
================================================
a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc
================================================
FILE: .gitignore
================================================
# Ignore all
*
# Unignore all with extensions
!*.*
# Unignore all dirs
!*/
# Don't track content of these folders
**/codegen/
codegen/
*media/
*slprj/
*bak/
**/bak/
/temp/*
scripts/
*.autosave
*.asv
save_data/*
**/save_data/*
# Ignore config file
*config.m
# Ignore simulink real time folders
*_maci64/
*_rtt/
*_sldrt_ert_maci64/
*sldrt_maci64/
*_rtw/
**_rtw/
*.rxm64
*.slxc
*.prj
*.DS_store
# Ignore sublime folders
*.sublime-project
*.sublime-workspace
*.xcodeproj
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.so
*.mex*
*.mexmaci64
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.8)
project(quik)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(Eigen3 REQUIRED NO_MODULE)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
include_directories(include)
include_directories(${EIGEN3_INCLUDE_DIR})
rosidl_generate_interfaces(${PROJECT_NAME}
"srv/IKService.srv"
"srv/FKService.srv"
"srv/JacobianService.srv"
DEPENDENCIES geometry_msgs std_msgs
)
# Install header files
install(DIRECTORY include/
DESTINATION include
)
# Add executable
add_executable(sample_cpp_usage
src/sample_cpp_usage.cpp
src/geometry.cpp)
ament_target_dependencies(sample_cpp_usage Eigen3)
add_executable(ros_kinematics_service_node
src/ros_kinematics_service_node.cpp
src/geometry.cpp
src/ros_helpers.cpp)
ament_target_dependencies(ros_kinematics_service_node
rclcpp
Eigen3
rosidl_default_runtime
geometry_msgs
std_msgs)
add_executable(sample_ros_client_node
src/sample_ros_client_node.cpp
src/geometry.cpp
src/ros_helpers.cpp)
ament_target_dependencies(sample_ros_client_node
rclcpp
Eigen3
rosidl_default_runtime
geometry_msgs
std_msgs)
add_executable(sample_ros_cpp_node
src/sample_ros_cpp_node.cpp
src/geometry.cpp
src/ros_helpers.cpp)
ament_target_dependencies(sample_ros_cpp_node
rclcpp
Eigen3
rosidl_default_runtime
geometry_msgs
std_msgs)
ament_export_dependencies(rosidl_default_runtime)
# Install library and create export set
install(TARGETS
sample_cpp_usage
ros_kinematics_service_node
sample_ros_client_node
sample_ros_cpp_node
DESTINATION lib/${PROJECT_NAME})
install(TARGETS
DESTINATION lib/${PROJECT_NAME}
EXPORT ${PROJECT_NAME}_export
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
# Install launch files
install(
DIRECTORY launch
DESTINATION share/${PROJECT_NAME}/
)
# Install config files
install(
DIRECTORY config
DESTINATION share/${PROJECT_NAME}/
)
# Export include directories
ament_export_include_directories(include)
rosidl_get_typesupport_target(cpp_typesupport_target
${PROJECT_NAME} rosidl_typesupport_cpp)
target_link_libraries(ros_kinematics_service_node "${cpp_typesupport_target}")
target_link_libraries(sample_ros_client_node "${cpp_typesupport_target}")
target_link_libraries(sample_ros_cpp_node "${cpp_typesupport_target}")
ament_package()
================================================
FILE: ReadMe.md
================================================
# QuIK: An ultra-fast and highly robust kinematics library for C++ or ROS2 using DH parameters
QuIK is a hyper-efficient C++ kinematics library for serial manipulators. It is based on the novel QuIK algorithm, [published in IEEE-TRO](http://dx.doi.org/10.1109/TRO.2022.3162954), that uses 3rd-order velocity kinematics to solve generalized inverse kinematics significantly faster, and significantly more reliably that existing inverse kinematics packages. QuIK uses the Denevit-Hartenberg convention for kinematics, which is readily available for most manipulators and results in a more computationally efficient formulation of kinematics.
Some key benchmarks over other available solvers, on a sample 6-DOF manipulator with large initial joint error:
| Solver | Mean Solution Time | Error Rate |
| -------------- | ------------------ | ---------- |
| QuIK | 21 μs | 0.13% |
| KDL (used in ROS, and primary base solver in TracIK) | 148 μs (x7) | 5.3% (x40)|
| Matlab Robotics Toolbox | 670 μs (x32) | 1.1% (x9) |
When the initial guess is good (close to the true answer), the error rate goes to nearly zero and the solution time decreases significantly.
These benchmarks were published in the IEEE-TRO paper, and further details about them can be found there. A preprint of this paper is included in this repository: [docs/SLloydEtAl2022_QuIK_preprint.pdf](docs/SLloydEtAl2022_QuIK_preprint.pdf).
> S. Lloyd, R. Irani, and M. Ahmadi, "Fast and Robust Inverse Kinematics for Serial Robots using Halley’s Method," IEEE Transactions on Robotics, vol. 38, no. 5, pp. 2768–2780, Oct. 2022. doi: [10.1109/TRO.2022.3162954](http://dx.doi.org/10.1109/TRO.2022.3162954). A preprint of this paper can be found in the current repository, [docs/SLloydEtAl2022_QuIK_preprint.pdf](docs/SLloydEtAl2022_QuIK_preprint.pdf).
This repository includes the code to use the QuIK algorithm in ROS2, or just in C++ in general. Examples are given in python as well.
## What this repository does and does not do
This repository allows for highly efficient robot kinematics, and in particular inverse kinematics. It is designed for serial manipulators, i.e. manipulators with a single kinematic chain that does not branch.
It will perform:
- Highly efficient and robust inverse kinematics against 6-DOF constraints in world frame. E.g. a target tool point and rotation is specified, and joint angles are returned.
- Forward kinematics
- Velocity kinematics/Jacobian computation
It does not do:
- [_Planned_] Null space optimization for robots with more than 6 joints. The code works perfectly for higher-order chains, but will only return "a" solution, not necessarily a solution which is optimal.
- [_Planned_] Reduced-order or transformed constraints, where you perhaps care about the tool point, but not rotation, or other combinations thereof.
- [_Planned_] Feasibility checks. This code base does not check the computed solutions against joint limits, or check whether the target pose can be reached within the robot's speed and acceleration limits.
## Why use generalized inverse kinematics
If you can and have derived the analytic (closed-form) solution to the inverse kinematics for your robot, by all means use it! It will be faster (likely) and more reliable than a generalized solver, which can fail. Generalized inverse kinematics can be used instead, when:
- You aren't able to derive a closed-form solution, or don't want to.
- Your robot is kinematically calibrated, so the DH table is perturbed and a closed-form solution doesn't exist.
- Your robot is too complex to derive a closed form solution, or lacks a spherical wrist allowing for decoupling of the rotational and translational kinematics.
- You want to perform more complex null-space optimization (planned for future implementation in this repository).
It is worth noting though, that with this implementation of inverse kinematics, if your initial guess is good (e.g. if you use the previous state of the robot), then the algorithm will converge in 5-6 microseconds and with effectively zero error rate. A typical analytical solution will be closer to 1 microsecond. This difference may not be significant enough to make it worthwhile taking the time to derive the full analytical solution.
## How it works
The QuIK repository is based on the QuIK algorith, the full details of which can be found in the paper [docs/SLloydEtAl2022_QuIK_preprint.pdf](docs/SLloydEtAl2022_QuIK_preprint.pdf). QuIK stands for the *Quick Inverse Kinematics* algorithm, which is a new algorithm for generalized inverse kinematics of serial kinematic chains that has been shown to be 1-2 orders of magnitude faster, and more robust (fails less) than other off-the-shelf algorithms.
The key innovation in this work is the use of higher level derivatives in the iterative solver. Most current inverse kinematics solvers use the geometry Jacobian of the kinematic chain in a *damped Newton search*, where at each step the kinematics function of the robot is linearized about a point, and this linear estimate is used to project towards the correct solution. The novelty with the QuIK method is that it uses the first *and* second-order derivatives to approximate the robot's kinematics function as a quadratic curve, which is instead used to project towards the solution. This quadratic curve captures the function much more effectively than the linear estimate, leading to much faster convergence, and fewer cases of the algorithm diverging to an incorrect solution. This is visualized in the image below.

This improved convergence can be shown graphically. In the above-linked paper, 1 million random poses were generated for the 6-DOF KUKA KR6 robot and solved with a Newton-Raphson solver and the QuIK solver. Each algorithm was given an initial guess that was, on average, 45 degrees away from the true answer (on each joint).
The plot below shows the histogram distribution of the normed kinematic error after each algorithm iteration. Here, we see that the QuIK method converges to machine-level precision nearly twice as fast as the Newton algorithm, and leaves a much lower amount of its sampled unconverged at the top.

Further details and benchmarks can be found in the paper: [docs/SLloydEtAl2022_QuIK_preprint.pdf](docs/SLloydEtAl2022_QuIK_preprint.pdf).
## How to build
This repository can be closed directly into the `src` folder of your ros workspace. For optimal performance, build using the release flag. For this type of iterative code, the compiler optimizations make it run about 10x faster. It will work just fine without it, however.
```bash
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
```
## Code Description and Usage
The main C++ code is stored in `include/quik` and `src`. The code can be used directly in your C++ projects, or in C++ ros nodes, or by building and running the provided kinematics service node (see below).
**Core QuIK functionality**:
- `include/quik/Robot.hpp`: Defines the `quik::Robot` class and forward kinematic/jacobian functions.
- `include/quik/IKSolver.hpp`: Defines the `quik::IKSolver` class and associated inverse kinematics functions.
- `include/quik/geometry.hpp` and `src/geometry.cpp`: Defines the `quik::geometry` namespace, which includes a number of functions for transforming from twists to homogeneous transforms to quaternion/point representations, etc.
- `include/quik/utilities.hpp`: Defines the `quik::utilities` namespace, which includes some non-kinematic helper functions.
**ROS2 code**
- `include/quik/ros_helpers.hpp` and `src/ros_helpers.cpp`: Defines helper functions for using QuIK in ROS, such as service handlers for forward/inverse/velocity kinematics, as well as helper functions for forming and parsing service requests.
- `src/ros_kinematics_service_node.cpp`: A ROS2 node that defines services for forward, inverse, and velocity kinematics.
**Example code**
- `src/sample_cpp_usage.cpp`: A simple demo showing how the codebase can be used (ROS-indenpendent).
- `src/sample_ros_client_node.cpp`: A sample client node for the service server node provided.
- `src/sample_ros_cpp_node.cpp`: A simple demo of using the QuIK codebase in a ROS node (directly, without using the service node).
**Python code**
- `python/sample_quik_client_node.py`: A sample python node that calls the kinematics service node provided.
- `python/quik_service_helpers.py`: A python module that defines helper functions for forming and parsing service requests from the service node.
### Basic Usage
This library does not use URDF like many ROS packages; instead, it builds the robot structure using Denevit-Hartenburg (DH) convention. The DH table is a method to describe the geometry of a robot or a kinematic chain. It uses four parameters - `a`, `alpha`, `d`, and `theta` - to define the spatial relationship between adjacent links in the chain. More information on the DH convention [here](https://users.cs.duke.edu/~brd/Teaching/Bio/asmb/current/Papers/chap3-forward-kinematics.pdf) or [here](https://spart.readthedocs.io/en/latest/DH.html).
#### The ``quik::Robot`` class
In this implementation, we use the Spong notation and numbering convention for the DH table. This means that:
- `a` and `alpha` are the link length and twist angle, respectively, which describe the transformation from one link to the next.
- `d` and `theta` are the link offset and joint angle, respectively, which describe the transformation due to the joint variable.
The DH parameters are arranged in a matrix where each row corresponds to one joint of the robot, and the columns correspond to the `a`, `alpha`, `d`, and `theta` parameters, in that order.
The robot properties are defined as follows:
- `DH`: A DOFx4 matrix of the Denavit-Hartenberg (DH) parameters in the following order:
```plaintext
a_1 alpha_1 d_1 theta_1
: : : :
an alpha_n d_n theta_n
```
- `linkTypes`: A vector of link types. Each element should be `true` if the corresponding joint is a prismatic joint, `false` otherwise.
- `Qsign`: A vector of link directions. Each element should be `-1` or `1`, allowing you to change the sign of the corresponding joint variable.
- `Tbase`: The base transform of the robot. This is a 4x4 matrix representing the transformation between the world frame and the first DH frame.
- `Ttool`: The tool transform of the robot. This is a 4x4 matrix representing the transformation between the DOF'th frame and the tool frame.
For example, the following code would define the KUKA KR6 manipulator:
```c++
#include "Eigen/Dense"
#include "quik/Robot.hpp"
using namespace Eigen;
// Given as DOFx4 table, in the following order: a_i, alpha_i, d_i, theta_i.
Matrix<double, 6, 4> DH;
DH << 0.025, -M_PI/2, 0.183, 0,
-0.315, 0, 0, 0,
-0.035, M_PI/2, 0, 0,
0, -M_PI/2, 0.365, 0,
0, M_PI/2, 0, 0,
0, 0, 0.08, 0;
// Second argument is a list of joint types
Vector<quik::JOINTTYPE_t,6> linkTypes;
linkTypes << quik::JOINT_REVOLUTE, quik::JOINT_REVOLUTE, quik::JOINT_REVOLUTE, quik::JOINT_REVOLUTE, quik::JOINT_REVOLUTE, quik::JOINT_REVOLUTE;
// Third argument is a list of joint directions
// Allows you to change the sign (direction) of the joints.
Vector<double,6> Qsign;
Qsign << 1, 1, 1, 1, 1, 1;
// Fourth and fifth arguments are the base and tool transforms, respectively
Matrix4d Tbase = Matrix4d::Identity(4,4);
Matrix4d Ttool = Matrix4d::Identity(4,4);
auto R = std::make_shared<quik::Robot<6>>(DH, linkTypes, Sign, Tbase, Ttool);
```
#### The ``quik::IKSolver`` class
To perform inverse kinematics, you need to build an `IKSolver` object that takes a few extra parameters, although for basic usage the default parameters are generally good:
```c++
#include "Eigen/Dense"
#include "quik/Robot.hpp"
#include "quik/IKSolver.hpp"
using namespace Eigen;
// Define the IK options
const quik::IKSolver<6> IKS(
R, // The robot object (pointer)
200, // max number of iterations
quik::ALGORITHM_QUIK, // algorithm (ALGORITHM_QUIK, ALGORITHM_NR or ALGORITHM_BFGS)
1e-12, // Exit tolerance
1e-14, // Minimum step tolerance
0.05, // iteration-to-iteration improvement tolerance (0.05 = 5% relative improvement)
10, // max consequitive gradient fails
80, // Max gradient fails
1e-10, // lambda2 (lambda^2, the damping parameter for DQuIK and DNR)
0.34, // Max linear error step
1 // Max angular error step
);
```
For the most part, these defaults above are fairly good start, so you can initialize this object just with:
```c++
const quik::IKSolver<6> IKS(R);
```
The full list of `IKSolver` parameters are:
- `max_iterations` [`int`]: Maximum number of iterations of the
algorithm. Default: 200
- `algorithm` [`ALGORITHM_t`]: The algorithm to use.
Default: `ALGORITHM_QUIK`.
- `ALGORITHM_QUIK` - QuIK
- `ALGORITHM_NR` - Newton-Raphson or Levenberg-Marquardt
- `ALGORITHM_BFGS` - BFGS
- `exit_tolerance` [`double`]: The exit tolerance on the norm of the error. Default: `1e-12`.
- `minimum_step_size` [`double`]: The minimum joint angle step size (normed) before the solver exits. Default: `1e-14`.
- `relative_improvement_tolerance` [double]: The minimum relative iteration-to-iteration improvement. If this threshold isn't met, a counter is incremented. If the threshold isn't met
`max_consecutive_grad_fails` times in a row, then the algorithm exits. For example, 0.05 represents a minimum of 5% relative improvement. Default: `0.05`.
- `max_consecutive_grad_fails` [int]: The maximum number of relative improvement fails before the algorithm exits. Default: `20`.
- `lambda_squared` [double]: The square of the damping factor, `lambda`. Only applies to the NR and QuIK methods. If given, these methods become the DNR (also known as Levenberg-Marquardt) or the DQuIK algorithm. Ignored for BFGS algorithm. Recommended to set to a small, positive but nonzero value. Default: `1e-10`.
- `max_linear_step_size` [double]: An upper limit of the error step
in a single step. Ignored for BFGS algorithm. Default: Uses the `Robot.characteristicLength()` function to automatically estimate an appropriate value from the values in the `DH` table as `0.33*Robot.characteristicLength()`.
- `max_angular_step_size` [double]: An upper limit of the error step in a single step. Ignored for BFGS algorithm. Default: `1`.
- `armijo_sigma` [double]: The sigma value used in Armijo's rule, for line search in the BFGS method. Default: `1e-5`
- `armijo_beta` [double]: The beta value used in Armijo's rule, for line search in the BFGS method. Default: `0.5`
### Templating for fixed size
Both ``quik::Robot`` and ``quik::IKSolver`` are templated with the integer value ``DOF``, the number of degrees of freedom of the robot. The code is designed such that ``DOF`` can be set to any positive integer value, or to ``Eigen::Dynamic`` (or ``-1``) for a variable-length object. If you know the ``DOF`` beforehand, setting it properly rather than using ``-1`` will avoid dynamic memory allocation in all computations, making the code run in a more reliable and constant amount of time for real-time purposes.
## Usage in ROS
QuIK has been integrated into ROS and can be used either via a kinematics service node, or by simply using the C++ code directly. Helper functions have been written to load robot definitions from YAML config files, form service requests, and more.
### Direct C++ Usage
This library can be included and used directly, as with any C++ code. However, certain helper functions are included to help with parsing from YAML files:
```c++
#include "rclcpp/rclcpp.hpp"
#include "quik/IKSolver.hpp"
#include "quik/Robot.hpp"
#include "quik/ros_helpers.hpp"
constexpr int DOF=6;
class SampleCPPUsageNode : public rclcpp::Node
{
public:
SampleCPPUsageNode() : Node("sample_cpp_usage_node")
{
this->R = std::make_shared<quik::Robot<DOF>>(quik::ros_helpers::robotFromNodeParameters<DOF>(*this));
this->IKS = std::make_shared<quik::IKSolver<DOF>>(quik::ros_helpers::IKSolverFromNodeParameters<DOF>(*this, this->R));
}
std::shared_ptr<quik::IKSolver<DOF>> IKS;
std::shared_ptr<quik::Robot<DOF>> R;
};
```
The basic config parameters are loaded from the node's yaml file. You may use one of the provided yaml files in `config/`, or just make your own. At a minimum, the config file requires the DH table definition and a list of the joints:
```yaml
/**:
ros__parameters:
# Robot parameters
# DH table (order a_i, alpha_i, d_i, theta_i)
dh: [0.025, -1.5707963268, 0.183, 0.0,
-0.315, 0.0, 0.0, 0.0,
-0.035, 1.5707963268, 0.0, 0.0,
0.0, -1.5707963268, 0.365, 0.0,
0.0, 1.5707963268, 0.0, 0.0,
0.0, 0.0, 0.08, 0.0]
# Link types (JOINT_REVOLUTE or JOINT_PRISMATIC)
link_types: [JOINT_REVOLUTE, JOINT_REVOLUTE, JOINT_REVOLUTE, JOINT_REVOLUTE, JOINT_REVOLUTE, JOINT_REVOLUTE]
```
A simple C++ node implementing this is provided as an example in `src/sample_ros_client_node.cpp`, which can be run as:
```bash
ros2 run quik sample_ros_cpp_node --ros-args --params-file ./src/quik/config/kuka_kr6.yaml # Replace with your own config file
```
### Kinematics Service Node
The file `src/ros_kinematics_service_node.cpp` defines a service node that will load a `Robot` and `IKSolver` from the config file, as in the prior section. The kinematics service can be run as:
```bash
ros2 run quik ros_kinematics_service_node --ros-args --params-file ./src/quik/config/kuka_kr6.yaml # replace with your own config file.
```
This node defines three services.
#### Inverse kinematics service `/ik_service`:
The IK service uses the interface `srv/IKService.srv`.
```yaml
# Request
geometry_msgs/Pose target_pose
float64[] q_0 # Initial guesses of the joint angles
---
# Response
float64[] q_star # The solved joint angles
float64[6] e_star # The pose errors at the final solution
int32 iter # The number of iterations the algorithm took
int32 break_reason # The reason the algorithm stopped
bool success # Whether or not the IK was successful
```
In C++, a request can be formed using the helper function included in `ros_helpers.hpp`:
```c++
auto ik_request = quik::ros_helpers::ik_make_request(quat, d, q_perturbed);
auto ik_result = this->ik_client_->async_send_request(ik_request).get();
VectorXd q_star(this->R->dof); Vector<double,6> e_star; int iter; quik::BREAKREASON_t breakReason;
auto success = quik::ros_helpers::ik_parse_response(ik_result, q_star, e_star, iter, breakReason);
```
Similar functions are provided for python and can be seen in use in `python/sample_quik_client_node.py`.
#### Forward kinematics service `/fk_service`:
The IK service uses the interface `srv/FKService.srv`.
```yaml
# Request
float64[] q # joint_angles
int32 frame -1 # the requested frame, if ommitted defaults to the tool frame
---
# Response
geometry_msgs/Pose pose
```
In C++, a request can be formed using the helper function in `ros_helpers.hpp`:
```c++
auto fk_request = quik::ros_helpers::fk_make_request(q);
auto fk_result = this->fk_client_->async_send_request(fk_request).get();
Vector4d quat; Vector3d d;
quik::ros_helpers::fk_parse_response(fk_result, quat, d);
```
Similar functions are provided for python and can be seen in use in `python/sample_quik_client_node.py`.
#### Jacobian service `/jacobian_service`:
The IK service uses the interface `srv/JacobianService.srv`.
```yaml
# Request
float64[] q # joint_angles
---
# Response
float64[] jacobian # Jacobian matrix
```
In C++, a request can be formed using the helper function in `ros_helpers.hpp`:
```c++
auto jacobian_request = quik::ros_helpers::jacobian_make_request(q);
auto jacobian_result = this->jacobian_client_->async_send_request(jacobian_request).get();
Eigen::MatrixXd jacobian(6, this->R->dof);
quik::ros_helpers::jacobian_parse_response(jacobian_result, jacobian);
```
Similar functions are provided for python and can be seen in use in `python/sample_quik_client_node.py`.
#### Sample C++ client node
These services are called in a sample client node `src/sample_ros_client_node.cpp`, which can be run as:
```bash
ros2 run quik sample_ros_client_node --ros-args --params-file ./src/quik/config/kuka_kr6.yaml # replace with your own config file
```
#### Sample python client node.
A sample python service client is also provided. The code cannot be directly run due to ROS2 not handling packages with both python and C++ nodes well (at least in combination with custom interface definitions). However, the sample code can be found in the `python/` directory, along with helper functions for forming and parsing service requests.
### YAML Config Files
Sample config files are provided in the `config/` directory for the KUKA KR6 robot, the KUKA iiwa7 robot, and the Kinova Jaco robot. All the inputs to the `Robot` and `IKSolver` objects can be specified in these config files. If omitted, a reasonable default value will be used instead.
## Requirements
All functions rely on the [Eigen 3.4](https://eigen.tuxfamily.org) linear algebra library, so you will also need to link to an appropriate library. If you don't have Eigen on your machine, it can be installed with (on ubuntu):
```bash
sudo apt install libeigen3-dev
```
## Citations
If you use our work, please reference our publication below. Recommended citation:
[1] [S. Lloyd, R. A. Irani, and M. Ahmadi, “Fast and Robust Inverse Kinematics of Serial Robots Using Halley’s Method,” IEEE Transactions on Robotics, vol. 38, no. 5, pp. 2768–2780, Oct. 2022.](docs/SLloydEtAl2022_QuIK_preprint.pdf) doi: [10.1109/TRO.2022.3162954](http://dx.doi.org/10.1109/TRO.2022.3162954).
## Commercial Licensing
This repository is published under the AGPL license, which enforces that all derivative works must also be made open source.
For commercial applications where open-source of derivative works is not possible, individual commercial licensing is available for a modest fee. Contact `steffan` dot `lloyd` at `icloud` dot `com` for details.
================================================
FILE: package.xml
================================================
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>quik</name>
<version>1.0.0</version>
<description>An ultra-fast and reliable inverse kinematics ROS2 service for serial robots.</description>
<maintainer email="steffan.lloyd@icloud.com">Steffan Lloyd</maintainer>
<license>AGPL-3.0-only</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>std_msgs</depend>
<depend>geometry_msgs</depend>
<depend>Eigen3</depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
gitextract_fqme_rma/ ├── .git/ │ ├── HEAD │ ├── config │ ├── description │ ├── hooks/ │ │ ├── applypatch-msg.sample │ │ ├── commit-msg.sample │ │ ├── fsmonitor-watchman.sample │ │ ├── post-update.sample │ │ ├── pre-applypatch.sample │ │ ├── pre-commit.sample │ │ ├── pre-merge-commit.sample │ │ ├── pre-push.sample │ │ ├── pre-rebase.sample │ │ ├── pre-receive.sample │ │ ├── prepare-commit-msg.sample │ │ ├── push-to-checkout.sample │ │ ├── sendemail-validate.sample │ │ └── update.sample │ ├── index │ ├── info/ │ │ └── exclude │ ├── logs/ │ │ ├── HEAD │ │ └── refs/ │ │ ├── heads/ │ │ │ └── main │ │ └── remotes/ │ │ └── origin/ │ │ └── HEAD │ ├── objects/ │ │ └── pack/ │ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.idx │ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.pack │ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.promisor │ │ ├── pack-4053744f65cc88ed0e06b753c1e70251da189553.rev │ │ ├── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.idx │ │ ├── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.pack │ │ ├── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.promisor │ │ └── pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.rev │ ├── packed-refs │ ├── refs/ │ │ ├── heads/ │ │ │ └── main │ │ └── remotes/ │ │ └── origin/ │ │ └── HEAD │ └── shallow ├── .gitignore ├── CMakeLists.txt ├── ReadMe.md └── package.xml
Condensed preview — 38 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (58K chars).
[
{
"path": ".git/HEAD",
"chars": 21,
"preview": "ref: refs/heads/main\n"
},
{
"path": ".git/config",
"chars": 341,
"preview": "[core]\n\trepositoryformatversion = 1\n\tfilemode = true\n\tbare = false\n\tlogallrefupdates = true\n[remote \"origin\"]\n\turl = htt"
},
{
"path": ".git/description",
"chars": 73,
"preview": "Unnamed repository; edit this file 'description' to name the repository.\n"
},
{
"path": ".git/hooks/applypatch-msg.sample",
"chars": 478,
"preview": "#!/bin/sh\n#\n# An example hook script to check the commit log message taken by\n# applypatch from an e-mail message.\n#\n# T"
},
{
"path": ".git/hooks/commit-msg.sample",
"chars": 896,
"preview": "#!/bin/sh\n#\n# An example hook script to check the commit log message.\n# Called by \"git commit\" with one argument, the na"
},
{
"path": ".git/hooks/fsmonitor-watchman.sample",
"chars": 4726,
"preview": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\nuse IPC::Open2;\n\n# An example hook script to integrate Watchman\n# (https://fa"
},
{
"path": ".git/hooks/post-update.sample",
"chars": 189,
"preview": "#!/bin/sh\n#\n# An example hook script to prepare a packed repository for use over\n# dumb transports.\n#\n# To enable this h"
},
{
"path": ".git/hooks/pre-applypatch.sample",
"chars": 424,
"preview": "#!/bin/sh\n#\n# An example hook script to verify what is about to be committed\n# by applypatch from an e-mail message.\n#\n#"
},
{
"path": ".git/hooks/pre-commit.sample",
"chars": 1649,
"preview": "#!/bin/sh\n#\n# An example hook script to verify what is about to be committed.\n# Called by \"git commit\" with no arguments"
},
{
"path": ".git/hooks/pre-merge-commit.sample",
"chars": 416,
"preview": "#!/bin/sh\n#\n# An example hook script to verify what is about to be committed.\n# Called by \"git merge\" with no arguments."
},
{
"path": ".git/hooks/pre-push.sample",
"chars": 1374,
"preview": "#!/bin/sh\n\n# An example hook script to verify what is about to be pushed. Called by \"git\n# push\" after it has checked t"
},
{
"path": ".git/hooks/pre-rebase.sample",
"chars": 4898,
"preview": "#!/bin/sh\n#\n# Copyright (c) 2006, 2008 Junio C Hamano\n#\n# The \"pre-rebase\" hook is run just before \"git rebase\" starts d"
},
{
"path": ".git/hooks/pre-receive.sample",
"chars": 544,
"preview": "#!/bin/sh\n#\n# An example hook script to make use of push options.\n# The example simply echoes all push options that star"
},
{
"path": ".git/hooks/prepare-commit-msg.sample",
"chars": 1492,
"preview": "#!/bin/sh\n#\n# An example hook script to prepare the commit log message.\n# Called by \"git commit\" with the name of the fi"
},
{
"path": ".git/hooks/push-to-checkout.sample",
"chars": 2783,
"preview": "#!/bin/sh\n\n# An example hook script to update a checked-out tree on a git push.\n#\n# This hook is invoked by git-receive-"
},
{
"path": ".git/hooks/sendemail-validate.sample",
"chars": 2308,
"preview": "#!/bin/sh\n\n# An example hook script to validate a patch (and/or patch series) before\n# sending it via email.\n#\n# The hoo"
},
{
"path": ".git/hooks/update.sample",
"chars": 3650,
"preview": "#!/bin/sh\n#\n# An example hook script to block unannotated tags from entering.\n# Called by \"git receive-pack\" with argume"
},
{
"path": ".git/info/exclude",
"chars": 240,
"preview": "# git ls-files --others --exclude-from=.git/info/exclude\n# Lines that start with '#' are comments.\n# For a project mostl"
},
{
"path": ".git/logs/HEAD",
"chars": 186,
"preview": "0000000000000000000000000000000000000000 a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc appuser <appuser@7c99e0e64a07.(none)> "
},
{
"path": ".git/logs/refs/heads/main",
"chars": 186,
"preview": "0000000000000000000000000000000000000000 a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc appuser <appuser@7c99e0e64a07.(none)> "
},
{
"path": ".git/logs/refs/remotes/origin/HEAD",
"chars": 186,
"preview": "0000000000000000000000000000000000000000 a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc appuser <appuser@7c99e0e64a07.(none)> "
},
{
"path": ".git/objects/pack/pack-4053744f65cc88ed0e06b753c1e70251da189553.promisor",
"chars": 57,
"preview": "a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc refs/heads/main\n"
},
{
"path": ".git/objects/pack/pack-e6a3f6d55016b489f57c6cf6a74e750109c0fabb.promisor",
"chars": 0,
"preview": ""
},
{
"path": ".git/packed-refs",
"chars": 112,
"preview": "# pack-refs with: peeled fully-peeled sorted \na9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc refs/remotes/origin/main\n"
},
{
"path": ".git/refs/heads/main",
"chars": 41,
"preview": "a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc\n"
},
{
"path": ".git/refs/remotes/origin/HEAD",
"chars": 30,
"preview": "ref: refs/remotes/origin/main\n"
},
{
"path": ".git/shallow",
"chars": 41,
"preview": "a9ebd1f21dfd3c9f0869140dfb0a4ae5a538cccc\n"
},
{
"path": ".gitignore",
"chars": 756,
"preview": "# Ignore all\n*\n\n# Unignore all with extensions\n!*.*\n\n# Unignore all dirs\n!*/\n\n# Don't track content of these folders\n**/"
},
{
"path": "CMakeLists.txt",
"chars": 2602,
"preview": "cmake_minimum_required(VERSION 3.8)\nproject(quik)\n\nif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES \"Clang\")"
},
{
"path": "ReadMe.md",
"chars": 22526,
"preview": "# QuIK: An ultra-fast and highly robust kinematics library for C++ or ROS2 using DH parameters\n\nQuIK is a hyper-efficien"
},
{
"path": "package.xml",
"chars": 942,
"preview": "<?xml version=\"1.0\"?>\n<?xml-model href=\"http://download.ros.org/schema/package_format3.xsd\" schematypens=\"http://www.w3."
}
]
// ... and 7 more files (download for full content)
About this extraction
This page contains the full source code of the steffanlloyd/quik GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 38 files (52.9 KB), approximately 15.9k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.