It is currently Mon Sep 06, 2010 4:12 am




Post new topic Reply to topic  [ 6 posts ] 
 Automated Piloting Bot 
Author Message
User avatar

Joined: Sat Dec 06, 2003 4:06 pm
Posts: 190
Location: Someplace in....
Post Automated Piloting Bot
This is a 'bus' style automated piloting bot type dealy. It loops through a | seperated list of instructions to do things, that right now, include landing and going to coordinates.

GOTO <x> <y> <z> will go to that set of coords. and LAND <x> <y> <z> <landing spot> will land at whatever is at those coords (or..the first of which if there is multiple) at the landing spot given. I've also included a GATE option, but since i've found that alot of mushes seem to do it a few different ways, i'll leave that up to the individual coders.


As a note, all coords should be given in whatever format that hs_get_attr() gives. So if its at 0 0 0, you'll need to put 0.00 0.00 0.00. Here is an example of my test stuff to get you started:

Code:
STORE.ACTIONLIST [#1]: GOTO:20.00 20.00 20.00|GOTO:10.00 10.00 10.00|GOTO:0.00 0.00 0.00|LAND:0.00 0.00 0.00 1


Ok. I've included the code in this post..only because I do not have a place to put it otherwise.

Code:
@create Pilot Bot
@power Pilot Bot = See_All
@power Pilot Bot = No_Pay
@power Pilot Bot = Search
&ALANDP Pilot Bot=@remit/list search(,zone,v(hsdb_owner))=Attention Passengers. We are initiating our landing sequence. Please take your seats.
&ALANDPO Pilot Bot=@remit/list search(,zone,v(hsdb_owner))=Attention Passengers. We have landed. Thank you for flying Crazy Air. We're so crazy..and soooo cheap
&ALAUNCHP Pilot Bot=@remit roomlist=stuff
&FN.ADVANCEPOSITION Pilot Bot=[set(me,store.position:[if(elements(v(store.actionlist),setr(p,inc(v(store.position))),|),%qp,1)])]
&FN.GETCURRENTACTION Pilot Bot=elements(v(store.actionlist),v(store.position),|)
&FN.GETLANDID Pilot Bot=first(iter(hs_srep(v(hsdb_owner),0),switch([hs_get_attr(elements(itext(0),2,:),x)]:[hs_get_attr(elements(itext(0),2,:),y)]:[hs_get_attr(elements(itext(0),2,:),z)],[setq(d,last(%0,:))][elements(%qd,1)]:[elements(%qd,2)]:[elements(%qd,3)],first(itext(0),:)),|))
&HSDATA_DESTINATION Pilot Bot=@console/power 1;@switch first(setr(a,u(fn.getcurrentaction)),:)=GOTO,{&hsdata_x [hs_sys_attr(%!/autopilot,controller,1)]=[elements(last(%qa,:),1)];&hsdata_y [hs_sys_attr(%!/autopilot,controller,1)]=[elements(last(%qa,:),2)];&hsdata_z [hs_sys_attr(%!/autopilot,controller,1)]=[elements(last(%qa,:),3)];@nav/setvelocity 100\%;@nav/autopilot 1},GATE,@emit Autogate not implimented,LAND,{@nav/land [u(fn.getlandid,%qa)]/[last(last(%qa,:))];@trigger me/alandp;@trig me/hsdata_launch;@wait 30=@trigger me/alandpo},@emit This shouldnt happen ;th u(fn.advanceposition)
&HSDATA_LAUNCH Pilot Bot=@console/power 1;th [setq(t,add(15,v(store.pausetime)))];@wait %qt={@nav/undock;@trigger me/alaunchp;@trig me/hsdata_destination};{&store.launchat me=%q1}
@STARTUP Pilot Bot=@console/power 1;@switch hs_get_Attr(%!,objloc)=#-1,@trig me/hsdata_destination,{@nav/undock;@wait 30=@trigger me/hsdata_destination}
@set Pilot Bot/STARTUP=no_command prefixmatch
&STORE.ACTIONLIST Pilot Bot=GOTO 0.00 0.00 0.00
&STORE.PAUSETIME Pilot Bot=60
&STORE.POSITION Pilot Bot=1



Ok. So it's slightly untested. Maybe buggy

EDIT : Let me add that this requires grapenuts autopilot. Its not actually an autopilot...more of an automated autopilot director thingy..yea


Mon Nov 28, 2005 4:41 pm
Profile

Joined: Mon Dec 09, 2002 5:41 pm
Posts: 285
Location: Plush office chair
Post 
kick ass :)


