Some more modifications to drive sender so things are a little smoother. Works well now. Changed update rates for control systems.

This commit is contained in:
2018-03-04 16:27:24 -08:00
parent add93b6b7f
commit 8b83e84677
6 changed files with 24 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ launch_dir_length_without_current_folder=$(($launch_dir_length-$current_folder_n
script_launch_path="${launch_dir:0:$launch_dir_length_without_current_folder}/src"
cd $script_launch_path
sleep 5
sleep 3
export DISPLAY=:0
python ground_station.py

View File

@@ -19,8 +19,8 @@ DEFAULT_DRIVE_COMMAND_TOPIC = "/rover_control/command_control/ground_station_dri
DRIVE_COMMAND_HERTZ = 15
Y_AXIS_DEADBAND = 0.025
X_AXIS_DEADBAND = 0.025
Y_AXIS_DEADBAND = 0.05
X_AXIS_DEADBAND = 0.05
THROTTLE_MIN = 0.05

View File

@@ -23,7 +23,7 @@ DEFAULT_RIGHT_BOGIE_TOPIC = "drive_control/right"
UINT16_MAX = 65535
DEFAULT_HERTZ = 20
DEFAULT_HERTZ = 30
WATCHDOG_TIMEOUT = 0.3
@@ -136,7 +136,7 @@ class DriveCoordinator(object):
def iris_drive_command_callback(self, drive_command):
self.drive_command_data["iris"]["message"] = drive_command
self.drive_command_data["iris"]["last_time"] = time()
self.drive_command_data["iris"]["last_time"] = time()
def ground_station_drive_command_callback(self, drive_command):
self.drive_command_data["ground_station"]["message"] = drive_command

View File

@@ -29,11 +29,13 @@ DEFAULT_DRIVE_CONTROL_STATUS_TOPIC = "drive_status/rear"
FIRST_MOTOR_ID = 1
SECOND_MOTOR_ID = 2
COMMUNICATIONS_TIMEOUT = 0.15 # Seconds
COMMUNICATIONS_TIMEOUT = 0.01 # Seconds
RX_DELAY = 0.01
TX_DELAY = 0.01
DEFAULT_HERTZ = 20
MODBUS_REGISTERS = {
"DIRECTION": 0,
"SPEED": 1,
@@ -71,6 +73,8 @@ class DriveControl(object):
self.drive_control_status_topic = rospy.get_param("~drive_control_status_topic", DEFAULT_DRIVE_CONTROL_STATUS_TOPIC)
self.wait_time = 1.0 / rospy.get_param("~hertz", DEFAULT_HERTZ)
self.first_motor = minimalmodbus.Instrument(self.port, FIRST_MOTOR_ID)
self.second_motor = minimalmodbus.Instrument(self.port, SECOND_MOTOR_ID)
self.__setup_minimalmodbus_for_485()
@@ -98,9 +102,18 @@ class DriveControl(object):
def run(self):
while not rospy.is_shutdown():
self.send_drive_control_message()
self.get_drive_status()
sleep(0.005)
start_time = time()
try:
self.send_drive_control_message()
self.get_drive_status()
except Exception, error:
print "Error occurred:", error
time_diff = time() - start_time
sleep(max(self.wait_time - time_diff, 0))
def send_drive_control_message(self):
if self.new_control_message:

View File

@@ -4,5 +4,5 @@
<include file="$(find rover_main)/launch/ground_station/topic_transport_receivers.launch"/>
<!-- ########## Start Ground Station Interface ########## -->
<node name="ground_station" pkg="ground_station" type="ground_station_launch.sh" output="screen"/>
<node name="ground_station" pkg="ground_station" type="ground_station_launch.sh" required="true" output="screen"/>
</launch>

View File

@@ -2,7 +2,7 @@
<group ns="rover_control">
<node name="iris_controller" pkg="rover_control" type="iris_controller.py" output="screen">
<param name="port" value="/dev/rover/ttyIRIS"/>
<param name="hertz" value="14"/>
<param name="hertz" value="20"/>
</node>
<node name="rear_bogie" pkg="rover_control" type="drive_control.py" output="screen">