How to make Pepper robot move randomly and then go to its charging station - robot

Intro:
I have created an application now which works well. The problem is that my Pepper Robot is doing this application while standing in one place. I managed to get it moving in intervals with AlNavigation.explore() but it seems like this is not the smoothest way since it is mostly doing circles around itself and then just moving a little. Also i when Pepper is getting below 15% battery i want it to go find its charging station. I did it successfully when it was in autonomous life but when my application is opened then it does not work. I added ALRecharge.goToStation() to my application to fix this, but sometimes it works and sometimes it doesnt.
Questions:
1) How to make Pepper smoothly "walk" around in the room and then stop when someone is speaking to Pepper?
2) How to add Recharger app inside my application so they would work together, or should i do it myself for my application?
3) How to make sure Pepper finds charging stock even if Pepper does not see it from where it is standing?
Does anyone have any examples of this maybe where they made Pepper "live" in the room and also used Pepper charging stand.
Thanks

When you ask your Pepper to go to recharge, the charging station has to be in view (ie roughly less than 3 meters).
If not, he won't find it.
What I would suggest is to use the map, created during the ALNavigation exploration in the background, to send Pepper near his charging station, then you can start the ALRecharge.goToStation() method.
So the easiest way it to turn your Pepper on while on his charger (or just restart naoqi) so after exploring you just have to ask him to go to world position (0,0,0) then you can ask him to go to recharge.
If you don't want to use navigation to move, you could also use the WorldRobotPosition to send it manually back to the position 0,0,0.

Alexandre's solution is a good one.
If you create a map through the explore method in ALNavigation, you could also feed random in-map targets to the navigateToInMap method, in order to navigate around quite smoothly.
You can then decide to stop the navigation when you detect someone, with ALFaceDetection or ALPeoplePerception.

If you use ALNavigation, you can make a map and use it to move with Pepper :
ALNavigation.explore()
#The best is to start exploration near the charging station, so the coordinates (0,0) will be the charging station
path = ALNavigation.saveExploration()
ALNavigation.loadExploration(path)
ALNavigation.startLocalization()
Ok, now you are localized.
You can get the current position of your robot with
ALNavigation.getRobotPositionInMap()
It returns an array with the position of the robot and the confidence.
Create a file somewhere on your robot and put the coordinates like {charger : [0,0]} if you have multiple coordinates to save.
If you want to move smoothly, you can use ALNavigation.navigateToInMap(coord) but it will not be really smooth.
What could be better is to use multiple ALMotion.moveToward(x,y,theta,configuration) and set the velocity of the robot.

Related

Howto set number to last run in intellij

What do I need to do that my saved run -configurations get numbers so that I can call them directly. I dont want to mess-around with cursor up and down.
In the following screenshot there is a "1" for run configuration (blue background) but I do not know how it came there and what do I have to search for in IntellijDoc to add numbers like 2 to other configurations. :-)
I don't think it is possible yet, what I do, is rename the configurations with a number at the beginning, i.e. 2. Test All so I can take advantage of the search feature of the run dialog for achieving almost what you want to do. In this way you are going to type a bit more, but you are not going to need to use the mouse :)

What exactly happens when you press the "play" button in Unity?

As soon as you hit "Play" what happens in the background of the software? The code is already compiled and ready at this point. So when I press "Play" the code gets executed. What other things occur along with this?
I have this question as an assignment and would really like to know. Thanks. :)
Actually everything is loaded by script. This graph explains the process. Also the links below can be useful for you to understand all the background process.
Execution Order of Event Functions
Overview: Script compilation
Asking what happens when you press Play is like asking Coke to reveal the drink recipe. This is what they sell. You got that as assignment, fact is you can say anything and your teacher would lie to tell you wrong, since he does not know either (except if he works for a company that bought the source code of the engine).
What you can say, is that the OpenGl/DirectX API is initialised, registration of all event to the OS like Input, application data and so on, then all the Engine functioning, registering of the needed classes in memory, init of the physics, parsing of the opening scene YAML file, creation of the content and placement in space, for each item, if a MonoBehaviour, registration of all callbacks, all the debug code related to profiler and stack tracing, crash reports and many more...
Those are the obvious ones and I cannot have any clue of what is going on without using a tool to decompose the code. Problem, it is against the EULA and then illegal.

On Smalltalk IDEs (Squeak, VisualWorks, etc), how can you navigate away from a message's code you're working on to inspect another?

