You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I am trying to simulate a Dodecarotor Cox multicopter. I started my mod from your hexacopter vehicle, and followed the numbering so that it matches the PX4 - QGC numbering found here (https://docs.px4.io/master/en/airframes/airframe_reference.html).
Generic Dodecarotor model.
*/
public class Dodecarotor extends AbstractMulticopter {
private static final int rotorsNum = 12;
private Vector3d[] rotorPositions = new Vector3d[rotorsNum];
// private int[] rotorRotations = new int[rotorsNum];
if (orientation.equals("x") || orientation.equals("X")) {
Matrix3d r = new Matrix3d();
r.rotZ(-Math.PI / 2);
for (int i = 0; i < rotorsNum; i++) {
r.transform(rotorPositions[i]);
}
} else {
throw new RuntimeException("Unknown orientation: " + orientation);
}
for (int i = 0; i < rotors.length; i++) {
rotorPositions[i].add(rotorsOffset);
Rotor rotor = rotors[i];
rotor.setFullThrust((i > 5) ? 0.9*rotorThrust : rotorThrust); //Lower propeller reduced efficiency
rotor.setFullTorque((i == 6 || i == 3 || i == 4 || i == 6 || i == 8 || i == 11) ? -rotorTorque : rotorTorque);
rotor.setTimeConstant(rotorTimeConst);
}
}
@OverRide
protected int getRotorsNum() {
return rotorsNum;
}
I am calling it from Simulator.java using these specific values :
private AbstractMulticopter buildMulticopter() {
Vector3d gc = new Vector3d(0.0, 0.0, 0.0); // gravity center
AbstractMulticopter vehicle = new Dodecarotor(world, DEFAULT_VEHICLE_MODEL, "x",
0.6096, 306.26, 19.07, 0.005, 0.114, gc, SHOW_GUI);
Matrix3d I = new Matrix3d();
// Moments of inertia
I.m00 = 39.0; // X
I.m11 = 39.0; // Y
I.m22 = 52.0; // Z
vehicle.setMomentOfInertia(I);
vehicle.setMass(100);
vehicle.setDragMove(2);
SimpleSensors sensors = new SimpleSensors();
sensors.setGPSInterval(50);
sensors.setGPSDelay(200);
sensors.setNoise_Acc(0.05f);
sensors.setNoise_Gyo(0.01f);
sensors.setNoise_Mag(0.005f);
sensors.setNoise_Prs(0.1f);
vehicle.setSensors(sensors, getSimMillis());
//v.setDragRotate(0.1);
return vehicle;
}
The build of the code is successful, however, my drone does not take off. I believe the error might lies in AbstractMulticopter.java . Can you help me? Or is there resources anywhere to help me build my own airframe configurations?
The text was updated successfully, but these errors were encountered:
Hi!
I am trying to simulate a Dodecarotor Cox multicopter. I started my mod from your hexacopter vehicle, and followed the numbering so that it matches the PX4 - QGC numbering found here (https://docs.px4.io/master/en/airframes/airframe_reference.html).
Dodecarotor.java:
package me.drton.jmavsim.vehicle;
import me.drton.jmavsim.Rotor;
import me.drton.jmavsim.World;
import javax.vecmath.Matrix3d;
import javax.vecmath.Vector3d;
/**
Generic Dodecarotor model.
*/
public class Dodecarotor extends AbstractMulticopter {
private static final int rotorsNum = 12;
private Vector3d[] rotorPositions = new Vector3d[rotorsNum];
// private int[] rotorRotations = new int[rotorsNum];
/**
Generic Dodecarotor constructor.
@param world world where to place the vehicle
@param modelName filename of model to load, in .obj format
@param orientation "x" or "+"
@param armLength length of arm from center (m)
@param rotorThrust full thrust of one rotor (N)
@param rotorTorque torque at full thrust of one rotor (Nm)
@param rotorTimeConst spin-up time of rotor
@param rotorHeight height of propeller from center point (m)
@param rotorsOffset rotors positions offset from gravity center
@param showGui false if the GUI has been disabled
*/
public Dodecarotor(World world, String modelName, String orientation, double armLength,
double rotorThrust, double rotorTorque, double rotorTimeConst, double rotorHeight,
Vector3d rotorsOffset, boolean showGui) {
super(world, modelName, showGui);
if (orientation.equals("x") || orientation.equals("X")) {
Matrix3d r = new Matrix3d();
r.rotZ(-Math.PI / 2);
for (int i = 0; i < rotorsNum; i++) {
r.transform(rotorPositions[i]);
}
} else {
throw new RuntimeException("Unknown orientation: " + orientation);
}
for (int i = 0; i < rotors.length; i++) {
rotorPositions[i].add(rotorsOffset);
Rotor rotor = rotors[i];
rotor.setFullThrust((i > 5) ? 0.9*rotorThrust : rotorThrust); //Lower propeller reduced efficiency
rotor.setFullTorque((i == 6 || i == 3 || i == 4 || i == 6 || i == 8 || i == 11) ? -rotorTorque : rotorTorque);
rotor.setTimeConstant(rotorTimeConst);
}
}
@OverRide
protected int getRotorsNum() {
return rotorsNum;
}
@OverRide
protected Vector3d getRotorPosition(int i) {
return rotorPositions[i];
}
}
I am calling it from Simulator.java using these specific values :
private AbstractMulticopter buildMulticopter() {
Vector3d gc = new Vector3d(0.0, 0.0, 0.0); // gravity center
The build of the code is successful, however, my drone does not take off. I believe the error might lies in AbstractMulticopter.java . Can you help me? Or is there resources anywhere to help me build my own airframe configurations?
The text was updated successfully, but these errors were encountered: