Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Addons > Addon Development
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Addon Development Developers post news, updates, & discussions here about your projects in development.

Reply
 
Thread Tools
Old 07-21-2019, 03:56 PM   #91
Woo482
Moderator
 
Woo482's Avatar


Default

Well, if someone wants to make one you'll have a user in me
Woo482 is offline   Reply With Quote
Old 07-21-2019, 09:31 PM   #92
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

On the movement can you just change the lat and long of the guy. Change the heading....

Code:
if (FORWARDgear==1)//MOVING FORWARD
	 {
		if (i3 < 0){//LEFT TURN
			d_hdg = d_hdg + .00001;//rate of steering change of heading
			vs2.surf_hdg -= d_hdg;
			//sprintf(oapiDebugString(), "turn %d  SURFHDG %2.2f", i3,  vs2.surf_hdg);
			if (vs2.surf_hdg<0){ vs2.surf_hdg += 2 * PI; }
			rot += 0.005;//animation axle wheel turn rate
			if (rot > .125) rot = .125;
		}
		if (i3 > 0){//RIGHT TURN
			rot -= 0.005;//animation axle wheel turn rate
			if (rot < -.125) rot = -.125;
			d_hdg = d_hdg + .00001;//rate of steering change of heading
			vs2.surf_hdg += d_hdg;
			//sprintf(oapiDebugString(), "turn %d SURFHDG %2.2f", i3,  vs2.surf_hdg);
			if (vs2.surf_hdg>2 * PI){ vs2.surf_hdg -= 2 * PI; }
		}
		if (i3 == 0) {// straight so straighten wheels
			// sprintf (oapiDebugString (), "turn %2.2f cos %2.2f sin %2.2f", TURN_proc, cosTurn, sinTurn );
			if (abs(rot) <= 0.005) rot = 0;
			else if (rot < 0) rot += 0.005;
			else if (rot > 0) rot -= 0.005;
			d_hdg = 0;
		}
		if (TURN_proc == 0){//wheels are straight so move with heading
			 d_lat = (targetSpeed*oapiGetSimStep()*cos(vs2.surf_hdg) / each_deg);
			 d_lng = (targetSpeed*oapiGetSimStep()*sin(vs2.surf_hdg) / each_deg);
		}
		else {//wheels are not straight so move no matter the heading move to the left forward
			 d_lat = (targetSpeed*oapiGetSimStep()*(cosTurn*1) / each_deg);
			 d_lng = (targetSpeed*oapiGetSimStep()*(sinTurn*1) / each_deg);
			

		}
		
		//sprintf(oapiDebugString(), "turn %2.2f cos %2.2f sin %2.2f lat %2.2f lng %2.2f", TURN_proc, cosTurn, sinTurn, d_lat, d_lng);

			vs2.surf_lat += d_lat*RAD;
			vs2.surf_lng += d_lng*RAD;

}
My issue was trying to get the guy created in the airlock and not in the center of the vessel
gattispilot is online now   Reply With Quote
Thanked by:
Old 07-21-2019, 09:59 PM   #93
Woo482
Moderator
 
Woo482's Avatar


Default

I have tried that, it seems to result in the vessel just spinning on the ground:

