I just have started working with the NAO robot with the C++ SDK.
I would like to use NAO as a presenter like in front of a small group or classrooms as lecturers. At the same time I want NAO to control the slide presentation of a laptop (e.g. with Powerpoint). I tried to look for some solutions and heard about making the presentation as a "webpage", and use "qimessaging" to communicate with NAO.
Like I said I just started programing on the NAO. Can anyone give me some advice with the webpage/ qimessaging solution or does anyone have another way to program it?
Thank you in advance.
Sure, that's totally buildable on NAO; basically have a webpage hosted on the robot, that uses QiMesssaging Javascript to communicate with the robot, and then show that in fullscreen page on your screen.
To build that you could start with the robot-jumpstarter template service-webpage-nao (specifically made for working on NAOqi 2.1 - if you're in 2.8 (on NAO v6) the other templates should work too); which contains a Python service that has two-way communciation with the associated webpage.
You could then change that service to contain your lecture contents, for example by having it set an ALMemory key containing the current page status (image / text to show), and then have the javascript watch that ALMemory key and update the page based on that (you don't need the two-way communication, as you shouldn't have buttons etc.). The example is in Python, but you could do the same with C++ (it will require more work, I don't really recommend it for a simple use case like that).
(You don't even need a service, you could do that from Choregraphe, but I find standalone Python more readable)
Related
I'm working on a school project which I would like to showcase in a web browser or application.
I would like the user to control the work with a mouse or keyboard. I want to show a unique image based on where the curser is over a visible grid. An additional feature is the ability to switch to a different "stack" of images upon user input from the scroll wheel or in a dialog.
I have a beginner-intermediate understanding of Python.
Theoretically, I could write this using Sage, but I would like the feedback to be instant - a change shouldn't require a new calculation, just show a new image.
Additionally, I would like to create a feature which takes the user on a "tour" based on information attached to an image.
My first thought was to use an online website builder (Webflow), though an opportunity to learn a new language or expand upon my knowledge of Python is my first choice.
What language is best suited for this?
This is possible in Python, as nearly everything is (Python is a Genral Purpose Language), so you could certainly implement this in Python.
The best language for this, however,IMO, would be JavaScript.
Python will almost certainly get in your way or at least hinder you slightly in comparison.
An 'online website builder' is not likely to provide you with the required amount to control needed to implement you project - most of these are painfully simplistic drag-and-drog tools where any real control only comes from adding your own CSS/HTML/JS anyways.
JS is an incredibly useful language and also very well suited for nearly all web/browser projects, so use this opportunity to learn it !
Further, React Native can let you use JS for mobile apps too, if that's what you meant by 'applications' or you could simply keep it a web app.
PS. This may also be possible with HTML5, which is perhaps simpler and easier to learn, but I'm no a web dev so that will have to be confirmed by someone else.
I am sure, though, that this is very efficiently doable in JS.
I'm contemplating using python for some functional testing of flash ad-units for work. Currently, we have an ad (in flash) that has N locations (can be defined as x,y) that need to be 'clicked'. I'd like to use python, but I know Java will do this.
I also considered Jython + Sikuli, but wanted to know if there is a python only library or tool to do this. I'd prefer to not run Jython + Sikuli if there is a native python option.
TIA.
#user1929959 From the pyswftools page, "At the moment, the library can be used in Python applications (including WebBased applications) to generate Flash animations on the fly.". And from the bottle-flash page, "This plugin enables flash messages in bottle.". Neither help me, unless I'm overlooking something ...
There are a number of ways I've seen around the net, but most seem to involve exposing Flash through JS and then using the JS interface, which is a bit of a problem if you are trying to test things that you don't have dev access to, or need to be in a prod-like state for your tests. Of course, even if you do that, you aren't really simulating user interaction, since you are working through an API.
If you can reliably model your Flash components with fixed pixel positions relative to the page element the Flash component is running in, you should be able to use Selenium Webdriver to position the mouse cursor and send click commands without actually cracking Flash itself. I'm not 100% sure that would work, but it seems at least worth a shot. Validation will be a bit trickier, but I think you should be able to do it with some form of image comparison. A few of the Flash automators I saw are actually using image processing under the hood to control both input and output, so it seems like a legitimate way to interact with it.
I am usually working in fields of machine learning and hence my background is mostly in stats/ML and no formal web background.
Usually for my project, I work on python which is connected to my local mysql db... to fetch data adn everything.
Now, my work is mostly complete.. everything is console based..
(like traditional programs).
How do I integrate it on the front end. I understand that this is more like a server side scripting.
So, lets take an example of google.
In the front end.. someone enters a search query.. and in the backend lets say there is a program in C++ which executes that query.
How did this interaction takes place.. if front end is written in lets say php..
I assume shell execution of program is a bad bad way to run programs.. ??
Any suggestion will be greatly appreciated.
Thanks
As suggested by Ignacio, you will first need to design API for your project. This is basically clearly laying out what (and how) queries will be supported for your project.
You don't need shell execution and neither need to learn PHP. Since your project is in Python, you can use Python Web-frameworks like Django, Web2Py.
The first thing to do is to develop an API for your library. From there you can develop multiple frontends that use the same API in order to present it multiple ways.
Decouple your user interface logic from your business logic, then reuse the business logic libraries in an application that accepts input over HTTP instead of the console. Django is a popular web framework that will take care of a lot of the front end concerns for you, or you can use something like CGI if you prefer to be a bit closer to the bare metal. The Python Wiki has a section on web programming that you might find useful.
I just discovered impure.com and was very impressed by what can be achieved in terms of visualizing data using their workspace. Although the platform is free to use, but not open source yet. This causes a few problems because the API section works with .com sites for eg. for ebay, so I cannot visualize ebay listings for regional sites such as ebay.in because the link to ebay.com is hardcoded.
I searched around, but didn't find other projects that offer a similar way to work with site APIs and other data sources with the kind of user interface and detail that impure.com does in a realtime way within a browser window.
This brings me to the questions:
What technologies would be involved in creating a similar kind of project
What are the open source tools that can help develop a fullscreen UI to render the workspace. Are there any alternatives to flash for this, and how do they compare
The goal would be to use standard python data structures, python scripts to do some processing on these data structures, scripts to gather data from csv, json and API sources such as google yahoo, wikipedia and flickr, and scripts to render graphs, tag clouds, network visualizations etc. Then bring them all together into a visual interface that supports drag drop and simple type checking
How would the python backend integrate with the UI
sorry for the rambling question, but i wanted to present as much detail as possible. I'd like to do this for the fun of it
So, restating, Impure is like OpenDX but running in a browser and you are interested in suggestions for an architecture to build your own web version of it?
I suggest using Cappuccino as your front end Web GUI. This is a toolkit for building RIAs in the browser that are completely based on HTML and Javascript (no Flash). It is modeled after Apple's Cocoa so you can build some very sophisticated apps with it.
On the web server side, I would use the Python bindings to OpenDX to build a JSON API that is exposed to the web browser. Note, this Python module uses DXLink, which appears to be mainly a batch/command interface to OpenDX - you might still need to do some work to get visualizations out of it and back to the web browser. But, it's all open source so it should be feasible. Here's a discussion where others are attempting the same thing.
I don't know for sure that OpenDX supports pulling data via web service calls but you could certainly handle that on the Python side and feed it into OpenDX.
Note, I don't mention a Python web framework because, since your app will be mostly a JSON API almost any of them would work just as well. I suggest the thinnest and simplest one that appeals to you.
I was wondering if it is possible to implement a web based game in python. I have searched the internet and cannot seem to find any tutorial or document pointing to this. Any advice will be appreciated..
Your question is a bit vague but from what I understand you are trying to create a web based game with Python.
As python is a serverside language you could implement the website/server with it but for the client and the game itself you will need a browser based client-side technology. Like Flash, Silverlight, WEBGL or Even Javascript and HTML5. But this will all depend on how you would like to structure your game.
You could create a Server that pushes information to the clients with a library with say Twisted. The other option you could choose is to create a website that the clients will poll for information or use Comet for Push.
These are the only ways I know to "directly" code in python for the web :
Pyjamas which is a python to pyjamas compiler. See this asteroid example (buggy on Chrome). I made one myself and simple stuffs are working well but you can't display text on the canvas at the moment. And i guess It would be much slower than pure javascript.
IronPython with Silverlight and here a tutorial.
Panda3D and its plugin, so you'll have to ask the players to download that plugin.
Of course it is. But without more information on what type of game it is impossible to provide further guidance.
Python is a serverside language. For the "web" in web-based you still need HTML und JS (or Flash). Using Python for the serverside is possible. Here is a list of Python web frameworks (my personal favorite is Django).
Python can be used in a variety of ways for developing web games. In particular, it can be very useful for doing the back-end of a multiplayer game. For the front-end you will probably need to use a client-side technology like Flash, but there have been turn-based games that simply use static HTML as the front-end (for example, Urban Dead) and that could be implemented in Python alone without a separate client-side technology.