  Silverlan

Member

96

662 Good

• Rank
Member

• Role
Programmer
• Interests
Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. Thank you, although I'm not quite sure I understand. The intensity of my directional light source is defined in Lux. Or, to be more precise, the directional light source doesn't actually have an intensity, I'm just defining the illuminance of all surfaces being lit by the light source in Lumen per square-meter. That means I already have the illuminance, but I'm not sure what to do with it. For spot- and point-lights I define the intensity in Lumen, then convert that to Candela and multiply that with my light color. I'm not 100% sure that's correct, but the results seem to match what I'd expect it to look like. Now for directional light sources, I could convert the Lux to Candela as well: cn = lx /sr (cn = candela, lx = lux, sr = steradians) The sun is a sphere, so the solid angle should be 4πsr. That means for 100 Lux, I end up with cn = 100 /4π = 7.96 Candela. For 10,000 Lux, I get 795.77 Candela. I suppose that does sound like it may be correct, but I'm not sure. Am I on the right track, or am I completely off?
2. I would like to use Lux as the unit for light intensity values of the directional lights in my engine, but I'm not sure how that would actually work. Lux describes the light intensity for an area, but how would I translate that to the light intensity for a fragment? As far as I know, both Unity and Unreal use Lux as unit, and the glTF light source specification uses it as well, so it's obviously possible somehow? I can't find any references on this topic whatsoever. I assume I have to calculate the size of a fragment in world units? If so, how would one do that?
3. As I understand it, you're supposed to use Unreal's Online Subsystem when doing anything with the Steam SDK. However, when I look into the available interfaces (Engine/Plugins/Online/OnlineSubsystem/Source/Public/Interfaces), there doesn't seem to be a controller interface. Does Unreal not have that (yet)? If so, do I have to link against the steamworks libraries manually and use the SDK directly?
4. The torque force of the rotors, as well as the lift force applied to the drone, as shown in the code snippet. The P-term has to be that high, otherwise the rotors take too long to reach the required RPS. It gets increasingly unstable with higher values though.
5. Thanks, that helps quite a bit! Still having a bit of trouble, however. For testing, I disabled angular movement for the drone, as well as movement on the x- and z- axes (so it can only move up and down), and I've tried to implement #3 (keeping a specific altitude). However, no matter what I set the parameters of the PID to, I can't get it to change the rotor speed quickly enough, so it ends up overshooting the target massively: (The target altitude is 0, which is more or less central between the green block and the ground floor.) Here's the test-code I've used: local pidAltitude = math.PIDController(100,20,5) -- Parameters: proportional, integral, derivative function PhysDrone:Simulate(dt) local pos = self:GetPos() -- Current position local posTgt = Vector(0,0,0) -- Target position; x and z are ignored for now local v = pidAltitude:Calculate(pos.y,posTgt.y,dt) -- Parameters: processFeedback, setpoint, delta time for rotorId,entRotor in ipairs(self.m_rotors) do -- for each of the 4 rotors entRotor:ApplyTorque(Vector(0,v,0)) -- PID output is applied as a torque force to the rotor local up = entRotor:GetUp() -- Normalized vector pointing upwards from the rotor (Always the same direction as the up-vector of the drone) local liftForce = entRotor:GetLiftForce() -- How much lift force should be applied to the drone by this rotor (Depending on current revolutions per second) local posRotor = self:WorldToLocal(entRotor:GetPos()) -- Where the lift force originates from, relative to the drone self:ApplyForce(up *liftForce *dt,posRotor) end end I've tried following the tuning instructions for PIDs on wikipedia, but haven't had any luck, the result is always almost exactly what you see in the video. There are two different forces involved, which I suppose complicates things a little, but I'm not sure what to do here.
6. I'm trying to write a simple quadcopter simulation. It doesn't need to be 100% accurately simulated and I don't intend to write an actual drone controller, it's just supposed to "look" right in the simulation, and I'm trying to get a better understanding of PIDs. As such, I don't need to worry about sensors, or an accelerometer or gyroscope, I get all of the information from the simulation directly. I'm new to quadcopter physics and PIDs, so there are a few things I'm a bit unclear on. I'm not asking for concrete solutions, I'd just like to know if my ideas go in the right direction and/or if I'm missing anything. 1) Let's say the quadcopter has the world coordinates Q(0 -50 0) (y-axis being the up-axis) and I want it to fly to O(0 0 0). The velocity I need is O -Q, so I need to accelerate the drone until I reach that velocity (Correcting it every simulation tick). To do that, I need a PID, with the setpoint being the desired velocity O -Q, and the process variable being the current velocity of the drone (both on the y-axis), and 1/4th of the PID output is then applied as force to each rotor (Let's ignore the RPM of the rotors and assume I can just apply force directly). Is that correct? 2) The drone is at the world coordinates Q(0 0 0) and should fly to P(100 0 100). It also has the orientation (p(itch)=0, y(aw)=0 and r(oll)=0). I want the drone to fly to point P, without changing its yaw-orientation. How would I calculate the target pitch- and roll-angles I need? I can work with euler angles and quaternions (not sure if I need to worry about gimbal lock in this case), I just need to know what formulas I need. Of course I also want to make sure the drone doesn't overturn itself. 3) I want to change the drone's orientation from (p=0, y=0, r=0) to (p=20, y=0 r=0) (With positive pitch pointing downwards). To do so, I'd have to increase the force that is being applied by the front rotors, and/or decrease the force of the back rotors. I can use a PID to calculate the angular velocity I need for the drone (similar as in 1) ), but how do I get from there to the required forces on each rotor? 4) Am I correct in assuming that I need 6 PIDs in total, 3 for the angular axes and 3 for the linear axes?