The code used is:
Code:
oid oMMU_MMU::doGroundMovement(double deltaT)
{
	VESSELSTATUS2 vs;
	memset(&vs, 0, sizeof(vs));
	vs.version = 2; 
	GetStatusEx(&vs);

	double planetRadius = oapiGetSize(GetSurfaceRef());
	double degrees = (planetRadius * 2 * PI) / 360;


	// Calculate the new latitude of the vessel 
	double newLat = vs.surf_lat + ((yVelocity * deltaT) / planetRadius) * (180 / PI);
	if (newLat > 90)
		newLat = 90;
	else if (newLat < -90)
		newLat = -90;

	// Calculate the new longitude of the vessel
	double newLong = vs.surf_lng + ((xVelocity * deltaT) / planetRadius) * (180 / PI) / cos(vs.surf_lat * (PI / 180));
	if (newLong > 179.9999)
		newLong = -179.9999;
	else if (newLong < -179.9999)
		newLong = 179.9999;

	/* Update the vessel status struct */
	vs.surf_lat = newLat;
	vs.surf_lng = newLong;
	vs.surf_hdg = 0.0; // Fixed heading for testing 
	DefSetStateEx(&vs);
}
I'm sure I'm missing something insanely obvious, but I've not managed to spot what yet
Woo482 is offline   Reply With Quote
Thanked by:
Old 07-22-2019, 01:03 AM   #94
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Code:
void LER2016::MoveAround(){
memset(&vs2, 0, sizeof(vs2));
	vs2.version = 2;
	GetStatusEx(&vs2);
	double sinTurn = sin(2 * PI * TURN_proc);
	double cosTurn = cos(2 * PI * TURN_proc);
	if (FORWARDgear==1)//MOVING FORWARD
	 {
		if (i3 < 0){//LEFT TURN
			d_hdg = d_hdg + .00001;//rate of steering change of heading
			vs2.surf_hdg -= d_hdg;
			//sprintf(oapiDebugString(), "turn %d  SURFHDG %2.2f", i3,  vs2.surf_hdg);
			if (vs2.surf_hdg<0){ vs2.surf_hdg += 2 * PI; }
			rot += 0.005;//animation axle wheel turn rate
			if (rot > .125) rot = .125;
		}
		if (i3 > 0){//RIGHT TURN
			rot -= 0.005;//animation axle wheel turn rate
			if (rot < -.125) rot = -.125;
			d_hdg = d_hdg + .00001;//rate of steering change of heading
			vs2.surf_hdg += d_hdg;
			//sprintf(oapiDebugString(), "turn %d SURFHDG %2.2f", i3,  vs2.surf_hdg);
			if (vs2.surf_hdg>2 * PI){ vs2.surf_hdg -= 2 * PI; }
		}
		if (i3 == 0) {// straight so straighten wheels
			// sprintf (oapiDebugString (), "turn %2.2f cos %2.2f sin %2.2f", TURN_proc, cosTurn, sinTurn );
			if (abs(rot) <= 0.005) rot = 0;
			else if (rot < 0) rot += 0.005;
			else if (rot > 0) rot -= 0.005;
			d_hdg = 0;
		}
		if (TURN_proc == 0){//wheels are straight so move with heading
			 d_lat = (targetSpeed*oapiGetSimStep()*cos(vs2.surf_hdg) / each_deg);
			 d_lng = (targetSpeed*oapiGetSimStep()*sin(vs2.surf_hdg) / each_deg);
		}
		else {//wheels are not straight so move no matter the heading move to the left forward
			 d_lat = (targetSpeed*oapiGetSimStep()*(cosTurn*1) / each_deg);
			 d_lng = (targetSpeed*oapiGetSimStep()*(sinTurn*1) / each_deg);
			

		}
		
		//sprintf(oapiDebugString(), "turn %2.2f cos %2.2f sin %2.2f lat %2.2f lng %2.2f", TURN_proc, cosTurn, sinTurn, d_lat, d_lng);

			vs2.surf_lat += d_lat*RAD;
			vs2.surf_lng += d_lng*RAD;

}

lng = vs2.surf_lng;
		lat = vs2.surf_lat;
		hdg = vs2.surf_hdg;

	 DefSetStateEx(&vs2);
			 return;
		 }
This is what I use to move the LER2016. You can ignore the TURN proc that was for moving at angle while not changing the heading.


Works. But not sure how to change the vessels altitude using vs2?

---------- Post added at 08:03 PM ---------- Previous post was at 05:14 PM ----------

Give this guy a try:
https://drive.google.com/open?id=1Le...ufgunEa6lg-5u1

keypad 8 forward and 2 backward, 1/3 turns

Last edited by gattispilot; 07-21-2019 at 10:40 PM.
gattispilot is online now   Reply With Quote
Thanked by:
Old 07-22-2019, 12:33 PM   #95
JMW
Aspiring Addon Developer
 
JMW's Avatar
Default

Quote:
Originally Posted by gattispilot View Post
 
[/COLOR]Give this guy a try:
https://drive.google.com/open?id=1Le...ufgunEa6lg-5u1

keypad 8 forward and 2 backward, 1/3 turns
First time I've tried this.
Looks good, but turn only works if press 8 and 1 or 3 together and then is too quick. ?
JMW is offline   Reply With Quote
Thanked by:
Old 07-22-2019, 12:38 PM   #96
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. Yes I need it to change the heading separate from moving forward. I can move the guy my issue was creating and or deleting the guy in a certain area aka airlock
gattispilot is online now   Reply With Quote
Old 07-22-2019, 02:06 PM   #97
Woo482
Moderator
 
Woo482's Avatar


Default

