Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Proken-IoT-2018B
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kazushi.kawamura
Proken-IoT-2018B
Commits
29f18cfe
Commit
29f18cfe
authored
Nov 06, 2018
by
kazushi.kawamura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused files
parent
85a059f8
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
0 additions
and
3469 deletions
+0
-3469
ARDrone.java~
src/com/shigeodayo/ardrone/ARDrone.java~
+0
-495
ARDroneInterface.java~
src/com/shigeodayo/ardrone/ARDroneInterface.java~
+0
-97
CommandManager.java~
src/com/shigeodayo/ardrone/command/CommandManager.java~
+0
-365
BufferedVideoImage.java~
src/com/shigeodayo/ardrone/video/BufferedVideoImage.java~
+0
-1083
ImageSlice.java~
src/com/shigeodayo/ardrone/video/ImageSlice.java~
+0
-32
MacroBlock.java~
src/com/shigeodayo/ardrone/video/MacroBlock.java~
+0
-47
PictureFormats.java~
src/com/shigeodayo/ardrone/video/PictureFormats.java~
+0
-31
ReadRawFileImage.java~
src/com/shigeodayo/ardrone/video/ReadRawFileImage.java~
+0
-98
VideoImage.java~
src/com/shigeodayo/ardrone/video/VideoImage.java~
+0
-1081
uint.java~
src/com/shigeodayo/ardrone/video/uint.java~
+0
-140
No files found.
src/com/shigeodayo/ardrone/ARDrone.java~
deleted
100644 → 0
View file @
85a059f8
This diff is collapsed.
Click to expand it.
src/com/shigeodayo/ardrone/ARDroneInterface.java~
deleted
100644 → 0
View file @
85a059f8
/**
ARDroneForP5
https
://
github
.
com
/
shigeodayo
/
ARDroneForP5
Copyright
(
C
)
2013
,
Shigeo
YOSHIDA
.
Licensed
under
the
Apache
License
,
Version
2.0
(
the
"License"
);
you
may
not
use
this
file
except
in
compliance
with
the
License
.
You
may
obtain
a
copy
of
the
License
at
http
://
www
.
apache
.
org
/
licenses
/
LICENSE
-
2.0
Unless
required
by
applicable
law
or
agreed
to
in
writing
,
software
distributed
under
the
License
is
distributed
on
an
"AS IS"
BASIS
,
WITHOUT
WARRANTIES
OR
CONDITIONS
OF
ANY
KIND
,
either
express
or
implied
.
See
the
License
for
the
specific
language
governing
permissions
and
limitations
under
the
License
.
*/
package
com
.
shigeodayo
.
ardrone
;
public
interface
ARDroneInterface
{
//
connection
public
boolean
connect
();
public
boolean
connectVideo
();
public
boolean
connectNav
();
public
void
disconnect
();
public
void
start
();
//
camera
public
void
setHorizontalCamera
();//
setFrontCameraStreaming
()
public
void
setVerticalCamera
();//
setBellyCameraStreaming
()
public
void
setHorizontalCameraWithVertical
();//
setFrontCameraWithSmallBellyStreaming
()
public
void
setVerticalCameraWithHorizontal
();//
setBellyCameraWithSmallFrontStreaming
()
public
void
toggleCamera
();
//
control
command
public
void
landing
();
public
void
takeOff
();
public
void
reset
();
public
void
forward
();
public
void
forward
(
int
speed
);
public
void
backward
();
public
void
backward
(
int
speed
);
public
void
spinRight
();
public
void
spinRight
(
int
speed
);
public
void
spinLeft
();
public
void
spinLeft
(
int
speed
);
public
void
up
();
public
void
up
(
int
speed
);
public
void
down
();
public
void
down
(
int
speed
);
public
void
goRight
();
public
void
goRight
(
int
speed
);
public
void
goLeft
();
public
void
goLeft
(
int
speed
);
public
void
stop
();
public
void
move3D
(
int
speedX
,
int
speedY
,
int
speedZ
,
int
speedSpin
);
//
speed
public
int
getSpeed
();
public
void
setSpeed
(
int
speed
);
//
set
max
altitude
public
void
setMaxAltitude
(
int
altitude
);
//
set
min
altitude
public
void
setMinAltitude
(
int
altitude
);
}
\ No newline at end of file
src/com/shigeodayo/ardrone/command/CommandManager.java~
deleted
100644 → 0
View file @
85a059f8
/**
ARDroneForP5
https
://
github
.
com
/
shigeodayo
/
ARDroneForP5
Copyright
(
C
)
2013
,
Shigeo
YOSHIDA
.
Licensed
under
the
Apache
License
,
Version
2.0
(
the
"License"
);
you
may
not
use
this
file
except
in
compliance
with
the
License
.
You
may
obtain
a
copy
of
the
License
at
http
://
www
.
apache
.
org
/
licenses
/
LICENSE
-
2.0
Unless
required
by
applicable
law
or
agreed
to
in
writing
,
software
distributed
under
the
License
is
distributed
on
an
"AS IS"
BASIS
,
WITHOUT
WARRANTIES
OR
CONDITIONS
OF
ANY
KIND
,
either
express
or
implied
.
See
the
License
for
the
specific
language
governing
permissions
and
limitations
under
the
License
.
*/
package
com
.
shigeodayo
.
ardrone
.
command
;
import
java
.
io
.
IOException
;
import
java
.
net
.
DatagramPacket
;
import
java
.
net
.
InetAddress
;
import
java
.
nio
.
ByteBuffer
;
import
java
.
nio
.
FloatBuffer
;
import
java
.
nio
.
IntBuffer
;
import
com
.
shigeodayo
.
ardrone
.
manager
.
AbstractManager
;
import
com
.
shigeodayo
.
ardrone
.
utils
.
ARDroneConstants
;
public
abstract
class
CommandManager
extends
AbstractManager
{
protected
static
final
String
CR
=
"
\r
"
;
protected
static
final
String
SEQ
=
"$SEQ$"
;
private
static
int
seq
=
1
;
private
FloatBuffer
fb
=
null
;
private
IntBuffer
ib
=
null
;
private
boolean
landing
=
true
;
private
boolean
continuance
=
false
;
private
String
command
=
null
;
/**
speed
*/
private
float
speed
=
0.05f
;
//
0.01f
-
1.0f
protected
String
VIDEO_CODEC
;
public
CommandManager
(
InetAddress
inetaddr
)
{
this
.
inetaddr
=
inetaddr
;
ByteBuffer
bb
=
ByteBuffer
.
allocate
(
4
);
fb
=
bb
.
asFloatBuffer
();
ib
=
bb
.
asIntBuffer
();
}
public
void
setHorizontalCamera
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
video:video_channel
\"
,
\"
0
\"
"
;
continuance
=
false
;
}
public
void
setVerticalCamera
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
video:video_channel
\"
,
\"
1
\"
"
;
continuance
=
false
;
}
public
void
setHorizontalCameraWithVertical
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
video:video_channel
\"
,
\"
2
\"
"
;
continuance
=
false
;
}
public
void
setVerticalCameraWithHorizontal
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
video:video_channel
\"
,
\"
3
\"
"
;
continuance
=
false
;
}
public
void
toggleCamera
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
video:video_channel
\"
,
\"
4
\"
"
;
continuance
=
false
;
}
public
void
landing
()
{
command
=
"AT*REF="
+
SEQ
+
",290717696"
;
continuance
=
false
;
landing
=
true
;
//
System
.
out
.
println
(
"landing"
);
}
public
void
takeOff
()
{
sendCommand
(
"AT*FTRIM="
+
SEQ
);
command
=
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
false
;
landing
=
false
;
//
System
.
out
.
println
(
"take off"
);
}
public
void
reset
()
{
command
=
"AT*REF="
+
SEQ
+
",290717952"
;
continuance
=
true
;
landing
=
true
;
}
/*
public
void
forward
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,0,"
+
intOfFloat
(-
speed
)
+
",0,0"
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}*/
public
void
forward
(
int
speed
)
{
setSpeed
(
speed
);
forward
();
}
public
void
backward
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,0,"
+
intOfFloat
(
speed
)
+
",0,0"
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
backward
(
int
speed
)
{
setSpeed
(
speed
);
backward
();
}
public
void
spinRight
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,0,0,0,"
+
intOfFloat
(
speed
)
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
spinRight
(
int
speed
)
{
setSpeed
(
speed
);
spinRight
();
}
public
void
spinLeft
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,0,0,0,"
+
intOfFloat
(-
speed
)
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
spinLeft
(
int
speed
)
{
setSpeed
(
speed
);
spinLeft
();
}
public
void
up
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,"
+
intOfFloat
(
0
)
+
","
+
intOfFloat
(
0
)
+
","
+
intOfFloat
(
speed
)
+
","
+
intOfFloat
(
0
)
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
up
(
int
speed
)
{
setSpeed
(
speed
);
up
();
}
public
void
down
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,"
+
intOfFloat
(
0
)
+
","
+
intOfFloat
(
0
)
+
","
+
intOfFloat
(-
speed
)
+
","
+
intOfFloat
(
0
)
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
down
(
int
speed
)
{
setSpeed
(
speed
);
down
();
}
public
void
goRight
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,"
+
intOfFloat
(
speed
)
+
",0,0,0"
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
goRight
(
int
speed
)
{
setSpeed
(
speed
);
goRight
();
}
public
void
goLeft
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,"
+
intOfFloat
(-
speed
)
+
",0,0,0"
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
goLeft
(
int
speed
)
{
setSpeed
(
speed
);
goLeft
();
}
public
void
parallel
(
int
lr
,
int
fb
){
//
original
float
lr_speed
=(
float
)(
lr
/
100.0
);
float
fb_speed
=(
float
)(
fb
/
100.0
);
command
=
"AT*PCMD="
+
SEQ
+
",1,"
+
intOfFloat
(
lr_speed
)
+
","
+
intOfFloat
(
fb_speed
)
+
",0,0"
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
public
void
stop
()
{
command
=
"AT*PCMD="
+
SEQ
+
",1,0,0,0,0"
;
continuance
=
true
;
}
public
void
setSpeed
(
int
speed
)
{
if
(
speed
>
100
)
speed
=
100
;
else
if
(
speed
<
1
)
speed
=
1
;
this
.
speed
=
(
float
)
(
speed
/
100.0
);
}
public
void
enableVideoData
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
general:video_enable
\"
,
\"
TRUE
\"
"
+
CR
+
"AT*FTRIM="
+
SEQ
;
continuance
=
false
;
}
public
void
enableDemoData
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
general:navdata_demo
\"
,
\"
TRUE
\"
"
+
CR
+
"AT*FTRIM="
+
SEQ
;
continuance
=
false
;
}
public
void
disableBootStrap
()
{
command
=
"AT*CONFIG_IDS="
+
SEQ
+
",
\"
"
+
ARDroneConstants
.
SESSION_ID
+
"
\"
,
\"
"
+
ARDroneConstants
.
PROFILE_ID
+
"
\"
,
\"
"
+
ARDroneConstants
.
APPLICATION_ID
+
"
\"
"
+
CR
;
}
public
void
sendControlAck
()
{
command
=
"AT*CTRL="
+
SEQ
+
",0"
;
continuance
=
false
;
}
public
int
getSpeed
()
{
return
(
int
)
(
speed
*
100
);
}
public
void
disableAutomaticVideoBitrate
()
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
video:bitrate_ctrl_mode
\"
,
\"
0
\"
"
;
continuance
=
false
;
}
public
void
setMaxAltitude
(
int
altitude
)
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
control:altitude_max
\"
,
\"
"
+
altitude
+
"
\"
"
;
continuance
=
false
;
}
public
void
setMinAltitude
(
int
altitude
)
{
command
=
"AT*CONFIG="
+
SEQ
+
",
\"
control:altitude_min
\"
,
\"
"
+
altitude
+
"
\"
"
;
continuance
=
false
;
}
/*
*
*/
public
void
move3D
(
int
speedX
,
int
speedY
,
int
speedZ
,
int
speedSpin
)
{
if
(
speedX
>
100
)
speedX
=
100
;
else
if
(
speedX
<
-
100
)
speedX
=
-
100
;
if
(
speedY
>
100
)
speedY
=
100
;
else
if
(
speedY
<
-
100
)
speedY
=
-
100
;
if
(
speedZ
>
100
)
speedZ
=
100
;
else
if
(
speedZ
<
-
100
)
speedZ
=
-
100
;
command
=
"AT*PCMD="
+
SEQ
+
",1,"
+
intOfFloat
(-
speedY
/
100.0f
)
+
","
+
intOfFloat
(-
speedX
/
100.0f
)
+
","
+
intOfFloat
(-
speedZ
/
100.0f
)
+
","
+
intOfFloat
(-
speedSpin
/
100.0f
)
+
"
\r
"
+
"AT*REF="
+
SEQ
+
",290718208"
;
continuance
=
true
;
}
@
Override
public
void
run
()
{
initializeDrone
();
while
(
true
)
{
if
(
this
.
command
!= null) {
//
sendCommand
();
sendCommand
(
this
.
command
);
if
(
!continuance) {
command
=
null
;
}
}
else
{
if
(
landing
)
{
sendCommand
(
"AT*PCMD="
+
SEQ
+
",1,0,0,0,0"
+
CR
+
"AT*REF="
+
SEQ
+
",290717696"
);
}
else
{
sendCommand
(
"AT*PCMD="
+
SEQ
+
",1,0,0,0,0"
+
CR
+
"AT*REF="
+
SEQ
+
",290718208"
);
}
}
try
{
Thread
.
sleep
(
20
);
//
<
50
ms
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
if
(
seq
%
5
==
0
)
{
//
<
2000
ms
sendCommand
(
"AT*COMWDG="
+
SEQ
);
}
}
}
protected
abstract
void
initializeDrone
();
/*
*
private
void
initializeDrone
()
{
sendCommand
(
"AT*CONFIG="
+
SEQ
+
*
",
\"
general:navdata_demo
\"
,
\"
TRUE
\"
"
+
CR
+
"AT*FTRIM="
+
SEQ
);
//
1
*
sendCommand
(
"AT*PMODE="
+
SEQ
+
",2"
+
CR
+
"AT*MISC="
+
SEQ
+
*
",2,20,2000,3000"
+
CR
+
"AT*FTRIM="
+
SEQ
+
CR
+
"AT*REF="
+
SEQ
+
*
",290717696"
);
//
2
-
5
sendCommand
(
"AT*PCMD="
+
SEQ
+
",1,0,0,0,0"
+
CR
+
*
"AT*REF="
+
SEQ
+
",290717696"
+
CR
+
"AT*COMWDG="
+
SEQ
);
//
6
-
8
*
sendCommand
(
"AT*PCMD="
+
SEQ
+
",1,0,0,0,0"
+
CR
+
"AT*REF="
+
SEQ
+
*
",290717696"
+
CR
+
"AT*COMWDG="
+
SEQ
);
//
6
-
8
sendCommand
(
"AT*FTRIM="
+
*
SEQ
);
//
System
.
out
.
println
(
"Initialize completed!"
);
}
*/
/*
*
Thank
you
Dirk
!!
*/
protected
synchronized
void
sendCommand
(
String
command
)
{
int
seqIndex
=
-
1
;
while
((
seqIndex
=
command
.
indexOf
(
SEQ
))
!= -1)
command
=
command
.
substring
(
0
,
seqIndex
)
+
(
seq
++)
+
command
.
substring
(
seqIndex
+
SEQ
.
length
());
byte
[]
buffer
=
(
command
+
CR
).
getBytes
();
//
System
.
out
.
println
(
command
);
DatagramPacket
packet
=
new
DatagramPacket
(
buffer
,
buffer
.
length
,
inetaddr
,
ARDroneConstants
.
PORT
);
try
{
socket
.
send
(
packet
);
//
Thread
.
sleep
(
20
);
//
<
50
ms
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
/*
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}*/
}
private
int
intOfFloat
(
float
f
)
{
fb
.
put
(
0
,
f
);
return
ib
.
get
(
0
);
}
}
src/com/shigeodayo/ardrone/video/BufferedVideoImage.java~
deleted
100644 → 0
View file @
85a059f8
This diff is collapsed.
Click to expand it.
src/com/shigeodayo/ardrone/video/ImageSlice.java~
deleted
100644 → 0
View file @
85a059f8
package
com
.
shigeodayo
.
ardrone
.
video
;
//
Copyright
©
2007
-
2011
,
PARROT
SA
,
all
rights
reserved
.
//
DISCLAIMER
//
The
APIs
is
provided
by
PARROT
and
contributors
"AS IS"
and
any
express
or
implied
warranties
,
including
,
but
not
limited
to
,
the
implied
warranties
of
merchantability
//
and
fitness
for
a
particular
purpose
are
disclaimed
.
In
no
event
shall
PARROT
and
contributors
be
liable
for
any
direct
,
indirect
,
incidental
,
special
,
exemplary
,
or
//
consequential
damages
(
including
,
but
not
limited
to
,
procurement
of
substitute
goods
or
services
;
loss
of
use
,
data
,
or
profits
;
or
business
interruption
)
however
//
caused
and
on
any
theory
of
liability
,
whether
in
contract
,
strict
liability
,
or
tort
(
including
negligence
or
otherwise
)
arising
in
any
way
out
of
the
use
of
this
//
software
,
even
if
advised
of
the
possibility
of
such
damage
.
//
Author
:
Daniel
Schmidt
//
Publishing
date
:
2010
-
01
-
06
//
based
on
work
by
:
Wilke
Jansoone
//
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
modification
,
are
permitted
provided
that
the
following
conditions
//
are
met
:
//-
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
list
of
conditions
,
the
disclaimer
and
the
original
author
of
the
source
code
.
//-
Neither
the
name
of
the
PixVillage
Team
,
nor
the
names
of
its
contributors
may
be
used
to
endorse
or
promote
products
derived
from
this
software
without
//
specific
prior
written
permission
.
public
class
ImageSlice
{
MacroBlock
[]
MacroBlocks
;
ImageSlice
(
int
macroBlockCount
)
{
MacroBlocks
=
new
MacroBlock
[
macroBlockCount
];
for
(
int
index
=
0
;
index
<
macroBlockCount
;
index
++)
{
MacroBlocks
[
index
]
=
new
MacroBlock
();
}
}
}
\ No newline at end of file
src/com/shigeodayo/ardrone/video/MacroBlock.java~
deleted
100644 → 0
View file @
85a059f8
package
com
.
shigeodayo
.
ardrone
.
video
;
//
Copyright
©
2007
-
2011
,
PARROT
SA
,
all
rights
reserved
.
//
DISCLAIMER
//
The
APIs
is
provided
by
PARROT
and
contributors
"AS IS"
and
any
express
or
implied
warranties
,
including
,
but
not
limited
to
,
the
implied
warranties
of
merchantability
//
and
fitness
for
a
particular
purpose
are
disclaimed
.
In
no
event
shall
PARROT
and
contributors
be
liable
for
any
direct
,
indirect
,
incidental
,
special
,
exemplary
,
or
//
consequential
damages
(
including
,
but
not
limited
to
,
procurement
of
substitute
goods
or
services
;
loss
of
use
,
data
,
or
profits
;
or
business
interruption
)
however
//
caused
and
on
any
theory
of
liability
,
whether
in
contract
,
strict
liability
,
or
tort
(
including
negligence
or
otherwise
)
arising
in
any
way
out
of
the
use
of
this
//
software
,
even
if
advised
of
the
possibility
of
such
damage
.
//
Author
:
Daniel
Schmidt
//
Publishing
date
:
2010
-
01
-
06
//
based
on
work
by
:
Wilke
Jansoone
//
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
modification
,
are
permitted
provided
that
the
following
conditions
//
are
met
:
//-
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
list
of
conditions
,
the
disclaimer
and
the
original
author
of
the
source
code
.
//-
Neither
the
name
of
the
PixVillage
Team
,
nor
the
names
of
its
contributors
may
be
used
to
endorse
or
promote
products
derived
from
this
software
without
//
specific
prior
written
permission
.
public
class
MacroBlock
{
//
/#//#
region
ants
//
private
int
_BlockWidth
=
8
;
//
private
int
_BlockSize
=
64
;
//
//#
endregion
//
//#
region
Properties
short
[][]
DataBlocks
;
//
//#
endregion
//
//#
region
ruction
MacroBlock
()
{
DataBlocks
=
new
short
[
6
][];
for
(
int
index
=
0
;
index
<
6
;
index
++)
{
DataBlocks
[
index
]
=
new
short
[
64
];
}
}
//
//#
endregion
}
\ No newline at end of file
src/com/shigeodayo/ardrone/video/PictureFormats.java~
deleted
100644 → 0
View file @
85a059f8
package
com
.
shigeodayo
.
ardrone
.
video
;
//
DISCLAIMER
//
The
APIs
is
provided
by
PARROT
and
contributors
"AS IS"
and
any
express
or
implied
warranties
,
including
,
but
not
limited
to
,
the
implied
warranties
of
merchantability
//
and
fitness
for
a
particular
purpose
are
disclaimed
.
In
no
event
shall
PARROT
and
contributors
be
liable
for
any
direct
,
indirect
,
incidental
,
special
,
exemplary
,
or
//
consequential
damages
(
including
,
but
not
limited
to
,
procurement
of
substitute
goods
or
services
;
loss
of
use
,
data
,
or
profits
;
or
business
interruption
)
however
//
caused
and
on
any
theory
of
liability
,
whether
in
contract
,
strict
liability
,
or
tort
(
including
negligence
or
otherwise
)
arising
in
any
way
out
of
the
use
of
this
//
software
,
even
if
advised
of
the
possibility
of
such
damage
.
//
Author
:
Daniel
Schmidt
//
Publishing
date
:
2010
-
01
-
06
//
based
on
work
by
:
Wilke
Jansoone
//
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
modification
,
are
permitted
provided
that
the
following
conditions
//
are
met
:
//-
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
list
of
conditions
,
the
disclaimer
and
the
original
author
of
the
source
code
.
//-
Neither
the
name
of
the
PixVillage
Team
,
nor
the
names
of
its
contributors
may
be
used
to
endorse
or
promote
products
derived
from
this
software
without
//
specific
prior
written
permission
.
public
class
PictureFormats
{
//
/
<
summary
>
//
/
176
px
x
144
px
//
/
</
summary
>
public
static
final
int
Cif
=
1
;
//
/
<
summary
>
//
/
320
px
x
240
px
//
/
</
summary
>
public
static
final
int
Vga
=
2
;
}
src/com/shigeodayo/ardrone/video/ReadRawFileImage.java~
deleted
100644 → 0
View file @
85a059f8
//
DISCLAIMER
//
The
APIs
is
provided
by
PARROT
and
contributors
"AS IS"
and
any
express
or
implied
warranties
,
including
,
but
not
limited
to
,
the
implied
warranties
of
merchantability
//
and
fitness
for
a
particular
purpose
are
disclaimed
.
In
no
event
shall
PARROT
and
contributors
be
liable
for
any
direct
,
indirect
,
incidental
,
special
,
exemplary
,
or
//
consequential
damages
(
including
,
but
not
limited
to
,
procurement
of
substitute
goods
or
services
;
loss
of
use
,
data
,
or
profits
;
or
business
interruption
)
however
//
caused
and
on
any
theory
of
liability
,
whether
in
contract
,
strict
liability
,
or
tort
(
including
negligence
or
otherwise
)
arising
in
any
way
out
of
the
use
of
this
//
software
,
even
if
advised
of
the
possibility
of
such
damage
.
//
Author
:
Daniel
Schmidt
//
Publishing
date
:
2010
-
01
-
06
//
based
on
work
by
:
Wilke
Jansoone
//
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
modification
,
are
permitted
provided
that
the
following
conditions
//
are
met
:
//-
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
list
of
conditions
,
the
disclaimer
and
the
original
author
of
the
source
code
.
//-
Neither
the
name
of
the
PixVillage
Team
,
nor
the
names
of
its
contributors
may
be
used
to
endorse
or
promote
products
derived
from
this
software
without
//
specific
prior
written
permission
.
//
modified
:
Shigeo
Yoshida
,
2011
-
02
-
23
package
com
.
shigeodayo
.
ardrone
.
video
;
import
java
.
awt
.
image
.
BufferedImage
;
import
java
.
io
.
FileNotFoundException
;
import
java
.
io
.
IOException
;
import
java
.
nio
.
ByteBuffer
;
public
class
ReadRawFileImage
{
public
ReadRawFileImage
()
{
}
public
BufferedImage
readUINT_RGBImage
(
byte
[]
rawData
)
throws
FileNotFoundException
,
IOException
{
int
length
=
0
;
try
{
byte
[]
processedData
=
process
(
rawData
);
int
[]
pixelData
=
new
int
[
processedData
.
length
/
3
];
int
raw
,
pixel
=
0
,
j
=
0
;
for
(
int
i
=
0
;
i
<
pixelData
.
length
;
i
++)
{
pixel
=
0
;
raw
=
processedData
[
j
++]
&
0xFF
;
pixel
|=
(
raw
<<
16
);
raw
=
processedData
[
j
++]
&
0xFF
;
pixel
|=
(
raw
<<
8
);
raw
=
processedData
[
j
++]
&
0xFF
;
pixel
|=
(
raw
<<
0
);
pixelData
[
i
]
=
pixel
;
}
//
System
.
out
.
println
(
pixelData
.
length
);
length
=
pixelData
.
length
;
if
(
length
==
76800
)
{
BufferedImage
image
=
new
BufferedImage
(
320
,
240
,
BufferedImage
.
TYPE_INT_RGB
);
image
.
setRGB
(
0
,
0
,
320
,
240
,
pixelData
,
0
,
320
);
return
image
;
}
else
if
(
length
==
25344
)
{
BufferedImage
image
=
new
BufferedImage
(
176
,
144
,
BufferedImage
.
TYPE_INT_RGB
);
image
.
setRGB
(
0
,
0
,
176
,
144
,
pixelData
,
0
,
176
);
return
image
;
}
/*
*
BufferedImage
image
=
new
BufferedImage
(
640
,
480
,
*
BufferedImage
.
TYPE_INT_RGB
);
*
*
image
.
setRGB
(
0
,
0
,
640
,
480
,
pixelData
,
0
,
480
);
*/
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
e
.
printStackTrace
();
//
System
.
out
.
println
(
length
);
}
return
null
;
}
private
byte
[]
process
(
final
byte
[]
rawData
)
{
final
BufferedVideoImage
image
=
new
BufferedVideoImage
();
image
.
AddImageStream
(
ByteBuffer
.
wrap
(
rawData
));
final
uint
[]
outData
=
image
.
getPixelData
();
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
outData
.
length
*
3
);
for
(
int
i
=
0
;
i
<
outData
.
length
;
i
++)
{
int
myInt
=
outData
[
i
].
intValue
();
buffer
.
put
((
byte
)
((
myInt
>>
16
)
&
0xFF
));
buffer
.
put
((
byte
)
((
myInt
>>
8
)
&
0xFF
));
buffer
.
put
((
byte
)
(
myInt
&
0xFF
));
}
return
buffer
.
array
();
}
}
src/com/shigeodayo/ardrone/video/VideoImage.java~
deleted
100644 → 0
View file @
85a059f8
This diff is collapsed.
Click to expand it.
src/com/shigeodayo/ardrone/video/uint.java~
deleted
100644 → 0
View file @
85a059f8
package
com
.
shigeodayo
.
ardrone
.
video
;
import
java
.
io
.
ByteArrayInputStream
;
//
import
java
.
io
.
ByteArrayOutputStream
;
import
java
.
io
.
DataInputStream
;
//
import
java
.
io
.
DataOutputStream
;
import
java
.
nio
.
ByteBuffer
;
//
import
java
.
security
.
AllPermission
;
//
DISCLAIMER
//
The
APIs
is
provided
by
PARROT
and
contributors
"AS IS"
and
any
express
or
implied
warranties
,
including
,
but
not
limited
to
,
the
implied
warranties
of
merchantability
//
and
fitness
for
a
particular
purpose
are
disclaimed
.
In
no
event
shall
PARROT
and
contributors
be
liable
for
any
direct
,
indirect
,
incidental
,
special
,
exemplary
,
or
//
consequential
damages
(
including
,
but
not
limited
to
,
procurement
of
substitute
goods
or
services
;
loss
of
use
,
data
,
or
profits
;
or
business
interruption
)
however
//
caused
and
on
any
theory
of
liability
,
whether
in
contract
,
strict
liability
,
or
tort
(
including
negligence
or
otherwise
)
arising
in
any
way
out
of
the
use
of
this
//
software
,
even
if
advised
of
the
possibility
of
such
damage
.
//
Author
:
Daniel
Schmidt
//
Publishing
date
:
2010
-
01
-
06
//
based
on
work
by
:
Wilke
Jansoone
//
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
modification
,
are
permitted
provided
that
the
following
conditions
//
are
met
:
//-
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
list
of
conditions
,
the
disclaimer
and
the
original
author
of
the
source
code
.
//-
Neither
the
name
of
the
PixVillage
Team
,
nor
the
names
of
its
contributors
may
be
used
to
endorse
or
promote
products
derived
from
this
software
without
//
specific
prior
written
permission
.
public
class
uint
{
public
String
toString
()
{
return
Integer
.
toString
(
base2
,
2
);
}
public
uint
(
int
base
)
{
this
.
base2
=
base
;
}
public
uint
(
uint
that
)
{
this
.
base2
=
that
.
base2
;
}
public
uint
(
byte
[]
bp
,
int
start
)
{
try
{
byte
[]
b
=
new
byte
[
4
];
b
[
0
]
=
bp
[
start
+
3
];
b
[
1
]
=
bp
[
start
+
2
];
b
[
2
]
=
bp
[
start
+
1
];
b
[
3
]
=
bp
[
start
+
0
];
ByteArrayInputStream
bas
=
new
ByteArrayInputStream
(
b
);
DataInputStream
din
=
new
DataInputStream
(
bas
);
this
.
base2
=
din
.
readInt
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"error creating uint"
,
e
);
}
}
public
uint
(
ByteBuffer
bp
,
int
start
)
{
try
{
ByteBuffer
bb
=
ByteBuffer
.
allocate
(
4
);
bb
.
put
(
bp
.
array
()[
start
+
3
]);
bb
.
put
(
bp
.
array
()[
start
+
2
]);
bb
.
put
(
bp
.
array
()[
start
+
1
]);
bb
.
put
(
bp
.
array
()[
start
+
0
]);
bb
.
flip
();
this
.
base2
=
bb
.
getInt
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"error creating uint"
,
e
);
}
}
private
int
base2
;
public
short
times
(
short
i
)
{
return
(
short
)
(
intValue
()
*
i
);
}
public
uint
shiftRight
(
int
i
)
{
//
System
.
out
.
println
(
"shiftRight[0] "
+
base2
+
" "
+
i
);
//
String
str
=
Integer
.
toBinaryString
(
base
);
int
base
=
base2
;
//
System
.
out
.
println
(
"shiftRight[n][1] "
+
uint
.
toBinaryString
(
base
));
base
=
base
>>>
i
;
//
System
.
out
.
println
(
"shiftRight[n][2] "
+
uint
.
toBinaryString
(
base
));
return
new
uint
(
base
);
}
public
uint
shiftLeft
(
int
i
)
{
int
base
=
base2
;
base
<<=
i
;
return
new
uint
(
base
);
//
return
Integer
.
parseInt
(
base
,
2
);
}
public
int
flipBits
()
{
int
base
=
~
base2
;
return
base
;
}
public
int
intValue
()
{
return
base2
;
}
public
uint
and
(
int
andval
)
{
int
retval
=
base2
&
andval
;
return
new
uint
(
retval
);
}
public
void
shiftLeftEquals
(
int
i
)
{
int
base
=
base2
;
base
<<=
i
;
base2
=
base
;
}
public
void
shiftRightEquals
(
int
i
)
{
int
base
=
base2
;
base
>>>=
i
;
base2
=
base
;
}
public
uint
or
(
uint
orval
)
{
int
retval
=
base2
|
orval
.
base2
;
return
new
uint
(
retval
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment