SDK Question How do I increase or decrease the level of rcs

marcogavazzeni

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
216
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
Hi guys.
I have a question to submit, How do I increase or decrease the level of rcs? I tried with SetThrusterLevel but does not work as it should. :shrug:

Code:
for (int i = 0; i < 24; i++) SetThrusterLevel (th_rcs[i], lvl);

When the variable lvl is > 0, all rcs are activated.
 
Your code looks correct if you want to activate all thrusters.

1. Are you sure 'lvl' is defined a double, not as int?
2. You could try IncThrusterLevel.
3. You could group thrusters and use SetThrusterGroupLevel to activate specific groups (like pitch, bank, yaw, ...)

If you want to reduce the overall power of all thrusters, you have to re-define the thrusters with a lower thrust.
CreateThruster (_V( ...), _V(...), RCS_THRUST, ph, ISP);
 
This is the problem, the RCA activate all, when lvl is 0.0 all jets are turned off, when> 0.0 jets increased by the value assigned ranging from 0.0 to 1.0, but can also be 0.56 or 0.31.

I wanted to create a command like RCS Level, present in Orbiter Remote Vessel Control, and put it in the virtual cockpit of my ship.

DYtoRWW.jpg
 
Remember: If you set all thrusters to the same level, you have opposing thrusters firing. You need to set the thrusters of one thruster group to the same level and the opposing thruster group to 0 (if you are not doing this, you can still make for example left and right rotation thrusters fire at the same time)

If you want to make the RCS stronger in general, you need to increase the thrust force.
 
I wanted to create a command like RCS Level, present in Orbiter Remote Vessel Control, and put it in the virtual cockpit of my ship.

DYtoRWW.jpg

The value of this control is only used in connection with a press of the buttons above. If you press one of them, the code uses IncThrusterGroupLevel_SingleStep() (p. 425 in API documentation PDF) with that value as second argument.

AFAIK, Orbiter's direct thruster group control (using keyboard or joystick) always applies full/reduced (CTRL) or proportional joystick deflection thrust, overriding any programmatic setting. Thus the above method will not help you much.

You can simulate reduced thruster force by means of using SetThrusterMax0() on every thruster in the group(s). Initially store the values via GetThrusterMax() - and reference pressure zero as second argument - for every thruster you want to manipulate. Then, on every timestep whenever the RCS level variable changed, scale this initial value for every thruster with your RCS level with the setter function.
 
Ok, I did this and it works:
Code:
//RCS PITCHUP	
    th_rcs[0] = CreateThruster (_V( 0, 2, 3), _V(0, 1,0), MAX_RCS_THRUST, ph_rcs, ISP);
    th_rcs[1] = CreateThruster (_V( 0,-2,-3), _V(0,-1,0), MAX_RCS_THRUST, ph_rcs, ISP);    
    th_group[0] = th_rcs[0],th_rcsd[0];
    th_group[1] = th_rcs[1],th_rcsd[1];

	th_rcsd[0] = CreateThruster (_V( 0, 2, 3), _V(0, 1,0), MAX_RCS_THRUSTD, ph_rcs, ISP);
	th_rcsd[1] = CreateThruster (_V( 0,-2,-3), _V(0,-1,0), MAX_RCS_THRUSTD, ph_rcs, ISP);
        AddExhaust (th_rcsd[0], 5, 0.2, _V(0.0,-1.16,4.41), _V(0,-1,0),tex_rcsd);
	AddExhaust (th_rcsd[0], 5, 0.2, _V(0.0,-1.28,4.19), _V(0,-1,0),tex_rcsd);
        AddExhaust (th_rcsd[0], 5, 0.2, _V(0.0,2.37,-3.07), _V(0,1,0),tex_rcsd);
        AddExhaust (th_rcsd[0], 5, 0.2, _V(0.0,2.47,-2.86), _V(0,1,0),tex_rcsd);    

	CreateThrusterGroup (th_group, 2, THGROUP_ATT_PITCHUP);

Code:
rcslevel0 = GetThrusterLevel(th_rcs[1]);
if (rcslevel0 == 1.0)SetThrusterLevel (th_rcsd[0],lvl);
else SetThrusterLevel (th_rcsd[0],rcslevel0);

Pressing the INCR, the RCS increase N
Pressing the DECR, the RCS decrease N

between the two keys will be released on set value LVL...10%....25% etc.

awCAiwc.jpg


I hope that everything works .......:hailprobe:
 
Back
Top