Контрольная работа: Роботизированный беспилотный транспорт

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

country_code=RU

hw_mode=g

channel=1

beacon_int=100

dtim_period=2

max_num_sta=255

rts_threshold=2346

fragm_threshold=2346

macaddr_acl=0

auth_algs=1

idnore_broadcast_ssid=0

wmm_enabled=1

eap_server=0

own_ip_addr=127.0.0.1

wpa=2

wpa_passphrase=*********

wpa_pairwise=TKIP

rsn_pairwise=CCMP

СкриптзапускапроцессаMJPG-Streamer Daemonпризапускекомпьютера.

### BEGIN INIT INFO

# Provides: MJPG-streamer

# Required-Start: $network $remote_fs $syslog

# Required-Stop: $network $remote_fs $syslog

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Starts webcam over mjpeg streamer

### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

/lib/lsb/init-functions

DAEMON=/usr/local/mjpg-streamer/mjpg_streamer

test -x $DAEMON || exit 5

case $1 in

start)

log_daemon_msg "Starting MJPG-streamer" ""

/usr/local/mjpg-streamer/mjpg_streamer -i "/usr/local/mjpg-streamer/input_uvc.so -d /dev/video1 -f 12 " -o "/usr/local/mjpg-streamer/output_$

status=$?

log_end_msg $status

stop)

log_daemon_msg "Stopping MJPG-streamer" ""

killall /usr/local/mjpg-streamer/mjpg_streamer

log_end_msg $?

;;

restart|force-reload)

$0 stop && sleep 2 && $0 start

;;

try-restart)

if $0 status >/dev/null; then

$0 restart

else

exit 0

fi

;;

reload)

exit 3

;;

status)

status_of_proc $DAEMON "MJPG-streamer"

;;

*)

echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"

exit 2

;;

esac

Конфигурацииинтерфейсов.

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inetdhcp

auto lo wlan1

iface wlan1 inet static

hostapd /etc/hostapd/hostapd.conf

address 192.168.0.1

netmask 255.255.255.0

#auto lo wlan0

#iface wlan0 inet static

# address 192.168.1.1

# netmask 255.255.255.255

post-up /etc/nat

Реализация управления роботом с блока LegoNXT2.0.

task main() {

int power = 0, angle = 0;

nMotorEncoder[motorA] = 0;

while (true) {

if (SensorValue[S1] == 1)

power += power < 100 ? 5 : 0;

else

if (SensorValue[S2] == 1)

power -= power > -100 ? 5 : 0;

else

power = 0;

angle = nMotorEncoder[motorA] / 2;

if (angle > 45) angle = 45;

if (angle < -45) angle = -45;

sendMessageWithParm(power, angle);

nxtDisplayCentredTextLine(3, "%d %d", power, angle);

}

}

Программа для блока, который установленный на роботе и принимает сигналы управляющего блока LegoNXT2.0.

#define L 100

#define H 100

void move(int power) {

motor[motorD] = power;

motor[motorE] = power;

}

voidmoveWheel(int angle) {

int a = abs(angle);

float A = a * PI / 360;

float B = atan(L * tan(A) / (L - H * tan(B)));

int b = (int) (B / PI * 360);

if (angle < 0) {

servo[servo1] = 90 + a;

servo[servo2] = 90 + b;

} else {

servo[servo1] = 90 - a;

servo[servo1] = 90 - b;

}

}

task main() {

while (true) {

while (bQueuedMsgAvailable()) {

word temp;

ClearMessage();

temp = message;

}

if (message == 0) {

wait1Msec(5);

continue;

power = messageWithParm[0];

angle = messageWithParm[1];

move(power);

moveWheel(angle);

nxtDisplayCentredTextLine(3, "%d %d", power, angle);

wait1Msec(100);