Jump to content

Recommended Posts

Posted

Hi guys, I'm testing my LOFC2 Ver.1.2.1 export script with a simple mission I built. The mission has a total of 6 waypoints, but I got 8 in the exported data.

 

The script goes like this:

 

	local route = LoGetRoute()
if route then
socket.try(c:sendto(string.format("Goto_point :\r\n point_num = %d ,wpt_pos = (%f, %f ,%f) ,next %d\r\n",route.goto_point.this_point_num,route.goto_point.world_point.x,route.goto_point.world_point.y,route.goto_point.world_point.z,route.goto_point.next_point_num),host,port))

socket.try(c:sendto(string.format("Route_points:\r\n"),host,port))

for num,wpt in pairs(route.route) do
	socket.try(c:sendto(string.format("point_num = %d ,wpt_pos = (%f, %f ,%f) ,next %d\r\n",wpt.this_point_num,wpt.world_point.x,wpt.world_point.y,wpt.world_point.z,wpt.next_point_num),host,port))
end

 

Nothing fancy here. There're only a couple of prefixes to help visually locate each section. And here's what came in through socket:

 

Goto_point :
point_num = 2 ,wpt_pos = (-284889.062500, 45.000000 ,683853.750000) ,next 3

Route_points:

point_num = 1 ,wpt_pos = (-285204.406250, 45.000000 ,682643.937500) ,next 2

point_num = 2 ,wpt_pos = (-284889.062500, 45.000000 ,683853.750000) ,next 3

point_num = 3 ,wpt_pos = (-307471.406250, 45.000000 ,610423.750000) ,next 4

point_num = 4 ,wpt_pos = (-337618.312500, 45.000000 ,617159.125000) ,next 5

point_num = 5 ,wpt_pos = (-293402.687500, 754.000000 ,790813.812500) ,next 6

point_num = 6 ,wpt_pos = (-260895.734375, 1086.000000 ,783488.937500) ,next 7

point_num = 7 ,wpt_pos = (-284889.062500, 45.000000 ,683853.750000) ,next 0

point_num = 8 ,wpt_pos = (-285204.406250, 45.000000 ,682643.937500) ,next -1

 

Obviously "for num,wpt in pairs(route.route) do" went a little too far and we can see the "next 0" and "next -1". Did I do something wrong? If there's no way around this I can still filter off the corrupted messages by recognizing the off range "next" values, but I'm just curious. Thanks for reading.

Posted

Noticed some patterns:

 

Each take off or landing waypoint, will generate +1 waypoint in the list.

 

Having a -1 waypoint seems normal, it appears to be the last waypoint's "next" value.

 

When one of the waypoints in the list has its "next" value = 0, it could mean one of the way points is a take off waypoint.

 

Hope I won't have to rediscover something others already worked out pretty thoroughly.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...