Wed Nov 30, 2005 5:15 pm
Profile WWW

Joined: Mon Dec 09, 2002 5:41 pm
Posts: 285
Location: Plush office chair
Post 
bump

Looking for autopilot help, check this out also.


Tue Mar 21, 2006 10:50 am
Profile WWW
User avatar

Joined: Sat Dec 06, 2003 4:06 pm
Posts: 190
Location: Someplace in....
Post 
Dont use this.. Appears to cause issues ...and ..err..crash mu*s. I have no Idea what it is..and I want to find out..hell I even have core dumps and GDB on the crashed process as we speed..but I dont rightly know what I am looking at.


Thu Mar 08, 2007 7:46 am
Profile

Joined: Mon Dec 09, 2002 5:41 pm
Posts: 285
Location: Plush office chair
Post 
Post the backtrace from the dumps please.


Thu Mar 08, 2007 12:11 pm
Profile WWW
User avatar

Joined: Sat Dec 06, 2003 4:06 pm
Posts: 190
Location: Someplace in....
Post 
Bug fixed this. The issue was with code dealing with choosing the object to land on based on coordinates.. some how that was borking with it. The code has been improved.


This version also requires parenting to a Navigation aide...I call it a Nav-I-Gator (picture a navigating 'gator)...

Here is the navigator code
Code:
@create Nav-I-Gator Parent
@set Nav-I-Gator Parent = WIZARD
&CMD.ADDWAYPOINT Nav-I-Gator Parent=$nav/add *=* * *:@pe %#=if(and(isnum(%1),isnum(%2),isnum(%3)),set(me,WP`[edit(%0,%b,_)]:%1 %2 %3)[ansi(hr,-)] Waypoint Set. ,ansi(hr,-) Invalid Coordinates)
&CMD.AUTOPLOT Nav-I-Gator Parent=$nav/autoplot *:@pe %#=if(gt(words(setr(w,u(fn.findwaypoint,%0))),1),[ansi(hr,-)] Buncha waypoints lookin like that.,u(fn.header)%r%r[align(-38 -38,ansi(m,Destination:%b)[ansi(y,edit(after(%qw,WP`),_,%b))]%r[ansi(m,ETT:)]%b[timestring(trunc(fdiv(setr(d,round(dist3d(setr(1,u(fn.wpcoord,%qw,x)),setr(2,u(fn.wpcoord,%qw,y)),setr(3,u(fn.wpcoord,%qw,z)),setr(x,hs_get_attr(v(hsdb_ship),x)),setr(y,hs_get_attr(v(hsdb_ship),y)),setr(z,hs_get_attr(v(hsdb_ship),z))),2)),fdiv(mul(hs_sys_Attr(v(hsdb_ship)/engines,max velocity),2),3600))))],ansi(m,Distance:)%b[ansi(y,%qd)]%r[ansi(m,Heading:)]%b[ansi(y,xyang(%qx,%qy,%q1,%q2)m[zang(%qx,%qy,%qz,%q1,%q2,%q3)]   )])])%r%r[center(ansi(hr,Course automagicly layed in. 'nav/auto-on' to engage to destination.),78)][null([set(hs_sys_attr(v(hsdb_ship)/auto,controller),hsdata_x:%q1)][set(hs_sys_attr(v(hsdb_ship)/auto,controller),hsdata_y:%q2)][set(hs_sys_attr(v(hsdb_ship)/auto,controller),hsdata_z:%q3)])]%r[u(fn.footer)]
&CMD.AUTOTOGGLEOFF Nav-I-Gator Parent=$nav/auto-off:@fo v(hsdb_ship)=@nav/autopilot 0
&CMD.AUTOTOGGLEON Nav-I-Gator Parent=$nav/auto-on:@fo v(hsdb_ship)=@nav/autopilot 1
&CMD.INTERCEPT Nav-I-Gator Parent=$nav/intercept *:@pemit %#=if(or(setr(n,match(hs_srep(v(hsdb_ship),0),*:*:*:*:*%0*:*:*:*,|)),setr(i,match(hs_srep(v(hsdb_ship),0),%0:*:*:*:*:*:*:*,|))),[setq(c,[hs_get_attr(elements(elements(hs_srep(v(hsdb_ship),0),firstof(%qn,%qi),|),2,:),x)]:[hs_get_attr(elements(elements(hs_srep(v(hsdb_ship),0),firstof(%qn,%qi),|),2,:),y)]:[hs_get_attr(elements(elements(hs_srep(v(hsdb_ship),0),firstof(%qn,%qi),|),2,:),z)])][setq(0,hs_sys_attr(v(hsdb_ship)/auto,controller,1))][set(%q0,hsdata_x:[elements(%qc,1,:)])][set(%q0,hsdata_y:[elements(%qc,2,:)])][set(%q0,hsdata_z:[elements(%qc,3,:)])][ansi(hr,-)] Intercepting Contact,[ansi(hr,-)] Invalid Contact )
&CMD.LINK Nav-I-Gator Parent=$nav/setup *:@pe %#=switch(locate(%#,%0,*),#-1,ansi(hr,-) Invalid Console,set(me,hsdb_ship:#$)[ansi(hr,-)] Linked to [name(#$)] of ship [hs_get_attr(#$,name)][oemit(%#,The [name(%!)] clicks and beeps as %n fiddles with the settings.)]  )
&CMD.LISTWAYPOINTS Nav-I-Gator Parent=$nav/list:@pe %#=u(fn.header)%r%r[align(3 20 10 -10 -10 -10,[@@(spacer)],ansi(m,Waypoint),ansi(m,Distance),ansi(m,X),ansi(m,Y),ansi(m,Z))]%r[iter(lattrp(me/wp`*),align(3 20 10 -10 -10 -10,[@@(spacer)],ansi(y,edit(after(##,WP`),_,%b)),ansi(g,round(dist3d(u(fn.wpcoord,##,x),u(fn.wpcoord,##,y),u(fn.wpcoord,##,z),hs_get_attr(v(hsdb_ship),x),hs_get_attr(v(hsdb_ship),y),hs_get_attr(v(hsdb_ship),z)),2)),ansi(c,u(fn.wpcoord,##,x)),ansi(c,u(fn.wpcoord,##,y)),ansi(c,u(fn.wpcoord,##,z)) ),%b,%r)]%r%r[u(fn.footer,time())]
&CMD.MANPLOT Nav-I-Gator Parent=$nav/manplot *:@pe %#=if(u(fn.findwaypoint,%0),if(gt(words(setr(w,u(fn.findwaypoint,%0))),1),[ansi(hr,-)] Buncha waypoints lookin like that.,u(fn.header)%r%r[align(-38 -38,ansi(m,Destination:%b)[ansi(y,edit(after(%qw,WP`),_,%b))]%r[ansi(m,ETT:)]%b[timestring(trunc(fdiv(setr(d,round(dist3d(setr(1,u(fn.wpcoord,%qw,x)),setr(2,u(fn.wpcoord,%qw,y)),setr(3,u(fn.wpcoord,%qw,z)),setr(x,hs_get_attr(v(hsdb_ship),x)),setr(y,hs_get_attr(v(hsdb_ship),y)),setr(z,hs_get_attr(v(hsdb_ship),z))),2)),fdiv(mul(hs_sys_Attr(v(hsdb_ship)/engines,max velocity),2),3600))))],ansi(m,Distance:)%b[ansi(y,%qd)]%r[ansi(m,Heading:)]%b[ansi(y,xyang(%qx,%qy,%q1,%q2)m[zang(%qx,%qy,%qz,%q1,%q2,%q3)]   )])])%r%r[u(fn.footer)],ansi(hr,-) Invalid Waypoint)
&CMD.NAVADDCONTACT Nav-I-Gator Parent=$nav/addcontact *:@pe %#=if(or(setr(n,match(hs_srep(v(hsdb_ship),0),*:*:*:*:*%0*:*:*:*,|)),setr(i,match(hs_srep(v(hsdb_ship),0),%0:*:*:*:*:*:*:*,|))),set(me,WP`[edit(elements(setr(r,elements(hs_srep(v(hsdb_ship),0),firstof(%qn,%qi),|)),5,:),%b,_)]:[hs_get_attr(elements(%qr,2,:),x)] [hs_get_attr(elements(%qr,2,:),y)] [hs_get_attr(elements(%qr,2,:),z)])[ansi(hr,-)] Contact added to navigational memory. ,[ansi(hr,-)] Invaid Contact.)
&CMD.NAVSTAT Nav-I-Gator Parent=$nav/stat:@pe %#=u(fn.header)%r%r[if(hs_sys_attr(v(hsdb_ship)/auto,engaged,1),[center(ansi(m,Destination Coords),78)][center(align(-15 -15 -15,ansi(m,X),ansi(m,Y),ansi(m,Z)),78)%r[center(align(-15 -15 -15,ansi(y,get(hs_sys_Attr(v(hsdb_ship)/auto,controller)/hsdata_x)),ansi(y,get(hs_sys_Attr(v(hsdb_ship)/auto,controller)/hsdata_y)),ansi(y,get(hs_sys_Attr(v(hsdb_ship)/auto,controller)/hsdata_z))),78)] )]%r%r)][center(ansi(m,Current Coords),78)][center(align(-15 -15 -15,ansi(m,X),ansi(m,Y),ansi(m,Z)),78)%r[center(align(-15 -15 -15,ansi(y,hs_get_Attr(v(hsdb_ship),x)),ansi(y,hs_get_attr(v(hsdb_ship),y)),ansi(y,hs_get_attr(v(hsdb_ship),z))),78)]%r%r[align(12 20 30,,[ansi(m,Course:)]%b[ansi(y,[hs_get_attr(v(hsdb_ship),xyheading)]m[hs_get_attr(v(hsdb_ship),zheading)])],[ansi(m,Autopilot Status:)]%b[ansi(y,if(hs_sys_attr(v(hsdb_ship)/auto,engaged,1),ENGAGED,DISENGAGED)  )]   )]%r%r[u(fn.footer)]
@DESCRIBE Nav-I-Gator Parent=A slick looking little grey box with some flashing lights and a large display screen with some data on it. It has a nifty rotating dial in one corner for easy selection of data. It also has a small cord comming out of it that plugs into a near by receptical.
@set Nav-I-Gator Parent/DESCRIBE=no_command visual prefixmatch public nearby
&FN.FINDWAYPOINT Nav-I-Gator Parent=[@@(%0:Waypoint)]lattrp(me/wp`[edit(%0,%b,_)]*)
&FN.FOOTER Nav-I-Gator Parent=if(%0,ansi(b,rjust(%b[ansi(w,%0)]%b,65,-))[ansi(hb,repeat(-,13))],ansi(hb,repeat(-,78)))
&FN.HEADER Nav-I-Gator Parent=ansi(hb,center(%b[ansi(hw,name(me))] [ansi(y,-)] [ansi(hw,hs_get_attr(v(hsdb_ship),name))]  %b,78,-))
&FN.WPCOORD Nav-I-Gator Parent=[@@(%0:Waypoint, %1:X/Y/Z)]elements(v(%0),switch(%1,x,1,y,2,z,3))
&HSDB_SHIP Nav-I-Gator Parent=
@WP Nav-I-Gator Parent=List of Waypoints
&WP`CENTER Nav-I-Gator Parent=0.00 0.00 0.00




And here is the new pilot bot code. Set its parent to the navi-gator code
Code:
@create Pilot Bot Parent
@lock/Use Pilot Bot Parent=#2565
@lset Pilot Bot Parent/Use=no_inherit
@set Pilot Bot Parent = HALT
@set Pilot Bot Parent = NO_COMMAND
@set Pilot Bot Parent = HSPACE_CONSOLE
@power Pilot Bot Parent = No_Pay
@power Pilot Bot Parent = Search
@power Pilot Bot Parent = See_All
&ALANDP Pilot Bot Parent=@remit/list search(,zone,v(hsdb_owner))=Attention Passengers. We are initiating our landing sequence towards the planet of [elements(elements(v(store.actionlist),switch(sub(v(store.position),2),<1,words(v(store.actionlist),|),#$),|),2,:)]. Please take your seats.
&ALANDPO Pilot Bot Parent=@remit/list search(,zone,v(hsdb_owner))=Attention Passengers. We have landed on [capstr(lcstr(elements(elements(v(store.actionlist),sub(v(store.position),1),|),2,:)))]. Thank you for flying Crazy Air. We're so crazy..and soooo cheap
&ALAUNCHP Pilot Bot Parent=@remit/list hs_Get_attr(me,srooms)=Attention Passengers. We are initiating our launch sequence. Please take your seats. We are currently headed towards [capstr(lcstr(elements(elements(v(store.actionlist),add(v(store.position),0),|),2,:)))].
&FN.ADVANCEPOSITION Pilot Bot Parent=[set(me,store.position:[if(elements(v(store.actionlist),setr(p,inc(v(store.position))),|),%qp,1)])]
&FN.GETCURRENTACTION Pilot Bot Parent=elements(v(store.actionlist),v(store.position),|)
@set Pilot Bot Parent/FN.GETCURRENTACTION=visual
&FN.GETLANDID Pilot Bot Parent=first(first(filter(#lambda/strmatch(hs_get_attr(setr(m\,elements(\%0\,2\,:)),x):\[hs_get_attr(\%qm\,y)\]:\[hs_get_attr(\%qm\,z)]\,elements(%1\,1):\[elements(%1\,2)\]:\[elements(%1\,3)\]),hs_srep(opera,3),|),|),:)
&HSDATA_DESTINATION Pilot Bot Parent=@console/power 1;@switch first(setr(a,u(fn.getcurrentaction)),:)=GOTO,{th setq(c,v(wp`[last(%qa,:)])) ;&hsdata_x [hs_sys_attr(%!/autopilot,controller,1)]=[elements(%qc,1)];&hsdata_y [hs_sys_attr(%!/autopilot,controller,1)]=[elements(%qc,2)];&hsdata_z [hs_sys_attr(%!/autopilot,controller,1)]=[elements(%qc,3)];@nav/setvelocity [hs_sys_attr(%!/engine,max velocity,1)];@nav/autopilot 1},GATE,@emit Autogate not implimented,LAND,{@nav/land [u(fn.getlandid,v(wp`[elements(%qa,2,:))]),v(wp`[elements(%qa,2,:)]))]/[last(last(%qa,:))];@trigger me/alandp;@nav/autopilot 0 ;@trig me/hsdata_launch;@wait v(store.atmotime)=@trigger me/alandpo},@emit This shouldnt happen ;th u(fn.advanceposition)
&HSDATA_LAUNCH Pilot Bot Parent=@wait sub(v(store.pausetime),30)={@remit loc(zone(me))=Attention all: The [name(zone(me))] will be departing shortly. All aboard!};th [setq(t,add(15,v(store.pausetime)))];@wait %qt={@console/power 1;@nav/undock;@trigger me/alaunchp;@wait v(store.atmotime)=@trig me/hsdata_destination};{&store.launchat me=%q1}
&HSDATA_RANGE Pilot Bot Parent=10
&HSDATA_X Pilot Bot Parent=2240.00
@set Pilot Bot Parent/HSDATA_X=no_command
&HSDATA_Y Pilot Bot Parent=990.00
@set Pilot Bot Parent/HSDATA_Y=no_command
&HSDATA_Z Pilot Bot Parent=15.00
@set Pilot Bot Parent/HSDATA_Z=no_command
&HSDB_OWNER Pilot Bot Parent=#1683
&HSDB_RANGE Pilot Bot Parent=10
&HSDB_SHIP Pilot Bot Parent=#6794
&HSDB_XYHEADING Pilot Bot Parent=169
@set Pilot Bot Parent/HSDB_XYHEADING=wizard mortal_dark
&HSDB_ZHEADING Pilot Bot Parent=2
@set Pilot Bot Parent/HSDB_ZHEADING=wizard mortal_dark
@STARTUP Pilot Bot Parent=@console/power 1;@switch hs_get_Attr(%!,objloc)=#-1,@trig me/hsdata_destination,{@nav/undock;@wait 30=@trigger me/hsdata_destination}
@set Pilot Bot Parent/STARTUP=no_command prefixmatch
&STORE.ACTIONLIST Pilot Bot Parent=GOTO:Ezra|LAND:Ezra:1|GOTO:Triumph|LAND:Shadow:1
&STORE.ATMOTIME Pilot Bot Parent=65
&STORE.PAUSETIME Pilot Bot Parent=300
&STORE.POSITION Pilot Bot Parent=4




The store.actionlist is now in names not coordinates..so coordinates can be stored on it in the same manner as they are for way points on the nav-i-gator parent ..

Code:
&wp`<waypoint name> pilot bot=x y z


Otherwise all the same.


Thu Aug 02, 2007 9:06 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.