element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sensors
  • Technologies
  • More
Sensors
Blog Controlling google earth using 3D Gesture MGC3130 Hillstar Dev Kit Part - 3
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Sensors to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ss_shrenik
  • Date Created: 14 Aug 2014 7:10 PM Date Created
  • Views 577 views
  • Likes 0 likes
  • Comments 2 comments
  • 3d_gesture
  • 3d_gesture_technology
Related
Recommended

Controlling google earth using 3D Gesture MGC3130 Hillstar Dev Kit Part - 3

ss_shrenik
ss_shrenik
14 Aug 2014

In this blog I am giving insight about python Server which uses gesture data to control Google Earth using Google's python APIs. Before writing program you need to install Google python API package which is attached with this blog. Install this package as you install normally python package "setup.py install". Following is the python code snippet I am giving which does following job

 

1. Initiates TCP server over localhost with port numbe 5005.

2. Initiate Google earth APIs default variable value.

3. Reads Gesture data which comes over TCP port 5005 on localhost.

4. Parse that data in order to take specific action to google earth movement according to gesture.

5. Keep doing step 3 and 4 continuously.

 

Code-

 

import socket



import win32com.client, time


googleEarth =  win32com.client.Dispatch("GoogleEarth.ApplicationGE")
while not googleEarth.IsInitialized():
    time.sleep(0.5)
    print "waiting for Google Earth to initialize"








latitude=41.487942                            # Latitude in degrees. Between -90 and 90.
longitude=0#-81.6865                            # Longitude in degrees. Between -180 and 180. to rotate the earth



altitude=1000  


     # in meters



tilt=0  # looking to the horizon=90, looking to the center of Earth=0
azimuth=370  # looking North=0, East=90, South=180, West=270



speed=0.5  
 # speed transition. must be >= 0, above 5.0 the transition is instantaneous



range=0              # If not=0 camera will move backward from "range meters along the camera axis
altMode=1  #Altitude mode that defines altitude reference origin (1=above ground, 2=absolute)
focusDistance=10000000  #Zoom Value can be changed








TCP_IP = '127.0.0.1'
TCP_PORT = 5005
BUFFER_SIZE = 20  # Normally 1024, but we want fast response
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connection address:', addr
while 1:








data = conn.recv(BUFFER_SIZE)



if not data: break



#print "received data:", data



#focusDistance=0



#data=0



if data == "DRIGHT":




print "Right Direction longitude = ", longitude




if longitude <= 180:





longitude = longitude-10




if longitude == -180:





longitude = 180








elif data == "DLEFT":




if longitude >= -180:





longitude = longitude+10




if longitude == 180:





longitude = -180




print "Left Direction longitude = ", longitude



elif data == "DUP":




if tilt > 10:





tilt = tilt - 10 




if tilt == 0:





tilt = 90




print "Up Direction tilt = ", tilt



elif data == "DDOWN":




if tilt < 90:





tilt = tilt + 10 




if tilt == 90:





tilt = 0









print "Down Direction tilt = ", tilt



elif data[0] == 'Z':




print "Z data Direction"




data = data[1:6]




focusDistance = (int(data))




print 'focus_distance z = ', focusDistance



    #conn.send(data)




#conn.close()



googleEarth.SetCameraParams (latitude, longitude, altitude, altMode, focusDistance, tilt, azimuth, speed)



cam=googleEarth.GetCamera(True)       # returns a ICameraInfoGE  object

 

 

I tried to write as neat as possible, still if anyone will have query just comment below, I will try to answer that. Also I am uploading the demo video which I was not able to upload last time due to some technical problem in website.

 

Kindly have a look at it.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

I wish to create another application using this Kit, I hope I will demo it soon.

Attachments:
google-api-python-client-1.2.zip
pyserver.py.zip
  • Sign in to reply

Top Comments

  • gpolder
    gpolder over 10 years ago +1
    Shrenik, great application, thanks for the thorough description. You were lucky that you got VS2010 running, due to a known Microsoft problem I didn't, so I have to wait for VS2012 support for the Hillstar…
  • ss_shrenik
    ss_shrenik over 10 years ago in reply to gpolder

    Yeh Thanks. I just fresh installed VS2010 express ediion which is free version from microsoft.

     

    Regards,

    Shrenik.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • gpolder
    gpolder over 10 years ago

    Shrenik,

     

    great application, thanks for the thorough description.

    You were lucky that you got VS2010 running, due to a known Microsoft problem I didn't, so I have to wait for VS2012 support for the Hillstar SDK.

     

    best regards,

    Gerrit.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube