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

Features/soa #37

Merged
merged 312 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
312 commits
Select commit Hold shift + click to select a range
5ce129c
add test_data
kalebphipps Mar 14, 2024
0414d8c
rewrite rigid body module
MarleneBusch Mar 14, 2024
fb84c06
add test_data
kalebphipps Mar 14, 2024
481d6a7
remove old rotation functions
kalebphipps Mar 14, 2024
df3b3ef
add rotate_nu
kalebphipps Mar 15, 2024
e4eb799
clean up kinematic, kinematic test works
MarleneBusch Mar 15, 2024
1d22139
include offset in scenario
kalebphipps Mar 15, 2024
1cba5ae
fix sin convention
kalebphipps Mar 15, 2024
a6c5b6d
debugging - still not working
kalebphipps Mar 15, 2024
b937db5
more debugging, still not working
kalebphipps Mar 15, 2024
c422b5a
new rotation matrix for sun, still not working
kalebphipps Mar 18, 2024
5eb6834
update h5 offset and test rotation sign
kalebphipps Mar 18, 2024
91275a6
fix 4d representation - it almost works!
kalebphipps Mar 18, 2024
9abc3f1
fix 4d representation - it almost works!
kalebphipps Mar 18, 2024
2835eb0
norm
MarleneBusch Mar 18, 2024
72e2df6
Merge branch 'features/soa' of https://github.com/ARTIST-Association/…
MarleneBusch Mar 18, 2024
2eceb5b
debugging - still not working
kalebphipps Mar 18, 2024
7bdec32
debugging - still not working
kalebphipps Mar 18, 2024
975fdf2
Merge branch 'features/soa' of https://github.com/ARTIST-Association/…
MarleneBusch Mar 18, 2024
81571c8
alignemnt not working
MarleneBusch Mar 18, 2024
992c798
more debugging
kalebphipps Mar 18, 2024
0e1e4ad
change offset
kalebphipps Mar 19, 2024
d667663
update alignment
kalebphipps Mar 19, 2024
2e89043
refactor
kalebphipps Mar 19, 2024
5450a21
clean up and fix
kalebphipps Mar 19, 2024
35042fc
clean up code
kalebphipps Mar 19, 2024
e23e6dc
clean up the code
MarleneBusch Mar 20, 2024
c08cbed
change Docstrings
MarleneBusch Mar 20, 2024
482dea1
add inits, docstrings, type hints
MarleneBusch Mar 20, 2024
845b2cb
delete comment
MarleneBusch Mar 20, 2024
7b825d7
change test tolerances
kalebphipps Mar 20, 2024
c098483
Merge remote-tracking branch 'origin/features/soa' into features/soa
kalebphipps Mar 20, 2024
eedf8ab
restructure environment package
kalebphipps Mar 20, 2024
4da33b4
make everything better
MarleneBusch Feb 15, 2024
183a8d2
with errors and small improvements
MarleneBusch Feb 16, 2024
979f1a8
restructure the code
MarleneBusch Feb 16, 2024
d944a4e
restructuring the code
MarleneBusch Feb 19, 2024
bf3c684
restructuring the code
MarleneBusch Feb 23, 2024
46ca9f4
refactor structure to create separate test folder
kalebphipps Feb 28, 2024
239bd95
refactor structure to create separate test folder
kalebphipps Feb 28, 2024
0fdffc4
rename concentrator defaults
kalebphipps Feb 28, 2024
3d71542
add first version of scenario generator
kalebphipps Feb 28, 2024
e42e2b3
updates
MarleneBusch Mar 4, 2024
dd7d6b1
updates
MarleneBusch Mar 4, 2024
ffebd3e
start scenario for tests
kalebphipps Feb 28, 2024
96c5dc0
include (hopefully) all default configs for tests
kalebphipps Feb 29, 2024
d08e388
add test scenario
kalebphipps Feb 29, 2024
2a6d232
update heliostat config
kalebphipps Feb 29, 2024
90220d1
update test scenario
kalebphipps Feb 29, 2024
8835dc6
update scenario with parameters from binp
kalebphipps Mar 1, 2024
4d4f158
remove disturbance rotation angles
kalebphipps Mar 1, 2024
fcbd33b
update configs
kalebphipps Mar 4, 2024
b9f2da4
include new scenario file
kalebphipps Mar 4, 2024
4440fd0
fix typo
kalebphipps Mar 4, 2024
1a57e91
update configs
kalebphipps Mar 4, 2024
cad0441
include h5 config in sun init
kalebphipps Mar 4, 2024
80412b0
update configs to include facet type
kalebphipps Mar 4, 2024
8bece5b
start refactoring to read from h5
kalebphipps Mar 4, 2024
49748a1
delete print
kalebphipps Mar 5, 2024
84dbdeb
update scenario with alignment type parameter
kalebphipps Mar 5, 2024
bdb7036
include h5 loading up until alignment model
kalebphipps Mar 5, 2024
06d27e2
further refactoring
kalebphipps Mar 5, 2024
50ab9f9
include actuator type in configs
kalebphipps Mar 5, 2024
6f7e33a
continue refactoring
kalebphipps Mar 5, 2024
76581b3
refactor, not yet working
MarleneBusch Mar 6, 2024
241aab0
refactor
MarleneBusch Mar 6, 2024
b65d3be
some debugging - not working yet
kalebphipps Mar 6, 2024
8ba5781
cheat fix so test runs through
kalebphipps Mar 6, 2024
3155388
refactor, nothing works yet
MarleneBusch Mar 6, 2024
9ad7c39
refactor, nothing works yet
MarleneBusch Mar 6, 2024
128e9ce
include config dictionary
kalebphipps Mar 6, 2024
80288bf
add type mapping dict to initialise appropriate type easier
kalebphipps Mar 6, 2024
c9a8252
build scenario with config dict and convert to 4D
kalebphipps Mar 6, 2024
ec19bd9
change to config dict
MarleneBusch Mar 7, 2024
173b9c3
change to new instantiation of classes
MarleneBusch Mar 7, 2024
498a65c
update scenario
kalebphipps Mar 7, 2024
f89adae
change instantiation of classes
MarleneBusch Mar 7, 2024
ed71f27
refactor how classes are loaded - still not working
kalebphipps Mar 7, 2024
0018146
simplify scenario structure
kalebphipps Mar 7, 2024
da4cdef
add rigid_body_test as alternative to kinematic_test
MarleneBusch Mar 7, 2024
814377a
rewrite light source test to make it SOA compatible
MarleneBusch Mar 7, 2024
881f831
fix rigid body orientation matrix
MarleneBusch Mar 8, 2024
14940fe
fix soa, which might have been unnecessary
MarleneBusch Mar 8, 2024
b3dedef
update scenario to aos format
kalebphipps Mar 11, 2024
683e899
change back to AOS
MarleneBusch Mar 11, 2024
b15541b
introduce a new function to make kinematic simpler
MarleneBusch Mar 12, 2024
e584917
attempt simpler orientation matrix calculation
kalebphipps Mar 12, 2024
3da7369
reduced expected to 3x3 Matrix for trial purposes
kalebphipps Mar 12, 2024
36c9d6f
update rotation matrix
kalebphipps Mar 12, 2024
787b9c7
random stuff (maybe bad)
kalebphipps Mar 12, 2024
ac6cc68
working, but it makes no sense
kalebphipps Mar 12, 2024
0ebcf49
random not working stuff
MarleneBusch Mar 13, 2024
7ad70c4
alignment we can't use but works
kalebphipps Mar 13, 2024
e91a8fb
start reworking rigid_body
kalebphipps Mar 14, 2024
74f7c41
add test_data
kalebphipps Mar 14, 2024
d45f7f4
rewrite rigid body module
MarleneBusch Mar 14, 2024
2931ce7
add test_data
kalebphipps Mar 14, 2024
0c465cb
remove old rotation functions
kalebphipps Mar 14, 2024
09f7976
add rotate_nu
kalebphipps Mar 15, 2024
796a310
clean up kinematic, kinematic test works
MarleneBusch Mar 15, 2024
1cbbed8
include offset in scenario
kalebphipps Mar 15, 2024
7b193ae
fix sin convention
kalebphipps Mar 15, 2024
bd5fea3
debugging - still not working
kalebphipps Mar 15, 2024
8ec2f35
more debugging, still not working
kalebphipps Mar 15, 2024
bb71be0
new rotation matrix for sun, still not working
kalebphipps Mar 18, 2024
2a01520
update h5 offset and test rotation sign
kalebphipps Mar 18, 2024
33a14a4
fix 4d representation - it almost works!
kalebphipps Mar 18, 2024
d19a14c
norm
MarleneBusch Mar 18, 2024
59436d4
fix 4d representation - it almost works!
kalebphipps Mar 18, 2024
82f9b28
debugging - still not working
kalebphipps Mar 18, 2024
15b9c06
debugging - still not working
kalebphipps Mar 18, 2024
31b2f19
alignemnt not working
MarleneBusch Mar 18, 2024
f997ad1
more debugging
kalebphipps Mar 18, 2024
10d7fb2
change offset
kalebphipps Mar 19, 2024
a01984a
update alignment
kalebphipps Mar 19, 2024
ca6c494
refactor
kalebphipps Mar 19, 2024
05b0938
clean up and fix
kalebphipps Mar 19, 2024
0229a04
clean up code
kalebphipps Mar 19, 2024
ac2edb1
clean up the code
MarleneBusch Mar 20, 2024
256560d
change Docstrings
MarleneBusch Mar 20, 2024
952db16
add inits, docstrings, type hints
MarleneBusch Mar 20, 2024
73f7c4f
change test tolerances
kalebphipps Mar 20, 2024
ed96b8c
delete comment
MarleneBusch Mar 20, 2024
ae9aa58
restructure environment package
kalebphipps Mar 20, 2024
fd445e0
add init
kalebphipps Mar 20, 2024
4047ec9
change test structure
kalebphipps Mar 20, 2024
00aa305
change test structure
kalebphipps Mar 20, 2024
64a515e
remove old lightsource folder
MarleneBusch Mar 20, 2024
620187d
fix pre-commit hooks
kalebphipps Mar 20, 2024
b6345f5
add init for tests
kalebphipps Mar 20, 2024
53d9eb6
include h5py as dependency
kalebphipps Mar 20, 2024
68e9a39
add empty init to test folder
MarleneBusch Mar 21, 2024
a14d61b
edit init file
MarleneBusch Mar 21, 2024
ccd4f9c
edit init file
MarleneBusch Mar 21, 2024
b6c8ffa
edit init file
MarleneBusch Mar 21, 2024
29ff2a1
edit init and toml
MarleneBusch Mar 21, 2024
bbdb00b
edit init
MarleneBusch Mar 21, 2024
e1bb32d
add more inits
MarleneBusch Mar 21, 2024
e3a769e
edit init of light source
MarleneBusch Mar 21, 2024
320c365
edit init of light source
MarleneBusch Mar 21, 2024
33db49d
move tests
kalebphipps Mar 21, 2024
721e56b
fix init files
kalebphipps Mar 21, 2024
1b8ab78
fix init files
kalebphipps Mar 21, 2024
383e8bc
new package structure
kalebphipps Mar 21, 2024
27e0128
change name to scene
kalebphipps Mar 21, 2024
3eb2fef
fix init
kalebphipps Mar 21, 2024
3af3657
use assert
kalebphipps Mar 21, 2024
385f6ec
remove extra imports
kalebphipps Mar 21, 2024
60a22c0
remove circular imports
kalebphipps Mar 21, 2024
38b5439
fix init
kalebphipps Mar 21, 2024
3914291
remove circular imports
kalebphipps Mar 21, 2024
aa0e0b7
remove circular imports
kalebphipps Mar 21, 2024
206513d
remove circular imports
kalebphipps Mar 21, 2024
008e3a0
shorten imports
kalebphipps Mar 21, 2024
db69030
remove artist in initial __init__.py
kalebphipps Mar 21, 2024
3a971ee
break things
kalebphipps Mar 21, 2024
66fd122
fix import in __init__.py
kalebphipps Mar 21, 2024
74cdc0e
remove import order
kalebphipps Mar 21, 2024
32633cc
remove pytest options from pyproject
kalebphipps Mar 21, 2024
af44b73
move rigid body test
kalebphipps Mar 21, 2024
bf0aef6
add test path
kalebphipps Mar 21, 2024
9b1359c
reduce number of rays
kalebphipps Mar 21, 2024
7999594
reduce number of rays
kalebphipps Mar 21, 2024
5f45835
change bitmaps for less rays
MarleneBusch Mar 21, 2024
73eaca9
change toml
MarleneBusch Mar 21, 2024
d3dca90
Updated coverage.svg
github-actions[bot] Mar 21, 2024
6b9a9f0
change toml and create pytest.ini
MarleneBusch Mar 21, 2024
b32d1d4
Merge branch 'features/soa' of https://github.com/ARTIST-Association/…
MarleneBusch Mar 21, 2024
a4bca3f
fix pytest
MarleneBusch Mar 21, 2024
bbb6c4d
fix pytest
MarleneBusch Mar 21, 2024
fa136fc
test for python 3.12
kalebphipps Mar 21, 2024
7a16b8d
include all python versions
kalebphipps Mar 21, 2024
f6838d1
update test tolerance
kalebphipps Mar 21, 2024
126a37d
include type mapping dict
kalebphipps Mar 21, 2024
0dd04cb
restore test structure
kalebphipps Mar 21, 2024
80a5c76
update readme
kalebphipps Mar 21, 2024
17e8569
Update README.md
kalebphipps Mar 21, 2024
1b77794
fix typo in Docstring
MarleneBusch Mar 22, 2024
27522c8
remove not used functions and include Docstrings
MarleneBusch Mar 22, 2024
b104fd8
Updated coverage.svg
github-actions[bot] Mar 22, 2024
6eda530
Delete artist/util/heliostat_configurations.py
mcw92 Mar 22, 2024
066f250
Update artist/physics_objects/actuator.py
MarleneBusch Mar 22, 2024
3040765
type hints
MarleneBusch Mar 22, 2024
f6d00fb
Docstrings
MarleneBusch Mar 22, 2024
6a66128
fix doctoring
kalebphipps Mar 22, 2024
f9c4f1d
Ffx type hint
kalebphipps Mar 22, 2024
955dee2
Docstrings
MarleneBusch Mar 22, 2024
24bb7ad
Docstrings
MarleneBusch Mar 22, 2024
1d9a6ae
Docstrings
MarleneBusch Mar 22, 2024
1d1ad6d
Docstrings
MarleneBusch Mar 22, 2024
baa4dad
Docstrings
MarleneBusch Mar 22, 2024
b6e25f5
Docstrings
MarleneBusch Mar 22, 2024
cbd9298
Docstrings
MarleneBusch Mar 22, 2024
dc44c9e
Docstrings
MarleneBusch Mar 22, 2024
d96dd12
Docstrings
MarleneBusch Mar 22, 2024
e9e991d
Docstrings
MarleneBusch Mar 22, 2024
aa5a65c
fix docstrings
kalebphipps Mar 22, 2024
4202651
fix type hints
kalebphipps Mar 22, 2024
5c50d3e
fix docstrings
kalebphipps Mar 22, 2024
0b77754
fix docstrings
kalebphipps Mar 22, 2024
eb34994
Docstrings
MarleneBusch Mar 22, 2024
2fe91af
Docstrings
MarleneBusch Mar 22, 2024
625c6e1
remove Todo
MarleneBusch Mar 22, 2024
4546f10
Docstrings
MarleneBusch Mar 22, 2024
ed0cdad
Update artist/physics_objects/kinematic_rigid_body.py
MarleneBusch Mar 22, 2024
bf74a1a
Docstrings
MarleneBusch Mar 22, 2024
37d1724
Docstrings
MarleneBusch Mar 22, 2024
047deab
remove Todo
MarleneBusch Mar 22, 2024
e0311c9
Docstrings
MarleneBusch Mar 22, 2024
74314de
Docstrings
MarleneBusch Mar 22, 2024
3d345bd
Docstrings
MarleneBusch Mar 22, 2024
89c3718
fix typo
MarleneBusch Mar 22, 2024
e56a98b
Docstrings
MarleneBusch Mar 22, 2024
c261fc0
fix typo
MarleneBusch Mar 22, 2024
3789b85
fix typo
MarleneBusch Mar 22, 2024
1fe8d1b
Docstrings
MarleneBusch Mar 22, 2024
3fb2477
fix typo
MarleneBusch Mar 22, 2024
2ad234e
fix typo
MarleneBusch Mar 22, 2024
e807732
fix typo
MarleneBusch Mar 22, 2024
a385a3c
Update artist/util/scenario_generator.py
MarleneBusch Mar 22, 2024
6db797e
Docstrings
MarleneBusch Mar 22, 2024
b59b953
Docstrings
MarleneBusch Mar 22, 2024
7310bb5
Docstrings
MarleneBusch Mar 22, 2024
9cb5809
fix typo
MarleneBusch Mar 22, 2024
561e5d2
Docstrings
MarleneBusch Mar 22, 2024
e5d2721
Update artist/util/scenario_generator.py
MarleneBusch Mar 22, 2024
656930b
Docstrings
MarleneBusch Mar 22, 2024
8f4f826
type hints
MarleneBusch Mar 22, 2024
99fdae1
Docstrings
MarleneBusch Mar 22, 2024
e9e7db5
type hints
MarleneBusch Mar 22, 2024
1694796
Docstrings
MarleneBusch Mar 22, 2024
4b01f4b
Docstrings
MarleneBusch Mar 22, 2024
e4284ae
type hints
MarleneBusch Mar 22, 2024
fc7569f
Docstrings
MarleneBusch Mar 22, 2024
2f3c3eb
type hints
MarleneBusch Mar 22, 2024
65478cb
Docstrings
MarleneBusch Mar 22, 2024
b7c7cf7
type hints
MarleneBusch Mar 22, 2024
8326af9
fix typo
MarleneBusch Mar 22, 2024
f57632b
Docstrings
MarleneBusch Mar 22, 2024
0276933
Docstrings
MarleneBusch Mar 22, 2024
6e4d10f
include comment for private method
kalebphipps Mar 22, 2024
85f2142
remove abstract clase AModule
kalebphipps Mar 22, 2024
9588682
Fix typo in docstring
mcw92 Mar 22, 2024
df08e7d
remove AModule reference
MarleneBusch Mar 22, 2024
2affbc7
remove AModule reference
MarleneBusch Mar 22, 2024
cc46ce8
remove AModule reference
MarleneBusch Mar 22, 2024
0467646
Docstrings
MarleneBusch Mar 22, 2024
f020cba
Docstrings
MarleneBusch Mar 22, 2024
588e0a1
remove AModule reference
MarleneBusch Mar 22, 2024
1c9c5be
update docstrings
kalebphipps Mar 22, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Tests with pytest and no badge
if: matrix.python-version == '3.12'
run: |
pytest artist
pytest --cov=artist

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v19
Expand Down
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[![](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![](./coverage.svg)
[![](https://img.shields.io/badge/Contact-max.pargmann%40dlr.de-orange)](mailto:[email protected])
[![](https://img.shields.io/badge/Contact-artist%40lists.kit.edu-orange?label=Contact)]([email protected])


## What ARTIST can do for you

Expand Down Expand Up @@ -49,22 +50,16 @@ We heavily recommend to install the `ARTIST` package in a dedicated `Python3.8+`
## Structure
```
├──artist # Parent package
│ ├───io # IO functionality
│ │ └───tests # IO functionality tests
│ ├───physics_objects # Physical objects in raytracing environment, e.g., heliostats or receiver
│ │ └───heliostats
│ │ ├───alignment
│ │ │ └───tests
│ │ │ └───bitmaps
│ │ └───surface
│ │ └───facets
│ ├───raytracing
│ ├───scenario
│ │ └───light_source
│ │ └───tests
│ ├───scene # Light sources and factors influencing the surroundings
│ └───util
└───scenario_objects # Loaded from experiment yaml file to, e.g., define whether the sun or a beamer should be loaded
└───heliostats
└───measurement_data # Real measurements from a solar thermal power plant that can be used to create a scenario
└───scenarios # Scenarios describing solar thermal power plants which can be loaded
└───tests
├───physics_objects # Tests for objects in the physics_objects package
├───raytracing # Tests for objects in the raytracing package
└───scene # Tests for objects in the scene package
```
## How to use ARTIST
We plan to provide an official *ReadTheDocs* documentation including exemplary usage scripts.
Expand Down
11 changes: 10 additions & 1 deletion artist/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# -*- coding: utf-8 -*-
"""This package bundles ARTIST."""

import os

ARTIST_ROOT = f"{os.sep}".join(__file__.split(os.sep)[:-2])

__all__ = [
"physics_objects",
"raytracing",
"scene",
"util",
"ARTIST_ROOT",
]
8 changes: 0 additions & 8 deletions artist/io/__init__.py

This file was deleted.

57 changes: 0 additions & 57 deletions artist/io/datapoint.py

This file was deleted.

23 changes: 19 additions & 4 deletions artist/physics_objects/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
"""This package bundles all classes that represent physical objects in ARTIST."""
from artist.physics_objects.module import AModule
from artist.physics_objects.parameter import AParameter

from .actuator import AActuatorModule
from .actuator_ideal import IdealActuator
from .alignment import AlignmentModule
from .concentrator import ConcentratorModule
from .facets import AFacetModule
from .facets_point_cloud import PointCloudFacetModule
from .heliostat import HeliostatModule
from .kinematic import AKinematicModule
from .kinematic_rigid_body import RigidBodyModule

__all__ = [
"AModule",
"AParameter",
"AActuatorModule",
"IdealActuator",
"AlignmentModule",
"ConcentratorModule",
"AFacetModule",
"PointCloudFacetModule",
"HeliostatModule",
"AKinematicModule",
"RigidBodyModule",
]
39 changes: 39 additions & 0 deletions artist/physics_objects/actuator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import torch


class AActuatorModule(torch.nn.Module):
"""
This class implements the abstract behavior of an actuator.

Attributes
----------
joint_number : int
Descriptor (number) of the joint.
clockwise : bool
Turning direction of the joint.

Methods
-------
forward()
The forward kinematic.
"""

def __init__(
self,
joint_number: int,
clockwise: bool,
) -> None:
super().__init__()
self.joint_number = joint_number
self.clockwise = clockwise

def forward(self) -> torch.Tensor:
"""
Perform forward kinematic.

Raises
------
NotImplementedError
This abstract method must be overridden.
"""
raise NotImplementedError("Must Be Overridden!")
MarleneBusch marked this conversation as resolved.
Show resolved Hide resolved
72 changes: 72 additions & 0 deletions artist/physics_objects/actuator_ideal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import torch

from artist.physics_objects.actuator import (
AActuatorModule,
)


class IdealActuator(AActuatorModule):
"""
This class implements the behavior of an ideal actuator.

Methods
-------
motor_steps_to_angles()
Calculate the angles given motor steps.
angles_to_motor_steps()
Calculate the motor steps given the angles.
forward()
Perform the forward kinematic.

See Also
--------
:class:`AActuatorModule` : The parent class.
"""

def motor_steps_to_angles(self, motor_steps: torch.Tensor) -> torch.Tensor:
"""
Translate motor steps to a joint angle.

Parameters
----------
motor_steps : torch.Tensor
The motor steps.

Returns
-------
torch.Tensor
The joint angle.
"""
return motor_steps

def angles_to_motor_steps(self, angles: torch.Tensor) -> torch.Tensor:
"""
Translate a joint angle to motor steps.

Parameters
----------
angles : torch.Tensor
The joint angles.

Returns
-------
torch.Tensor
The motor steps.
"""
return angles

def forward(self, actuator_pos: torch.Tensor) -> torch.Tensor:
"""
Perform the forward kinematic for an ideal actuator.

Parameters
----------
actuator_pos : torch.Tensor
The position of the actuator.

Returns
-------
torch.Tensor
The required angles.
"""
return actuator_pos
89 changes: 89 additions & 0 deletions artist/physics_objects/alignment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
"""Alignment module for the heliostat."""

from typing import Any, Dict, Tuple

import torch


class AlignmentModule(torch.nn.Module):
"""
This class implements the alignment module for the heliostat.

Attributes
----------
kinematic_model : Union[RigidBodyModule, ...]
The kinematic model used.

Methods
-------
align_surface()
Align given surface points and surface normals according to a calculated orientation.
"""

def __init__(
self,
alignment_type: Any,
actuator_type: Any,
position: torch.Tensor,
aim_point: torch.Tensor,
kinematic_deviation_parameters: Dict[str, torch.Tensor],
kinematic_initial_orientation_offset: float,
) -> None:
"""
Initialize the alignment module.

Parameters
----------
alignment_type : Any
The method by which the heliostat is aligned, currently only rigid-body is possible.
actuator_type : Any
The type of the actuators of the heliostat.
position : torch.Tensor
Position of the heliostat for which the alignment model is created.
aim_point : torch.Tensor
The aimpoint.
kinematic_deviation_parameters : Dict[str, torch.Tensor]
The 18 deviation parameters of the kinematic module.
kinematic_initial_orientation_offset : float
The initial orientation-rotation angle of the heliostat.
"""
super().__init__()

self.kinematic_model = alignment_type(
actuator_type=actuator_type,
position=position,
aim_point=aim_point,
deviation_parameters=kinematic_deviation_parameters,
initial_orientation_offset=kinematic_initial_orientation_offset,
)

def align_surface(
self,
incident_ray_direction: torch.Tensor,
surface_points: torch.Tensor,
surface_normals: torch.Tensor,
) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Align given surface points and surface normals according to a calculated orientation.

Parameters
----------
incident_ray_direction : torch.Tensor
The direction of the rays.
surface_points : torch.Tensor
Points on the surface of the heliostat that reflect the light.
surface_normals : torch.Tensor
Normals to the surface points.

Returns
-------
torch.Tensor
The aligned surface points.
torch.Tensor
The aligned surface normals.
"""
orientation = self.kinematic_model.align(incident_ray_direction).squeeze()
aligned_surface_points = (orientation @ surface_points.T).T
aligned_surface_normals = (orientation @ surface_normals.T).T

return (aligned_surface_points, aligned_surface_normals)
37 changes: 37 additions & 0 deletions artist/physics_objects/concentrator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from typing import Any

import torch


class ConcentratorModule(torch.nn.Module):
"""
Implementation of the concentrator module.

Attributes
----------
facets : List[AFacetModule]
The facets of the concentrator.
"""

def __init__(
self,
facets_type: Any,
surface_points: torch.Tensor,
surface_normals: torch.Tensor,
) -> None:
"""
Initialize the concentrator.

Parameters
----------
facets_type : Any
The facet type, for example point cloud.
surface_points : torch.Tensor
The surface points on the concentrator.
surface_normals : torch.Tensor
The corresponding normal vectors to the points.
"""
super().__init__()
self.facets = facets_type(
surface_points=surface_points, surface_normals=surface_normals
)
Loading