Comments (5)
I do agree that the parameters with their default parameters are messy, this is "historical" since the whole thing emerged from a single python script to simulate the velodyne.
Getting rid of this is definitely a worthy task, but you are right. one reason for not passing the obj itself is the fact that this code can be called from other python scripts that just use the active camera as the scanner.
Using some kind of inheritance for sensor parameters however seems to be very useful
Proposal
Create a Sensor class that combines the default parameters and has a constructor that takes a Camera object and copies the relevant data into the sensor object.
Derive all sensors and extend the parameters (change the default values) accordingly.
class Sensor(object):
max_distance = 120
def __init__(self, blender_object):
self.max_distance = blender_object.max_distance
class Velodyne(Sensor):
rotation_speed = 15
angle_resolution = 0.1728
...
...
def __init__(self, blender_object):
Sensor.__init__(self, blender_object)
self.rotation_speed = blender_object.rotation_speed
self.angle_resolution = blender_object.angle_resolution
...
...
...
sensor = Velodyne(obj)
scan_advanced(sensor,'test.evd', Matrix())
from blensor.
I think copying from obj
to sensor
is redundant because if you just want to use the active camera it will already have the default values set, thanks to the addProperties(cType)
call. Restricting default values to the one place (that addProperties
method) would be cleaner, and removes any potential issues with forgetting to copy from obj
to sensor
if we add a new property.
Using your proposal, if you wished to create a "sensor" without modifying the active camera, you could do:
sensor = Velodyne()
sensor.max_dist = 100
scan_advanced(sensor, ...)
But with mine the only difference would be
sensor = bpy.data.objects.new('temp', None)
sensor.max_dist = 100
scan_advanced(sensor, ...)
Perhaps I'll code it up and if you find any use cases that need the separate Sensor
classes, it'd be trivial to add in. The added advantage of my method is that the other properties already defined on sensor (such as object_matrix, etc.) are also accessible
from blensor.
Hmm there could theoretically be a scenario where the sensor objects store information that is not stored as blender properties.
For example:
The laser configurations should be stored in the sensor object since we could have more than one sensor of the same type. Some properties may be loaded from a file instead of exposing them in the blender menu.
If a sensor is it's own object it could have save/load methods to store the sensor configuration in a file.
Thinking further into the future i think the addProperties should be done by the Sensor object too. That way the default values would only be held in one place.
But we can go with your approach for now and check if the requirements i mentioned are really an issue or not
from blensor.
Well currently laser configurations are stored in each object, and that would remain the case. So different sensors could be represented by different cameras in the scene. If you wanted to be able to load parameters from a file into a blender object, it'd be easy to write an operator to do it.
As far as further into the future goes, I think it makes sense for the Sensor
object to be a subclass of bpy.types.object
(or just remain an object with extra properties like it is now). That way blender will save it for you automatically, and also allow cool things like keyframe animation of parameters.
I'll get started on the refactoring and see what issues I run into on the way :)
from blensor.
I know, storing the sensor properties in the blender file greatly simplifies the distribution of scans without having to send the whole scan result.
Well then it's decided. :)
from blensor.
Related Issues (20)
- Inconsistent range reading HOT 3
- TypeError in blensor.tof.scan_advanced HOT 1
- Is it possible to isolate blensor from blender? HOT 1
- Multi-core processing
- Blender 2.8 HOT 1
- TOF sensor has some limit distance HOT 1
- blensor scans API HOT 1
- File format
- Why HDL-64E2 lose some area when scanning HOT 3
- Blender 2.9
- Depth map image crashes
- On which specific version of ubuntu can this be built? HOT 1
- Scan Distance does not work? HOT 1
- How are the scan labels generated in output pcd file? HOT 1
- depthmap bug: The small sensor_size will cause depthmap results error
- Is there any solution to add laser scanner to Blender? Or adding camera to Blensor?
- PCD export example HOT 7
- Is it possible to add new models of LiDAR that this software does not have(for examples livox), has anyone tried it? HOT 2
- GPU acceleration + compatibility with latest version of blender HOT 2
- Question: Simulation over animated scenes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blensor.