cam nul added - to let the camera look forward by pressing a button
This commit is contained in:
parent
a6429d3b76
commit
a81f7afcf9
|
@ -29,7 +29,7 @@
|
|||
<stdio.h>
|
||||
<inttypes.h>
|
||||
|
||||
1392499886 source:/home/chch/HengLongUDPclient/main.c
|
||||
1394056611 source:/home/chch/HengLongUDPclient/main.c
|
||||
<pthread.h>
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
@ -51,13 +51,14 @@
|
|||
<inttypes.h>
|
||||
"henglong.h"
|
||||
<linux/joystick.h>
|
||||
"wansview.h"
|
||||
|
||||
1392494240 /home/chch/HengLongUDPclient/henglong.h
|
||||
1393293088 /home/chch/HengLongUDPclient/henglong.h
|
||||
<linux/input.h>
|
||||
<stdio.h>
|
||||
<inttypes.h>
|
||||
|
||||
1392494235 source:/home/chch/HengLongUDPclient/henglong.c
|
||||
1393293088 source:/home/chch/HengLongUDPclient/henglong.c
|
||||
"henglong.h"
|
||||
|
||||
1393274981 source:/home/stefan/Proj/HengLongUDPclient/henglong.c
|
||||
|
@ -101,3 +102,13 @@
|
|||
1393290504 source:/home/stefan/Proj/HengLongUDPclient/wansview.c
|
||||
"wansview.h"
|
||||
|
||||
1394056760 /home/chch/HengLongUDPclient/wansview.h
|
||||
<stdio.h>
|
||||
<string.h>
|
||||
<unistd.h>
|
||||
<arpa/inet.h>
|
||||
<sys/time.h>
|
||||
|
||||
1394060723 source:/home/chch/HengLongUDPclient/wansview.c
|
||||
"wansview.h"
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ JOYSTICK /dev/input/js0
|
|||
CAM 192.168.1.23
|
||||
CAMINTERVAL 100000
|
||||
FRAME_US 100000
|
||||
SERVER 10.8.245.47:32000
|
||||
SERVER 192.168.1.18:32000
|
||||
TIMEOUT 250
|
||||
CLINBR 0
|
||||
|
|
23
main.c
23
main.c
|
@ -89,19 +89,6 @@ void *keyboard_thread_fcn(void * arg)
|
|||
args->outtty.motor_r = (2*0b01111 - args->hl.velocity - args->hl.direction)*40;
|
||||
args->outtty.motor_l = (- args->hl.velocity + args->hl.direction)*40;
|
||||
|
||||
/*
|
||||
args->outtty.servo_pan += args->hl.pan_left - args->hl.pan_right;
|
||||
if(args->outtty.servo_pan>50) args->outtty.servo_pan = 50;
|
||||
if(args->outtty.servo_pan<-50) args->outtty.servo_pan = -50;
|
||||
if(args->outtty.servo_tilt>50) args->outtty.servo_tilt = 50;
|
||||
if(args->outtty.servo_tilt<-50) args->outtty.servo_tilt = -50;
|
||||
args->outtty.servo_tilt += args->hl.tilt_up - args->hl.tilt_down;
|
||||
if(args->hl.ignation) {
|
||||
args->outtty.servo_pan = 0;
|
||||
args->outtty.servo_tilt= 0;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
// quit
|
||||
|
@ -335,7 +322,7 @@ henglongconf_t getconfig(char* conffilename)
|
|||
typedef struct cam_ctrl_thread_t
|
||||
{
|
||||
char* ip;
|
||||
int up, down, cw, ccw, end;
|
||||
int up, down, cw, ccw, nul, end;
|
||||
uint32_t caminterval;
|
||||
} cam_ctrl_thread_t;
|
||||
|
||||
|
@ -354,6 +341,10 @@ void *cam_ctrl_thread_fcn(void* arg)
|
|||
if(args->down) cam_down(args->ip);
|
||||
if(args->cw) cam_cw(args->ip);
|
||||
if(args->ccw) cam_ccw(args->ip);
|
||||
if(args->nul) {
|
||||
cam_nul(args->ip);
|
||||
args->nul = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_exit(0);
|
||||
|
@ -363,8 +354,6 @@ void *cam_ctrl_thread_fcn(void* arg)
|
|||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
|
||||
|
||||
pthread_t keybthread, joythread, refl_thread, cam_ctrl_thread;
|
||||
input_thread_t keyboard_thread_args;
|
||||
input_thread_t joystick_thread_args;
|
||||
|
@ -434,6 +423,7 @@ int main(int argc, char* argv[])
|
|||
frame_nbr = 0;
|
||||
senddata.outtty.servo_pan = 0;
|
||||
senddata.outtty.servo_tilt = 0;
|
||||
cam_ctrl_thread_args.nul = 1;
|
||||
while(1){
|
||||
usleep(conf.frame_us);
|
||||
|
||||
|
@ -485,6 +475,7 @@ int main(int argc, char* argv[])
|
|||
if(keyboard_thread_args.hl.ignation | joystick_thread_args.hl.ignation){
|
||||
senddata.outtty.servo_pan = 0;
|
||||
senddata.outtty.servo_tilt = 0;
|
||||
cam_ctrl_thread_args.nul = 1;
|
||||
}
|
||||
|
||||
if(1022<senddata.outtty.motor_l) senddata.outtty.motor_l = 1023;
|
||||
|
|
Binary file not shown.
BIN
obj/Debug/main.o
BIN
obj/Debug/main.o
Binary file not shown.
Binary file not shown.
20
wansview.c
20
wansview.c
|
@ -69,3 +69,23 @@ int cam_ccw(char* ip)
|
|||
{
|
||||
return wvcamctrl(ip, 6);
|
||||
}
|
||||
|
||||
|
||||
int cam_nul(char* ip)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<20;i++){
|
||||
usleep(300000);
|
||||
cam_down(ip);
|
||||
}
|
||||
for(i=0;i<80;i++){
|
||||
|
||||
usleep(300000);
|
||||
cam_ccw(ip);
|
||||
}
|
||||
for(i=0;i<40;i++){
|
||||
usleep(300000);
|
||||
cam_cw(ip);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
int wvcamctrl(char* ip, int cmd);
|
||||
|
@ -13,5 +14,6 @@ int cam_down(char* ip);
|
|||
int cam_up(char* ip);
|
||||
int cam_cw(char* ip);
|
||||
int cam_ccw(char* ip);
|
||||
int cam_nul(char* ip);
|
||||
|
||||
#endif // WANSVIEW_H_INCLUDED
|
||||
|
|
Loading…
Reference in New Issue