Closed simplelife2010 closed 1 year ago
Hello Bruno,
Thanks for your interest in Scenic! We plan to release at least a beta version of Scenic 3 next month.
I wouldn't recommend using any of the development branches yet since they are still unstable; I'd suggest waiting until we have merged them into the 3.x
branch. In the mean time, you may be able to start experimenting even with Scenic 2: several of the simulator interfaces support an elevation
property allowing you to manually specify the Z coordinate of an object. If you're looking at interfacing your own simulator to Scenic, that process (described in the documentation) will only be slightly different in Scenic 3, so you could start with Scenic 2 as well.
Best, Daniel
Thanks, that's good news. I'll try to work with an elevation property. I tried to create a "tracks" region containing a rail network out of a lot of linestrings representing the center line of each track. It would be nice if I could get Scenic to provide arbitrary positions on the rail network by specifying "position: Point on track". This works fine in 2d, but the region does not provide the elevation. That's why I am interested in the new release.
Best, Bruno
That makes sense, and Scenic 3 will in fact behave exactly that way. As a workaround for the moment, if you're able to look up the Z coordinate for the track at a given XY position, you should be able to do something like this:
class RailObject:
position: Point on track
elevation: getTrackElevationAt(self.position)
Excellent!
I would like to implement your proposed workaround. I could write a function like this:
GetTrackElevationAt(point_2d) -> float
When I use this function in the RailObject class, it is called with this object: Point({'mutator': (<scenic.core.object_types.PositionMutator object at 0x7f42f4b75290>,), 'positionStdDev': 1, 'width': 0, 'visibleDistance': 50, 'position': <scenic.core.regions.PointInRegionDistribution object at 0x7f4338b15990>, 'height': 0, 'mutationEnabled': False}) <class 'scenic.core.object_types.Point'>
It seems the point object does not provide the concrete x,y coordinates, but a distribution instead. But to compute the elevation, I need the coordinates. I am not sure how to proceed here.
Any help appreciated Bruno
Perhaps I could use a vector field like this?
class RailObject: position: Point on track elevation: trackElevation at position
Instances of the Distribution
class are used internally by Scenic to represent random values; Scenic operators know how to deal with them, but you may get errors if you try to pass one to external Python code for example. You can either wrap your function with the scenic.core.distributions.distributionFunction
decorator (see docs here), or use a vector field as you suggest above (but note you need to write trackElevation at self.position
).
Thanks Daniel,
the vector field (though it is meant to be used to produce headings) works great, but I will also look into your first suggested solution.
Great! If you would like to discuss anything further it might be easier on our Scenic Slack -- if you'd like to join that please email me and I'll add you.
We are evaluating Scenic in a railway/transportation context. It seems we want to rely on 3d coordinates in our setup, which will be a feature of Scenic 3. Is there any estimate when this will be available on Pypi? Alternatively, does it make sense already now to use one of the development branches and if so, which one would be recommended?
Thanks a lot Bruno