In every IDE I've tried so far, if I'm partway through writing a message and need to look at the code of another, the browser asks me if I want to save. But if I say I do want to save, it actually tries to compile/syntax check the code, and refuses to perform the save if it does not pass. The only way to view the source of another message seems to be to say "no" to save and have everything wiped. How can I look at another class incidentally, or save code I am partway through working on that might not build right now?
Smalltalk is a multi-browser system. You'll need to have lots of different browsers open. Smalltalk is opinionated. The system browser (Nautilus) doesn't make it easy to view long methods, steering you towards writing short ones. It doesn't make it easy to have non-compiling code in a method, to steer you towards making small changes.
Experimental/prototypical code you might want to have in a Workspace/Playground. That can save to disk.
We are aware that it is an issue for people new to Smalltalk. We tried some fixes, they were a lot worse.
For now there is no easy way to do that. The two easiest opting are
Make the current method syntactically correct and save it.
Open another browser. If you want to see a class or method that is in your current code, you can cmd+click it or use "browse it", "implementors of", shortcuts that will open another window.
Also in pharo you can use GTSpotter to quickly find what you are looking for and preview its source code
When you say "this seems like a pretty huge thing to be missing,
and it could be gotten around by just having the option to use
a regular editor" I'm afraid you've entirely missed the point.
Understandable, though -- happens to us all.
Or did. Perhaps it was long ago, but we
were all there.
You might be thinking about the task in terms of
scrolling a giant text up and down to find what
you want. Scroll up -- read a little -- scroll back --
and continue making your changes.
And when you say " I can't imagine any circumstance
where it is OK, in pursuit of any agenda, to throw away
the coder's work against their will "
you are spot on correct, of course.
Imagine -- scrolling around, making dozens of little changes,
and before you've saved them -- poof -- they're all thrown away --
a mistake, perhaps, but completely against your will.
That would be awful. We're agreed.
(In fact, the editor I'm using to type this
is like that -- I can scroll around the whole thing,
making little improvements, all over, but it could
all go --poof-- and disappear, All of it.
Fairly common occurrence, when editing the web.
)
So let's try another run through that same task.
You get one little teensy, DUMB AS A POST editor,
where you can only see one thing at a time.
And now you just want to scroll somewhere else,
for a moment, and come right back.
Which actually means that
you are attempting to look up a second method,
while already changing a first method
(which would require the browser toforget the
context of the first method, and move to the second).
The browser does not know how long you will be away
from this context. You might go chaining along from
place to place, stop and read an email, take a call,
and go to lunch.
So, the browser cautions
"Hey - want to save this first?"
as if to say:
"
Hey - I can't imagine any circumstance where it is OK,
in pursuit of any agenda, to throw away the coder's work
against their will.
So listen up, coder.
You want to save this first?
"
But you can't save it.
You must first look something up.
Conundrum.
Ah-ha! There is a list of methods in that other pane.
One of them is highlighted.
Not those -- that one.
Double click that one.
The one you're already in.
As if to say
" Thanks. Good catch.
Yes, I know - can't though.
I need to change contexts.
You stay right here.
And give me another context
to go wandering about in.
please.
"
Soon, I expect, they'll start actually talking.

How do I create a new logic brick for blender?

I am thinking of making a new logic brick to contribute or 10, but need to get a template/idea of where to start, I want to make a 6dof actuator and sensor first, that can trigger based on rotation targets or distance limits etc, and a actuator that can remove or change a 6dof target to a new position or object and position,
I am making a open source 3d puzzle game with limited ads in game, but need to make a few logic bricks, for me and the community....
There are no coding tutorials regarding BGE Game logic that I'm aware of, but here are some pointers for the code:
The game logic parts are mostly in:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/gameengine/GameLogic/
You'll see that sensors implement the ISensor interface. Browse through a few different sensors to see how they work. Blender has NDOF device support, so NDOF events already exist (get handled by our GHOST layer: https://svn.blender.org/svnroot/bf-blender/trunk/blender/intern/ghost/intern/GHOST_NDOFManager.h ). You could create a new manager like the mouse manager (see the gamelogic directory for the different managers ).
With this information you should be able to get started. Read the existing code carefully, you'll be able to find what you need.
You can use this commit Mouse actuator commit as your template to add a new actuator.

Problems with KML layers

My map has 9 layers which can be toggled on and off by means of a tick box. Each layer is loaded in by JS. My problem is that only 5 of the nine load when their tick box is active. Is there a limit on how many kml layers can be loaded in to v3 api? In total there is less than 1mb, though they do have quite a few custom marker icons.
Thanks
Darren
I am having a eerily familiar-sounding issue. I am working with KML files in similar fashion (an array of map layers as KML files are picked/loaded by JS via a tick box, not big, although quite a few custom marker icons, long descriptions, etc..).
I have just now become aware of what seems like a NEW limit. Wish I could be more help, but I will share what I know.
In my case, the exact same code was working fine as far back as June 2011 and the map has been viewed/used by 1000s of people. It's a custom v3 api map for an annual event. The 'legend' has about 34 layers containing lines or markers, classified by type, any of which could be 'on' at any given time. The default, and most commonly used, setup had about 12 "layers" on. Only one of the layers (happens to be the last one in the array when it loads) is one that changes significantly from year to year. It's also the most important one. If people were getting significant errors in June 2011 in some browser/OS, I would have heard about it. It was this file that I sat down to "quickly" edit and re-upload in time for the 2012 event. I hadn't even touched it before I noticed that something was wrong. I haven't needed to look at the map since last year, so unfortunately I can't be more precise as to when this started happening.
Findings/Conclusions/Ideas?:
dumping the browser cache does nothing
Through trial and error, I found that it will actually load up to 6 "layers", but it seems to depend on the size/type/juju? of any given kML file in the comma delineated list. But, like you, it's usually around 5 or 6.
Oddly, the KML files themselves seem to be there in the background. Invisible markers will affect the mouse pointer "on hover over" and their info boxes will show up when clicked. Strange.
This problem is definitely less than a year old for me.
If not somehow related to some new action of Google's (in which case I would suspect we'd hear about it or have found something in the API forums..) perhaps it is related to some new limits placed by one of our servers and is simply a coincidence?
---> hmm. I recently had a wordpress site's menu item limit issue and got my hosting provider to change some suhosin request limits(?) I can try migrating the source file to another server, and see if it works from there. If it does, that would be a significant clue, and I will report back.
Other than that, I have no idea. Just thought I'd share what I've learned and hope someone else has some idea of what's going on.