This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AirSim: | |
| def on_start(self): | |
| self.alert("creating airsim user and running ssh.....", "INFO") | |
| # username and password for ssh | |
| os.environ["USERNAME"] = "airsim" | |
| os.environ["PASSWORD"] = "airsim1234" | |
| # Run the ssh-server | |
| os.system("(mkdir /home/$USERNAME && useradd $USERNAME && echo $USERNAME:$PASSWORD | chpasswd && usermod -aG sudo $USERNAME && chown airsim:airsim /home/airsim && usermod -d /home/airsim airsim && mkdir /var/run/sshd && /usr/sbin/sshd) &") | |
| # Download and Run AirSim Binary | |
| self.download_run_airsim() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AirSim: | |
| def download_run_airsim(self): | |
| # Environment variables to run AirSim headless | |
| os.environ["SDL_VIDEODRIVER_VALUE"] = "offscreen" | |
| os.environ['SDL_HINT_CUDA_DEVICE'] = "0" | |
| # AirSim Binaries List | |
| list_env = ["Blocks", "Africa", "Building_99", | |
| "Zhangjiajie", "Neighborhood", "SoccerField", "LandscapeMountains", "TrapCam"] | |
| # Let's get the selected environment from our block properities | |
| self.enviroment = list_env[self.get_property("env")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import subprocess | |
| import time | |
| import airsim | |
| from std_msgs.msg import Header | |
| import numpy as np | |
| from sensor_msgs.msg import PointCloud2 | |
| from geometry_msgs.msg import Point32 | |
| import sensor_msgs.point_cloud2 as pcl2 | |
| from yonoarc_utils.image import to_ndarray, from_ndarray |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from std_msgs.msg import Bool, Float64 | |
| from yonoarc_msgs.msg import ObjectBBoxArray | |
| import rospy | |
| import time | |
| class EB(): | |
| def __init__(self, node_name="eb_node"): | |
| rospy.init_node(node_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def on_new_messages(self, messages): | |
| ''' [Optional] Called according to the execution mode of the block. | |
| Parameters | |
| ---------- | |
| messages : dict | |
| A dictionary of the port keys and the values of the incoming messages. | |
| ''' | |
| bboxes = messages['bboxes'].bboxes #Bounding boxes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def on_new_messages(self, messages): | |
| if 'brake' in messages: | |
| print("Braking signal received...") | |
| print(messages['brake'].data) | |
| brake_action = messages['brake'].data | |
| if brake_action: | |
| self.cm.DVA_write(self.brake_quant, 1) | |
| else: | |
| self.cm.DVA_write(self.brake_quant, 0) | |
| if 'steer_sign' in messages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| (while sleep 2; do /opt/TurboVNC/bin/vncserver -geometry 1366x768 -securitytypes TLSNone,X509None,None :1; done & DISPLAY=":1" sh ~/.vnc/xstartup.turbovnc & cd /noVNC && ./utils/launch.sh --vnc localhost:5901) & (export DISPLAY=:1 ; ./opt/ipg/carmaker/linux64-8.1.1/bin/CM -cmdport 16660 | |
| ) & sleep infinity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| from pycarmaker import VDS | |
| # initalize VDS | |
| vds = VDS() | |
| # Connect | |
| vds.connect() | |
| # Read Images | |
| while(True): | |
| # Capture frame-by-frame |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nViews 1 | |
| # First camera | |
| 0 { | |
| Width 640 | |
| Height 480 | |
| Export {rgb} | |
| VPtOffset_x 3.1 | |
| VPtOffset_y 0 | |
| VPtOffset_z 1.1 | |
| FrameRate 25 |