mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
AndroidGCS OSG: Clean up function API
This commit is contained in:
parent
4dbaa63931
commit
f8804574e8
@ -236,5 +236,10 @@ void OsgMainApp::setQuat(float *q){
|
||||
quat.makeRotate(angle, osg::Vec3d(axis[1],axis[0],-axis[2]));
|
||||
osg::Matrixd rot = osg::Matrixd::rotate(quat);
|
||||
|
||||
uavAttitudeAndScale->setMatrix(rot);
|
||||
if (uavAttitudeAndScale) {
|
||||
osg::notify(osg::ALWAYS)<<"Setting attitude"<<std::endl;
|
||||
uavAttitudeAndScale->setMatrix(rot);
|
||||
} else {
|
||||
osg::notify(osg::ALWAYS)<<"Pointer missing"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ extern "C" {
|
||||
JNIEXPORT void JNICALL Java_org_openpilot_osg_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address);
|
||||
JNIEXPORT void JNICALL Java_org_openpilot_osg_osgNativeLib_unLoadObject(JNIEnv * env, jobject obj, jint number);
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_openpilot_osg_osgNativeLib_getObjectNames(JNIEnv * env, jobject obj);
|
||||
JNIEXPORT void JNICALL Java_org_openpilot_osg_osgNativeLib_setRPY(JNIEnv * env, jobject obj, jfloat q1, jfloat q2, jfloat q3, jfloat q4);
|
||||
JNIEXPORT void JNICALL Java_org_openpilot_osg_osgNativeLib_setQuat(JNIEnv * env, jobject obj, jfloat q1, jfloat q2, jfloat q3, jfloat q4);
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_openpilot_osg_osgNativeLib_init(JNIEnv * env, jobject obj, jint width, jint height){
|
||||
@ -113,7 +113,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_openpilot_osg_osgNativeLib_getObjectName
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_openpilot_osg_osgNativeLib_setRPY(JNIEnv * env, jobject obj, jfloat q1, jfloat q2, jfloat q3, jfloat q4){
|
||||
JNIEXPORT void JNICALL Java_org_openpilot_osg_osgNativeLib_setQuat(JNIEnv * env, jobject obj, jfloat q1, jfloat q2, jfloat q3, jfloat q4){
|
||||
float q[4] = {q1, q2, q3, q4};
|
||||
mainApp.setQuat(q);
|
||||
}
|
||||
|
@ -358,7 +358,15 @@ public class OsgViewer extends ObjectManagerActivity implements View.OnTouchList
|
||||
|
||||
@Override
|
||||
protected void objectUpdated(UAVObject obj) {
|
||||
if (DEBUG) Log.d(TAG, "Object updated: " + obj.getName());
|
||||
float q[] = new float[4];
|
||||
|
||||
q[0] = (float) obj.getField("q1").getDouble();
|
||||
q[1] = (float) obj.getField("q2").getDouble();
|
||||
q[2] = (float) obj.getField("q3").getDouble();
|
||||
q[3] = (float) obj.getField("q4").getDouble();
|
||||
if (DEBUG) Log.d(TAG, "Attitude: " + q[0] + " " + q[1] + " " + q[2] + " " + q[3]);
|
||||
|
||||
osgNativeLib.setQuat(q[0], q[1], q[2], q[3]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,5 +24,6 @@ public class osgNativeLib {
|
||||
public static native void loadObject(String address,String name);
|
||||
public static native void unLoadObject(int number);
|
||||
public static native String[] getObjectNames();
|
||||
public static native void setQuat(float q1, float q2, float q3, float q4);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user