Over the top professionals at your service!
12
Apr

Adaptive active phased array radars are seen as the vehicle to address the current requirements for true ‘multifunction’ radars systems.  Their ability to adapt to the envirounment and schedule their tasks in real time allows them to operate with performance levels well above those that can be achieved from the conventional radars. 

Their ability to make effective use of all the available RF power and to minimize RF losses also makes them a good candidate for future very long range radars. The AAPAR can provide many benefit in meeting the performance that will be required by tommorow’s radar systems. In some cases it will be the only possible solution.

It provides the radar system designer with an almost infinte range of possibilites. This flexibility, however, needs to be treated with caution: the complexity of the system must not be allowed to grow such that it becomes uncontolled and unstable. The AAPAR breaks down the conventional walls between the traditional systems elements- antenna, transmitter, receiver etc-such that the AAPAR design must be treated holistically.

Strict requirements on the integrity of the system must be enforced. Rigourous techiues must be used to ensure that the overall flow down of requirements from top level is achieved and that testeability of the requirements can be demonstrated under both quiescent and adaptive condition.


,

12
Apr

 

Syntax :.

math.deg (x)

Example :

print(math.deg(180))              -->   3.1415926535898

print(math.deg(math.pi))       --> 180

print(math.deg(math.pi/2))   --> 90

12
Apr

The RoboTurret Vision Tracking Kit is an industry first! Never before has it been so easy and so inexpensive to jump into the world of machine vision! Trossen Robotics has teamed up with RoboRealm to bring this fantastic kit to experimenters everywhere. Included with this kit is the Desktop RoboTurret, a Microsoft Lifecam VX-800 with mounting solution, and a full license to the easy to use yet powerful RoboRealm  Machine Vision software! The Desktop RoboTurret  is fully supported within Roborealm with its own interface module, providing a GUI for easy control of the pan/tilt and the various I/O features of the board. There is also a demo Roborealm program available that can be used to track different colored objects using this kit; a great starting point for your next machine vision project!

This easy to build kit is based around the exclusive MosquitIO Pan & Tilt Microcontroller  and includes everything needed to build a fully programmable, Arduino-compatible Pan & Tilt platform. Add webcams, lasers, airsoft guns, a variety of sensors to the available I/O, up to two small motors, and switch things on and off with the built-in solid-state relay! The MosquitIO  can also be custom programmed using the Arduino IDE for autonomous behavior using sensory input, or a variety of other custom applications- your imagination is the limit!

 

For more details watch the video mentioned below:

 

http://www.youtube.com/watch?v=o3hJOMQjNwo&feature=player_embedded

12
Apr

Automatic Reference Counting (ARC) for Objective-C makes memory management the job of the compiler. By enabling ARC with the new Apple LLVM compiler, you will never need to type retain or release again, dramatically simplifying the development process, while reducing crashes and memory leaks. The compiler has a complete understanding of your objects, and releases each object the instant it is no longer used, so apps run as fast as ever, with predictable, smooth performance.

12
Apr

One of the neat features available in iPhone OS 3.0 is the GameKit framework. The GameKit framework contains APIs to allow communications over a Bluetooth network. Using these APIs, you can create peer-to-peer games and applications with ease. Unlike other mobile platforms, using Bluetooth as a communication channel in iPhone is way easier than expected. Hence, in this article, I will show you how to build a simple application that allows two iPhone or iPod Touch devices to communicate with each other.

Regards: http://www.devx.com/

Creating the Project

Using Xcode, create a new View-based Application project and name it as Bluetooth.

All the various APIs for accessing the Bluetooth is located in the GameKit framework. Hence, you need to add this framework to your project. Add a new Framework to the project by right-clicking on the Frameworks group in Xcode and selecting Add, Existing Frameworks. Select GameKit.framework

In the BluetoothViewController.h file, declare the following object, outlets, and actions:

#import

#import

@interface BluetoothViewController : UIViewController {

GKSession *currentSession;

IBOutlet UITextField *txtMessage;

IBOutlet UIButton *connect;

IBOutlet UIButton *disconnect;

}

@property (nonatomic, retain) GKSession *currentSession;

@property (nonatomic, retain) UITextField *txtMessage;

@property (nonatomic, retain) UIButton *connect;

@property (nonatomic, retain) UIButton *disconnect;

-(IBAction) btnSend:(id) sender;

-(IBAction) btnConnect:(id) sender;

