Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Anatr1 committed Nov 24, 2023
1 parent 57c2af2 commit 6f8a935
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 68 deletions.
100 changes: 33 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,56 @@
# DIANA-TemplateCPP
# Panda-IK
<p align="center">
<img src="assets/logo.png">
<img src="assets/panda_ik.gif">
</p>

### v2.0.0
*Insert here a brief description of the project.* <br>
DIANA-TemplateCPP is the official C++/Cmake template for DIANA Software repositories. It is intended as a *starting point* for the development of new repositories. It uses advanced CMake functionalities to make the project compliant with the [DIANA Software standard](https://github.com/team-diana/CS-Docs/tree/master/DIANA%20Software/Conventions), to handlefiles, installation and tests. This template is meant to be used in CLion IDE.
Based upon [this work](https://github.com/ffall007/franka_analytical_ik), this shared library provides an easy-to-use interface for the analytical inverse kinematics solver for the Franka Emika Panda robot. The available functionalities are callable from both C++ and Python. A Python example is provided [here](python/example.py).

### Workflows
| | **Build and install** | **Makefile standard commands** |
|----------|----------|-------------------------|
| **Master** | ![MASTER: ccpp.yml](https://github.com/team-diana/DIANA-TemplateCPP/actions/workflows/ccpp.yml/badge.svg?badge.svg?branch=master) |![MASTER: make-standard-commands.yml](https://github.com/team-diana/DIANA-TemplateCPP/actions/workflows/make-standard-commands.yml/badge.svg?branch=master) |
| **Develop** |![DEVELOP: ccpp.yml](https://github.com/team-diana/DIANA-TemplateCPP/actions/workflows/ccpp.yml/badge.svg?branch=develop) | ![MASTER: make-standard-commands.yml](https://github.com/team-diana/DIANA-TemplateCPP/actions/workflows/make-standard-commands.yml/badge.svg?branch=develop) |
## Installation

## Description
Insert here some detailed description about your software. Here are some suggestions:
- **Library**: *How to include in Cmake? What are the main functions of the library? How do they work? Simple code examples*
- **Program**: *How does it work? How to use it ? Program arguments ? What are the Mqtt topics it uses? Are there any ShmemKeys? Does it have particular dependencies?*
- **Service**: How does it work? Is it possible to use it as standalone? Does it have dependencies? Are there arguments to pass in the standalone version?

*In general, think as you were the user, and not a developer: what are the info you will need to start using your modules as fast as possible?*
*Also, remember to provide links to documentation (Cs docs) and external information, if needed.*
## Make Targets
### Install Dependencies

#### Configure

```bash
```
git clone [email protected]:Anatr1/panda-IK.git
cd panda-IK
make configure
make build
make install
```
### Build project
#### Generate Makefiles/Cmake Project

```bash
make generate
```
#### Clean (deletes build folder)
## Usage

```bash
make clean
```
### C++

#### Build project - debug configuration
To obtain an array of doubles corresponding to the joint angles of the robot for a given end-effector pose, use the following function:

```bash
make build
```
```cpp
#include <panda_ik.hpp>

#### Build project - Release configuration
// ...

```bash
make release
```
### Install, uninstall, test and others
#### Install built project
std::array<double, 7> result = compute_inverse_kinematics(array<double, 6> xyzrpy, array<double, 7> q_actual);

```bash
make install
```
#### Uninstall built project
Cleans all the files installed by the project.
```bash
make uninstall
```
```xyzrpy``` is an array of doubles containing the desired end-effector pose in the format [x, y, z, roll, pitch, yaw]. ```q_actual``` is an array of doubles containing the current joint angles of the robot. ```result``` will contain the solution, if any, for the given input. If no solution is found, the function will return the current joint angles of the robot.

#### Run Tests
### Python

```bash
make test
```
To obtain an array of doubles corresponding to the joint angles of the robot for a given end-effector pose, use the following function:

#### Generate Doxygen documentation
```python
import ctypes

```bash
make docs
```
# Load the shared library
pandaik_lib = ctypes.CDLL('/usr/local/diana/lib/libPanda-IK.so')

### Other makefile targets
Set here, if needed, "custom" make targets for the project.
### Run ExampleProgram
# Define the argument types and return type
pandaik_lib.compute_inverse_kinematics_void.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double)]
pandaik_lib.compute_inverse_kinematics_void.restype = None

```bash
make run_ExampleProgram
```
### Run ExampleService (as a standalone)
xyzrpy = (ctypes.c_double * 6)(X, Y, Z, ROLL, PITCH, YAW)
q_actual = (ctypes.c_double * 7)(Q1, Q2, Q3, Q4, Q5, Q6, Q7)
output = (ctypes.c_double * 7)()

```bash
make run_ExampleService
# Call a function from the library
pandaik_lib.compute_inverse_kinematics_void(xyzrpy, q_actual, output)
```

```X, Y, Z, ROLL, PITCH, YAW``` are the desired end-effector pose. ```Q1, Q2, Q3, Q4, Q5, Q6, Q7``` are the current joint angles of the robot. ```output``` will contain the solution, if any, for the given input. If no solution is found, the function will return the current joint angles of the robot.
Binary file added assets/panda_ik.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
output = (ctypes.c_double * 7)()

# Call a function from the library
result = pandaik_lib.compute_inverse_kinematics_void(xyzrpy, q_actual, output)
pandaik_lib.compute_inverse_kinematics_void(xyzrpy, q_actual, output)
print("Result from C++:", list(output)) # Assuming the function returns an array of 7 doubles
# Should print: Result from C++: [0.8867046650124633, -1.3398493172549706, -0.7760786149655098, -2.652291962842672, 2.2357825028981364, 2.737863867200816, 0.0]

0 comments on commit 6f8a935

Please sign in to comment.