Looks like the rotation matrix stuff you have for setting the arot of the VESSELSTATUS2 struct is what I was missing. If you're wanting to I can probably get an alpha of oMMU to you to integrate with your LER in the next week or two - I've graduated now so I have some free time to catch up with things and finally get it finished
Woo482 is offline   Reply With Quote
Thanked by:
Old 07-23-2019, 10:37 AM   #98
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

yes thanks. I need to tweak that code. Really not sure if that matrix is needed. But it worked. Some was needed to adjust the pitch and roll for a vehicle but a guy would always be straight up

---------- Post added 07-23-19 at 05:37 AM ---------- Previous post was 07-22-19 at 09:25 AM ----------

So I got the guy to turn smoothly. But only when not moving. Not sure why though. I think it is in here but it looks good
Code:
int NewUmmu::clbkConsumeDirectKey(char *kstate) {

 if (KEYDOWN(kstate, OAPI_KEY_NUMPAD8)) {
		
				FORWARDgear = 1;
			REVERSEgear = 0;
				neutralgear = 0;

		return 0;
	}
	else if (KEYDOWN(kstate, OAPI_KEY_NUMPAD2)) {

		FORWARDgear = 0;
		REVERSEgear = 1;
		neutralgear = 0;

		return 0;
	}
	else if (KEYDOWN(kstate, OAPI_KEY_NUMPAD1)) {
		turnvalue =  0.001;
		
		return 0;
	}
	else if (KEYDOWN(kstate, OAPI_KEY_NUMPAD3)) {
		turnvalue =  - 0.001;
		
		return 0;
	}
	FORWARDgear = 0;
	REVERSEgear = 0;
	neutralgear = 0;
	turnvalue = 0;
	return 0;
}
It is like when pressing one key the other keys don't register?

new zip:https://drive.google.com/open?id=1Vg...7S6yf9tr94T0vt
gattispilot is online now   Reply With Quote
Thanked by:
Old 07-23-2019, 02:17 PM   #99
JMW
Aspiring Addon Developer
 
JMW's Avatar
Default

Sorry but still the same for me.
Only turns with NumPad 8 and 3 or 1 pressed together.
Still turns too fast....?
JMW is offline   Reply With Quote
Old 07-23-2019, 02:26 PM   #100
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So it will only turn if keypad 8 and 1 are pressed? or 8 and 3?

I thought I had it set to turn 1/3 separate from 8 moving forward. But I could only turn when I wasn't pressing 8

What happens when you press 2 backwards.

I think there may need a slow and run speed selection.
gattispilot is online now   Reply With Quote
Old 07-23-2019, 05:47 PM   #101
JMW
Aspiring Addon Developer
 
JMW's Avatar
Default

Quote:
So it will only turn if keypad 8 and 1 are pressed? or 8 and 3?
Yup.
Quote:
I thought I had it set to turn 1/3 separate from 8 moving forward. But I could only turn when I wasn't pressing 8
Is exact opposite for me, strange init?
Quote:
What happens when you press 2 backwards.
It goes backwards, and turns same as with 8.

From your code snippet, I don't understand why either.....

Keep up the good work bro.
JMW is offline   Reply With Quote
Thanked by:
Old 07-24-2019, 10:38 AM   #102
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks to Brian J. I got the keypad to work
https://drive.google.com/open?id=18J...MqyANkMAahCZVy
gattispilot is online now   Reply With Quote
Old 07-27-2019, 12:57 PM   #103
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

now 4/6 moves the guy sideways.
https://drive.google.com/open?id=10U...hcltvljDMvxRoG
gattispilot is online now   Reply With Quote
Old 08-09-2019, 02:31 AM   #104
Gargantua2024
Orbinaut
Default

Nice! Now the ingress/egress system is needed for oMMU
Gargantua2024 is offline   Reply With Quote
Thanked by:
Old 08-09-2019, 11:26 AM   #105
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Quote:
Originally Posted by Gargantua2024 View Post
 Nice! Now the ingress/egress system is needed for oMMU

Thanks. I was able to create and delete the guy. BUT not able to create the guy at a certain spot like an airlock. In space I could because I made a dock where the guy was to come out and made it and docked. But not be able to do that on the ground.



I think also it need to be able to read the scn and get the mesh name. So from the scn you can change the mesh
gattispilot is online now   Reply With Quote
Thanked by:
Reply

  Orbiter-Forum > Orbiter Addons > Addon Development

Tags
development, eva, mmu, ommu


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 11:02 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.