-(IBAction) btnDisconnect:(id) sender;

@end

The GKSession object is used to represent a session between two connected Bluetooth devices. You will make use of it to send and receive data between the two devices.

In the BluetoothViewController.m file, add in the following statements in bold:

 

#import "BluetoothViewController.h"

#import

@implementation BluetoothViewController

@synthesize currentSession;

@synthesize txtMessage;

@synthesize connect;

@synthesize disconnect;

Double-click on BluetoothViewController.xib to edit it in Interface Builder. Add the following views to the View window :

  • Text Field
  • Round Rect Button

 

Perform the following actions:

  • Control-click on the File’s Owner item and drag and drop it over the Text Field view. Select txtMessage.
  • Control-click on the File’s Owner item and drag and drop it over the Connect button. Select connect.
  • Control-click on the File’s Owner item and drag and drop it over the Disconnect button. Select disconnect.
  • Control-click on the Send button and drag and drop it over the File’s Owner item. Select btnSend:.
  • Control-click on the Connect button and drag and drop it over the File’s Owner item. Select btnConnect:.
  • Control-click on the Disconnect button and drag and drop it over the File’s Owner item. Select btnDisconnect:.

Right-click on the File’s Owner item to verify that all the connections are made correctly

 

Back in Xcode, in the BluetoothViewController.m file, add in the following statements in bold:

 

- (void)viewDidLoad {

[connect setHidden:NO];

[disconnect setHidden:YES];

[super viewDidLoad];

}

- (void)dealloc {

[txtMessage release];

[currentSession release];

[super dealloc];

}

 

 

Searching for Peer Devices

 

Now that all the plumbings for the project have been done, you can now focus on the APIs for accessing other Bluetooth devices.

In the BluetoothViewController.h file, declare a GKPeerPickerController object:

 

#import "BluetoothViewController.h"

@implementation BluetoothViewController

@synthesize currentSession;

@synthesize txtMessage;

@synthesize connect;

@synthesize disconnect;

GKPeerPickerController *picker;

The GKPeerPickerController class provides a standard UI to let your application discover and connect to another Bluetooth device. This is the easiest way to connect to another Bluetooth device.

To discover and connect to another Bluetooth device, implement the btnConnect: method as follows:

 

-(IBAction) btnConnect:(id) sender {

picker = [[GKPeerPickerController alloc] init];

picker.delegate = self;

picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;

[connect setHidden:YES];

[disconnect setHidden:NO];

[picker show];

}

The connectionTypesMask property indicates the types of connections that the user can choose from. There are two types available: GKPeerPickerConnectionTypeNearby and GKPeerPickerConnectionTypeOnline. For Bluetooth communication, use the GKPeerPickerConnectionTypeNearby constant. The GKPeerPickerConnectionTypeOnline constant indicates an Internet-based connection.

When remote Bluetooth devices are detected and the user has selected and connected to one of them, the peerPickerController:didConnectPeer:toSession: method will be called. Hence, implement this method as follows:

- (void)peerPickerController:(GKPeerPickerController *)picker

didConnectPeer:(NSString *)peerID

toSession:(GKSession *) session {

self.currentSession = session;

session.delegate = self;

[session setDataReceiveHandler:self withContext:nil];

picker.delegate = nil;

[picker dismiss];

[picker autorelease];

}

When the user has connected to the peer Bluetooth device, you save the GKSession object to the currentSession property. This will allow you to use the GKSession object to communicate with the remote device.

If the user cancels the Bluetooth Picker, the peerPickerControllerDidCancel: method will be called. Define this method as follows:

- (void)peerPickerControllerDidCancel:(GKPeerPickerController *)picker

{

picker.delegate = nil;

[picker autorelease];

[connect setHidden:NO];

[disconnect setHidden:YES];

}

To disconnect from a connected device, use the disconnectFromAllPeers method from the GKSession object. Define the btnDisconnect: method as follows:

-(IBAction) btnDisconnect:(id) sender {

[self.currentSession disconnectFromAllPeers];

[self.currentSession release];

currentSession = nil;

[connect setHidden:NO];

[disconnect setHidden:YES];

}

When a device is connected or disconnected, the session:peer:didChangeState: method will be called. Implement the method as follows:

- (void)session:(GKSession *)session

peer:(NSString *)peerID

