mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-08 10:11:14 +00:00
Got channels changing on the m2 radios over ssh with testing script. Adjusted some speed things for compass and arm.
This commit is contained in:
@@ -10,9 +10,9 @@ from time import time
|
||||
#####################################
|
||||
# Global Variables
|
||||
#####################################
|
||||
THREAD_HERTZ = 10
|
||||
THREAD_HERTZ = 2
|
||||
|
||||
ROTATION_SPEED_MODIFIER = 0.015
|
||||
ROTATION_SPEED_MODIFIER = 0.15
|
||||
|
||||
|
||||
#####################################
|
||||
|
||||
@@ -15,7 +15,7 @@ from random import random
|
||||
#####################################
|
||||
THREAD_HERTZ = 20
|
||||
|
||||
ROTATION_SPEED_MODIFIER = 1
|
||||
ROTATION_SPEED_MODIFIER = 2.5
|
||||
|
||||
|
||||
#####################################
|
||||
@@ -56,8 +56,9 @@ class SpeedAndHeadingIndication(QtCore.QThread):
|
||||
self.current_heading = 0
|
||||
self.current_heading_changed = True
|
||||
|
||||
self.shown_heading = (self.current_heading + 1) % 360
|
||||
self.shown_heading = (self.current_heading + (1.5 * ROTATION_SPEED_MODIFIER)) % 360
|
||||
self.current_heading_shown_rotation_angle = 0
|
||||
self.last_current_heading_shown = 0
|
||||
self.rotation_direction = 1
|
||||
|
||||
def run(self):
|
||||
@@ -77,13 +78,23 @@ class SpeedAndHeadingIndication(QtCore.QThread):
|
||||
self.msleep(max(int(self.wait_time - time_diff), 0))
|
||||
|
||||
def rotate_compass_if_needed(self):
|
||||
if int(self.shown_heading) != self.current_heading:
|
||||
heading_difference = abs(int(self.shown_heading) - self.current_heading)
|
||||
should_update = False
|
||||
|
||||
if heading_difference > ROTATION_SPEED_MODIFIER:
|
||||
self.shown_heading += self.rotation_direction * ROTATION_SPEED_MODIFIER
|
||||
self.shown_heading %= 360
|
||||
should_update = True
|
||||
elif heading_difference != 0:
|
||||
self.shown_heading = self.current_heading
|
||||
should_update = True
|
||||
|
||||
if should_update:
|
||||
self.current_heading_shown_rotation_angle = int(self.shown_heading)
|
||||
|
||||
if self.current_heading_shown_rotation_angle != self.last_current_heading_shown:
|
||||
new_compass_image = self.main_compass_image.rotate(self.current_heading_shown_rotation_angle, resample=PIL.Image.BICUBIC)
|
||||
self.last_current_heading_shown = self.current_heading_shown_rotation_angle
|
||||
|
||||
self.compass_pixmap = QtGui.QPixmap.fromImage(ImageQt(new_compass_image))
|
||||
self.show_compass_image__signal.emit()
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
{name: "/rover_status/camera_status", compress: true, rate: 1.0},
|
||||
{name: "/rover_status/frsky_status", compress: true, rate: 1.0},
|
||||
{name: "/rover_status/gps_status", compress: true, rate: 1.0},
|
||||
{name: "/rover_status/jetson_status", compress: true, rate: 0.2},
|
||||
{name: "/rover_status/jetson_status", compress: true, rate: 1.0},
|
||||
{name: "/rover_status/misc_status", compress: true, rate: 1.0}]
|
||||
</rosparam>
|
||||
</node>
|
||||
|
||||
54
software/testing/ubiradio_testing.py
Normal file
54
software/testing/ubiradio_testing.py
Normal file
@@ -0,0 +1,54 @@
|
||||
import paramiko
|
||||
import json
|
||||
from pprint import pprint
|
||||
|
||||
# ath0 21 channels in total; available frequencies :
|
||||
# Channel 01 : 2.412 GHz
|
||||
# Channel 31 : 2.414 GHz
|
||||
# Channel 02 : 2.417 GHz
|
||||
# Channel 32 : 2.419 GHz
|
||||
# Channel 03 : 2.422 GHz
|
||||
# Channel 33 : 2.424 GHz
|
||||
# Channel 04 : 2.427 GHz
|
||||
# Channel 34 : 2.429 GHz
|
||||
# Channel 05 : 2.432 GHz
|
||||
# Channel 35 : 2.434 GHz
|
||||
# Channel 06 : 2.437 GHz
|
||||
# Channel 36 : 2.439 GHz
|
||||
# Channel 07 : 2.442 GHz
|
||||
# Channel 37 : 2.444 GHz
|
||||
# Channel 08 : 2.447 GHz
|
||||
# Channel 38 : 2.449 GHz
|
||||
# Channel 09 : 2.452 GHz
|
||||
# Channel 39 : 2.454 GHz
|
||||
# Channel 10 : 2.457 GHz
|
||||
# Channel 40 : 2.459 GHz
|
||||
# Channel 11 : 2.462 GHz
|
||||
# Current Frequency:2.417 GHz (Channel 2)
|
||||
|
||||
# Sets: iwconfig ath0 channel 01
|
||||
# Gets: iwlist ath0 channel
|
||||
# NOTE
|
||||
# Only the access point has to get changed the station (client) will automatically choose the new freq
|
||||
|
||||
channel = 3
|
||||
|
||||
get_general_info = "wstalist"
|
||||
get_wireless_info = "iwlist ath0 channel"
|
||||
set_wireless_frequency = "iwconfig ath0 channel " + "%02d" % channel # iwconfig ath0 freq 2.456G
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy)
|
||||
|
||||
# Before anyone complains, I'm not worried about this password being online.
|
||||
# We only set one because the web interfaces HAVE to have one
|
||||
ssh.connect("192.168.1.20", username="ubnt", password="rover4lyfe^", compress=True)
|
||||
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(get_general_info)
|
||||
|
||||
pprint( json.loads(ssh_stdout.read()) )
|
||||
|
||||
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(set_wireless_frequency)
|
||||
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(get_wireless_info)
|
||||
|
||||
|
||||
print ssh_stdout.read()
|
||||
Reference in New Issue
Block a user