Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60947558
cellulounity.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 3, 13:28
Size
3 KB
Mime Type
text/x-c
Expires
Sun, May 5, 13:28 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17443918
Attached To
R9807 cellulo-lua
cellulounity.cpp
View Options
#include "cellulounity.h"
#include "cellulothread.h"
#include "cellulorobotwrapper.h"
#include <QDebug>
CelluloThread
*
thread
=
nullptr
;
int64_t
newRobot
()
{
// TODO: use a less ugly way of creating thread (call at library loading)
if
(
thread
==
nullptr
)
{
thread
=
new
CelluloThread
;
thread
->
start
();
}
CelluloRobotWrapper
*
robot
=
new
CelluloRobotWrapper
();
robot
->
moveToThread
(
thread
);
robot
->
init
();
// TODO: use something less ugly than that
return
(
int64_t
)
robot
;
}
// TODO: check if *robot is actually a robot object
void
setLocalAdapterMacAddr
(
int64_t
robot
,
const
char
*
localAdapterMacAddr
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setLocalAdapterMacAddr
(
localAdapterMacAddr
);
}
void
setAutoConnect
(
int64_t
robot
,
int64_t
autoConnect
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setAutoConnect
(
autoConnect
);
}
void
setMacAddr
(
int64_t
robot
,
const
char
*
macAddr
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setMacAddr
(
macAddr
);
}
void
connectToServer
(
int64_t
robot
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
connectToServer
();
}
void
setGoalVelocity
(
int64_t
robot
,
float
vx
,
float
vy
,
float
w
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setGoalVelocity
(
vx
,
vy
,
w
);
}
void
setGoalPose
(
int64_t
robot
,
float
x
,
float
y
,
float
theta
,
float
v
,
float
w
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setGoalPose
(
x
,
y
,
theta
,
v
,
w
);
}
void
setGoalPosition
(
int64_t
robot
,
float
x
,
float
y
,
float
v
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setGoalPosition
(
x
,
y
,
v
);
}
void
clearTracking
(
int64_t
robot
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
clearTracking
();
}
void
clearHapticFeedback
(
int64_t
robot
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
clearHapticFeedback
();
}
void
setVisualEffect
(
int64_t
robot
,
int64_t
effect
,
int64_t
r
,
int64_t
g
,
int64_t
b
,
int64_t
value
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setVisualEffect
(
effect
,
QColor
(
r
,
g
,
b
),
value
);
}
void
setCasualBackdriveAssistEnabled
(
int64_t
robot
,
int64_t
enabled
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setCasualBackdriveAssistEnabled
(
enabled
);
}
void
setHapticBackdriveAssist
(
int64_t
robot
,
float
xAssist
,
float
yAssist
,
float
thetaAssist
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
setHapticBackdriveAssist
(
xAssist
,
yAssist
,
thetaAssist
);
}
void
reset
(
int64_t
robot
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
reset
();
}
void
simpleVibrate
(
int64_t
robot
,
float
iX
,
float
iY
,
float
iTheta
,
int64_t
period
,
int64_t
duration
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
simpleVibrate
(
iX
,
iY
,
iTheta
,
period
,
duration
);
}
float
getX
(
int64_t
robot
)
{
return
((
CelluloRobotWrapper
*
)
robot
)
->
robot
->
getX
();
}
float
getY
(
int64_t
robot
)
{
return
((
CelluloRobotWrapper
*
)
robot
)
->
robot
->
getY
();
}
float
getTheta
(
int64_t
robot
)
{
return
((
CelluloRobotWrapper
*
)
robot
)
->
robot
->
getTheta
();
}
int64_t
getKidnapped
(
int64_t
robot
)
{
return
((
CelluloRobotWrapper
*
)
robot
)
->
robot
->
getKidnapped
();
}
void
destroyRobot
(
int64_t
robot
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
deinit
();
}
int64_t
getConnectionStatus
(
int64_t
robot
)
{
return
((
CelluloRobotWrapper
*
)
robot
)
->
robot
->
getConnectionStatus
();
}
void
setKidnappedCallback
(
int64_t
robot
,
callback_t
callback
)
{
((
CelluloRobotWrapper
*
)
robot
)
->
kidnappedCallback
=
callback
;
}
Event Timeline
Log In to Comment