didChangeState:(GKPeerConnectionState)state {

switch (state)

{

case GKPeerStateConnected:

NSLog(@"connected");

break;

case GKPeerStateDisconnected:

NSLog(@"disconnected");

[self.currentSession release];

currentSession = nil;

[connect setHidden:NO];

[disconnect setHidden:YES];

break;

}

}

Handling this event will allow you to know when a connection is established, or ended. For example, when the connection is established, you might want to immediately start sending data over to the other device.

Sending Data

To send data to the connected Bluetooth device, use the sendDataToAllPeers: method of the GKSession object. The data that you send is transmitted via an NSData object; hence you are free to define your own application protocol to send any types of data (e.g. binary data such as images). Define the mySendDataToPeers: method as follows:

- (void) mySendDataToPeers:(NSData *) data

{

if (currentSession)

[self.currentSession sendDataToAllPeers:data

withDataMode:GKSendDataReliable

error:nil];

}

Define the btnSend: method as follows so that the text entered by the user will be sent to the remote device:

-(IBAction) btnSend:(id) sender

{

//---convert an NSString object to NSData---

NSData* data;

NSString *str = [NSString stringWithString:txtMessage.text];

data = [str dataUsingEncoding: NSASCIIStringEncoding];

[self mySendDataToPeers:data];

}

 

Receiving Data

When data is received from the other device, the receiveData:fromPeer:inSession:context: method will be called. Implement this method as follows:

- (void) receiveData:(NSData *)data

fromPeer:(NSString *)peer

inSession:(GKSession *)session

context:(void *)context {

//---convert the NSData to NSString---

NSString* str;

str = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Data received"

message:str

delegate:self

cancelButtonTitle:@"OK"

otherButtonTitles:nil];

[alert show];

[alert release];

}

Here, the received data is in the NSData format. To display it using the UIAlertView class, you need to convert it to an NSString object.

 

Testing the Application

Once the application is deployed to the two devices, launch the application on both devices. On each device, tap the Connect button. The GKPeerPickerController will display the standard UI to discover other devices.

When another device tries to connect to you, you will see the popup. Tap on Accept to connect and Decline to decline the connection.

If you are connected, you can now enter some text and start sending to the other device. Data received from another device will be shown in an alert view.

, , ,

12
Apr

To convert an existing project from a non-ARC(Automatic Reference Counting) project to an ARC, you have to do the following :

  1. Go to the Edit menu of the Xcode.
  2. Select Refactor menu from the list of menus which appear.
  3. Now select Convert to Objective-C ARC option from the sub menus which appear.
  4. From the window which appears next, select your project target to convert to ARC.
  5. Click the Check button and Xcode will now ready your app to convert to ARC based project and it will instruct you about what are the modifications in the code that needed to be done to convert the app to ARC.

Once the all issues are solved, the wizard will show the modifications made also.

, , ,

12
Apr

We can identify whether a Xcode project is using Automatic Reference Counting(ARC) or not, by checking the Objective-C Automatic Reference Counting flag of the compiler.

To check this flag,

select Xcode project from the Project Navigator in the left panel, now on the right panel, select project and check the Objective-C Automatic Reference Counting flag. If this flag is set to Yes, then the project is using ARC and if it is set to No, then the project is not using ARC.

Note that ARC is only available from Xcode v 4.3

, , ,

11
Apr

Description:
A boolean for whether the rotation of the body should be locked, even if the body is under load or subjected to off-center forces. The default is false.

Syntax:

body.isFixedRotation

Example:

myBody.isFixedRotation = true
local state = myBody.isFixedRotation

11
Apr

Syntax:  

object = display.captureScreen( saveToAlbum )

Calling this method displays the captured image on the screen on top of all other display objects. Use

object:removeSelf()

 
to remove this object from the screen.

Screen capture only works for openGL content and not for any of the native display objects.

eg:

local rect = display.newRect(0, 0, display.contentWidth, display.contentHeight)
rect:setFillColor(0, 255, 0) 

local circle = display.newCircle(155, 100, 36)
circle:setFillColor(255, 0, 0) 

-- Capture the screen
local screenCap = display.captureScreen( true )

-- Remove the objects from the screen
rect:removeSelf()
circle:removeSelf()

-- Scale the screen capture, now on the screen, to half it's size
screenCap:scale(.5,.5)

local alert = native.showAlert( "Success", "Screen Capture Saved to Library", { "OK" } )

, ,

09
Apr

Creating your own actions in Cocos2D

Creating your own actions is pretty easy. You should familiarize yourself with this concepts, because actions are very powerful and can be combined with another actions to create more actions.

For example, there is the Blink action. It is implemented by subclassing intervalAction, but you could actually do something like:

def Blink(times, duration):

return (

Hide() + Delay(duration/(times*2)) +

Show() + Delay(duration/(times*2))

) * times

 

Basic Internals

 

All actions work on a target. Its their callers responsibility to set the target to the correct element. This allows the user to instantiate an action and then apply the same action to various different elements. All cocosnodes can be a target for an action.

You will not know who the target is when __init__ or init is called, but you will when start is called. If you are making an action that takes more actions as parameters, it is your responsibility to:

  • set the target
  • call the start method
  • call the stop method

You can also override the __reversed__ method. In this method you have to construct and return an action that would be the reversed version of the action you are doing. For example, in Show() we returnHide() as its reverse:

class Show( InstantAction ):

"<snip>"

def __reversed__(self):

return Hide()

 

Instant Actions

 

Instant actions are actions that will take no time to execute. For example, Hide() sets the target visibility to False.

It is very easy to create an action using the CallFuncS action as a decorator:

@CallFuncS

def make_visible( sp ):

sp.do( Show() )

self.sprite.do( make_visible )

please note that make_visible will not be a regular function that you can call, it will be an action. So you can compose it like any other action.

If you want to subclass InstantAction, you will have to override:

  • the init method to take the parameters you desire
  • the start method to do the action

Thats it.

For example, this is a minimal implementation of SetOpacity:

class SetOpacity( InstantAction ):

def init(self, opacity):

self.opacity = opacity

def start(self):

self.target.opacity = self.opacity

 

Interval Actions

 

Interval actions is where the fun is. With this actions you can specify transformations that take a finite time. For example, MoveBy(how_much, duration).

The protocol for IntervalAction subclasses is the following:

  • init method will be called. here you have to set your duration property.
  • a copy of the instance will be made (you don’t have to worry about this)
  • start method will be called (self.target will be set)
  • update(t) will most likely be called many time with t in [0,1) and t will monotonically rise.
  • update(1) will be called.
  • stop() will be called.

So its in update that you do your magic. For example, if you want to fade something out, you can write something like:

class FadeOut( IntervalAction ):

def init( self, duration ):

self.duration = duration

 

def update( self, t ):

self.target.opacity = 255 * (1-t)

 

def __reversed__(self):

return FadeIn( self.duration )

The trick is that whoever is running your action will interpolate the values of t so that you get called with t==1 when your duration is up. This does not mean that duration seconds have elapsed, but it usually does. If someone wants to make your action go twice as fast, they can feed you updates at a different rate and you should not care.

Also, this allows us to change the interpolation method. We usually use linear interpolation, but AccelDeccel, for example, uses a sigmoid function so that is goes slower at the ends.

Grid Actions

These are IntervalAction actions, but instead of modifying normal attributes like rotationpositionscale, they modify the grid attribute.

Let’s see in detail how to build a basic non-tiled-grid action:

class Shaky3D( Grid3DAction):

Shaky3D is a subclass of Grid3DAction, so we are building a non-tiled action. If we want to create a tiled action, we need to subclass from the TiledGrid3DAction class:

def init( self, randrange=6, *args, **kw ):

”’

:P arameters:

`randrange` : int

Number that will be used in random.randrange( -randrange, randrange) to do the effect

”’

super(Shaky3D,self).init(*args,**kw)

 

#: random range of the shaky effect

self.randrange = randrange

Our class receives the randrange parameter, so we save it, and we call init of our super class:

def update( self, t ):

for i in xrange(0, self.grid.x+1):

for j in xrange(0, self.grid.y+1):

x,y,z = self.get_original_vertex(i,j)

x += random.randrange( -self.randrange, self.randrange+1 )

y += random.randrange( -self.randrange, self.randrange+1 )

z += random.randrange( -self.randrange, self.randrange+1 )

 

self.set_vertex( i,j, (x,y,z) )

Like any other IntervalAction action the update method is going to be called once per frame. So, our Shaky3D effect will modify the x,“y“ and z coordinate by a random number that is calculated by therandom.randrange function.

The get_original_vertex method returns the original coordinates of the vertex x and y, while the get_vertex method returns the current coordinates of the vertex x and y.

, ,