Skip to content

Commit

Permalink
commented out custom zed related items
Browse files Browse the repository at this point in the history
  • Loading branch information
GarrettChristian committed Apr 15, 2021
1 parent 4e96c43 commit 86522e0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions cart_endpoints/launch/hardware_interface.launch
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
<node name="obstacle_detector" pkg="cart_endpoints" type="obstacle_detector.py" output="screen"/>
<node name="collision_detector" pkg="cart_planning" type="collision_detector.py" output="screen"/>
</group>
<include file="$(find video_stream_opencv)/launch/camera.launch">
<!--This is referring to the zed camera facing the passenger-->
<!-- <include file="$(find video_stream_opencv)/launch/camera.launch">
This is referring to the zed camera facing the passenger
<arg name = "camera_name" value="zed"/>
<arg name="video_stream_provider" value="/dev/v4l/by-id/usb-Leopard_ZED-video-index0
" />
<arg name="visualize" value="$(arg visualize_pose)" />
</include>
</include> -->
<include file="$(find video_stream_opencv)/launch/camera.launch">
<arg name="camera_name" value="front_facing"/>
<arg name="video_stream_provider" value="/dev/v4l/by-id/usb-Sonix_Technology_Co.__Ltd._H264_USB_Camera_SN0001-video-index0" />
Expand Down
58 changes: 29 additions & 29 deletions cart_endpoints/scripts/network_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,36 +191,36 @@ def status_update(data):
last_front_pub = -1
last_passenger_pub = -1

def passenger_image_callback(img_msg):
global last_passenger_pub
cur_time = time.time()
if cur_time > last_passenger_pub + 1:
bridge = CvBridge()
image_raw = np.frombuffer(img_msg.data, dtype=np.uint8)
image_raw.shape = (img_msg.height, img_msg.width, 3)
image_raw = bridge.imgmsg_to_cv2(img_msg, desired_encoding="mono8")
h,w = image_raw.shape[:2]
# Crop image and get the image width and height
cropped = image_raw[0:h, 0:672]
final_image = cv2.flip(cropped, -1)
dim = (400, 400)
f2 = cv2.resize(final_image, dim, interpolation=cv2.INTER_AREA)
retval, buffer = cv2.imencode('.jpg', f2)
send('passenger-video',base64.b64encode(buffer) )
last_passenger_pub = cur_time
# def passenger_image_callback(img_msg):
# global last_passenger_pub
# cur_time = time.time()
# if cur_time > last_passenger_pub + 1:
# bridge = CvBridge()
# image_raw = np.frombuffer(img_msg.data, dtype=np.uint8)
# image_raw.shape = (img_msg.height, img_msg.width, 3)
# image_raw = bridge.imgmsg_to_cv2(img_msg, desired_encoding="mono8")
# h,w = image_raw.shape[:2]
# # Crop image and get the image width and height
# cropped = image_raw[0:h, 0:672]
# final_image = cv2.flip(cropped, -1)
# dim = (400, 400)
# f2 = cv2.resize(final_image, dim, interpolation=cv2.INTER_AREA)
# retval, buffer = cv2.imencode('.jpg', f2)
# send('passenger-video',base64.b64encode(buffer) )
# last_passenger_pub = cur_time



def front_image_callback(img_msg):
global last_front_pub
cur_time = time.time()
if cur_time > last_front_pub + 1:
cur_time = time.time()
bridge = CvBridge()
image_raw = bridge.imgmsg_to_cv2(img_msg, desired_encoding="mono8")
retval, buffer = cv2.imencode('.jpg', image_raw)
send('cart-video', base64.b64encode(buffer))
last_front_pub = cur_time
# def front_image_callback(img_msg):
# global last_front_pub
# cur_time = time.time()
# if cur_time > last_front_pub + 1:
# cur_time = time.time()
# bridge = CvBridge()
# image_raw = bridge.imgmsg_to_cv2(img_msg, desired_encoding="mono8")
# retval, buffer = cv2.imencode('.jpg', image_raw)
# send('cart-video', base64.b64encode(buffer))
# last_front_pub = cur_time

def eta_callback(msg):
send('arrived-time', msg.data)
Expand All @@ -243,8 +243,8 @@ def eta_callback(msg):
safety_exit_pub = rospy.Publisher('/safety_exit', Bool, queue_size=10)


rospy.Subscriber('/zed/image_raw', Image, passenger_image_callback)
rospy.Subscriber('/front_facing/image_raw', Image, front_image_callback)
# rospy.Subscriber('/zed/image_raw', Image, passenger_image_callback)
# rospy.Subscriber('/front_facing/image_raw', Image, front_image_callback)
rospy.Subscriber('/current_position', Int8, send_position_index)
rospy.Subscriber('/vehicle_state', VehicleState, status_update)
rospy.Subscriber('/pullover', Bool, pullover_callback)
Expand Down

0 comments on commit 86522e0

Please sign in to comment.