You also need the velocity of the satellite, the position is not sufficient to bind LVLH frame to any other frame.
One you have both position and velocity, the way to do the computation is as follows:
create a provider corresponding to your PV coordinates in ECEF frame using pvProvider = new ConstantPVCoordinatesProvider(pvECEF, ecef)`
create attitude provider from inertial frame (for example EME2000) to spacecraft frame by applying the known angles using attProvider = new LofOffset(eme2000, LOFType.LVLH, RotationOrder.ZYX, yaw, pitch, roll), beware here you must use an inertial frame, you should not use ECEF otherwise velocity direction would be wrong
apply attitude provider to get the attitude directly in ECEF frame using attInECEF = attProvider.getAttitude(pvProvider, date, ecef). Note that internally, there will be two frames transforms used here, one to convert PV to inertial frame, and one to convert attitude back to ECEF, both are needed and important, you cannot simplify computation here
Another remark: using Vector3D to store 3 angular coordinates yaw, pitch, and roll is really not recommended. Vector3D represents Cartesian coordinates with a vector space algebra. You should rather create a dedicated container for your coordinates in order to avoid messing up.
thanks @luc, the solution is really helpful and practical!
our main concern is the velocity of the satellite
we want to assume the velocity is always 0 , but this seems lead to an error : cannot normalize a zero norm vector (a PV with a zero velocity will lead to this problem when running the tests)
(so our recent conclusion is to use a value which is close to 0, but not exactly 0, for example 0.0011, but no idea whether the result from this approach is acceptable in terms of accuracy.)
hi @luc, we do assume a simplest mode in which we treat it as a perfectly geostationary satellite and the velocity of that satellite is zero.
is it possible to deal with this case, and avoid this problem?
: cannot normalize a zero norm vector (a PV with a zero velocity will lead to this problem when running the tests)
Could you show the code you wrote for implementing this, or at least the full stack trace of the error (in the message above, we only see the last few elements concerning the low level methods in Hipparchus.
You should first build a complete position/velocity PVCoordinates instance from your ECEF position and zero vector velocity and then use the transformPVCoordinates method from the Transformclass to convert this into a PVCoordinates instance in inertial frame. Then you can apply the rotationFromInertial method.
The reason is that transforming position, transforming position/velocity and transforming vectors are three very different things. The one you need first is really transformPVCoordinates because it does apply frame velocity composition. This means that with your perfectly geostationary satellite, as it is 42000km away from Earth, then if it has a zero velocity with respect to Earth (it is geostationary), it will get a 3075m/s East/West velocity due to velocity composition from a rotating frame.