Statistics: Posted by Alan — Wed Dec 10, 2014 9:50 pm
Statistics: Posted by DannyM — Wed Dec 10, 2014 6:39 pm
Statistics: Posted by Alan — Tue Dec 09, 2014 11:12 am
Connecting to ws://192.168.1.38:80/robot_control/websocket
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupport
ed array type) in unknown function, file C:\slave\WinInstallerMegaPack\src\openc
v\modules\core\src\array.cpp, line 2482
Traceback (most recent call last):
File "look180deg.py", line 50, in <module>
change_angle ( i, 1.0 )
File "look180deg.py", line 25, in change_angle
cv2.imshow( "image", latest_small_camera_image )
cv2.error: C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp:2
482: error: (-206) Unrecognized or unsupported array type
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python27\lib\multiprocessing\forking.py", line 373, in main
prepare(preparation_data)
File "c:\python27\lib\multiprocessing\forking.py", line 488, in prepare
'__parents_main__', file, path_name, etc
File "C:\opencv\examples\look180deg.py", line 43, in <module>
bot.start_streaming_small_camera_images()
NameError: name 'bot' is not defined
Statistics: Posted by DannyM — Mon Dec 08, 2014 6:25 pm
bot.start_streaming_small_camera_images()
# Run in a loop until i is 180deg
try:
for i in range( 10, 180, 10 ):
change_angle ( i, 1.0 )
bot.update()
latest_small_camera_image = bot.get_latest_small_camera_image()
cv2.imshow( "small_image", latest_small_camera_image )
cv2.waitKey( 1 )
except KeyboardInterrupt:
pass # Catch Ctrl+C
Statistics: Posted by Alan — Mon Dec 08, 2014 2:57 pm
#! /usr/bin/python
# This example shows how to use the websockets interface to make the robot move around
import time
import argparse
import py_websockets_bot
import cv2
latest_small_camera_image = None
i = 0
#---------------------------------------------------------------------------------------------------
def camera_small_image_callback( image, image_time ):
global latest_small_camera_image
# Put image processing here...
latest_small_camera_image = image
#---------------------------------------------------------------------------------------------------
def change_angle ( angle, angle_time ):
# global angle
bot.set_neck_angles( pan_angle_degrees=angle, tilt_angle_degrees=90.0 )
cv2.imshow( "image", latest_small_camera_image )
time.sleep( angle_time )
#---------------------------------------------------------------------------------------------------
if __name__ == "__main__":
# Set up a parser for command line arguments
parser = argparse.ArgumentParser( "Moves the robot around" )
parser.add_argument( "hostname", default="192.168.1.38", nargs='?', help="The ip address of the robot" )
args = parser.parse_args()
# Connect to the robot
bot = py_websockets_bot.WebsocketsBot( args.hostname )
# Drive forwards
bot.set_motor_speeds( 15.0, 15.0 )
time.sleep( 1.0 )
# Stop
bot.set_motor_speeds( 0.0, 0.0 )
time.sleep( 0.75 )
# Turn left
bot.set_motor_speeds( -15.0, 0.0 )
time.sleep( 1.25 )
# Stop
bot.set_motor_speeds( 0.0, 0.0 )
time.sleep( 0.75 )
# Drive forwards
bot.set_motor_speeds( 15.0, 15.0 )
time.sleep( 1.0 )
# Stop
bot.set_motor_speeds( 0.0, 0.0 )
time.sleep( 0.75 )
# Stop
bot.set_motor_speeds( 0.0, 0.0 )
time.sleep( 0.75 )
# Start streaming images from the camera
bot.start_streaming_small_camera_images( camera_small_image_callback )
# Run in a loop until i is 180deg
try:
for i in range( 10, 180, 10 ):
bot.update()
# if latest_small_camera_image != None:
#change_angle ( i, 1.0 )
cv2.imshow( "small_image", latest_small_camera_image )
cv2.waitKey( 1 )
except KeyboardInterrupt:
pass # Catch Ctrl+C
# Look right
# bot.set_neck_angles( pan_angle_degrees=180.0, tilt_angle_degrees=90.0 )
# time.sleep( 2.0 )
# Centre the neck
bot.centre_neck()
time.sleep( 1.0 )
# Disconnect from the robot
bot.disconnect()
# Look left
# bot.set_neck_angles( pan_angle_degrees=0.0, tilt_angle_degrees=90.0 )
# time.sleep( 2.0 )
# Start streaming images from the camera
# bot.start_streaming_camera_images( camera_image_callback )
# bot.start_streaming_small_camera_images( camera_small_image_callback )
# Run in a loop until the user presses Ctrl+C to quit
# try:
# while True:
# bot.update()
# if latest_camera_image != None:
# cv2.imshow( "image", latest_camera_image )
# if latest_small_camera_image != None:
# cv2.imshow( "small_image", latest_small_camera_image )
# cv2.waitKey( 1 )
# except KeyboardInterrupt:
# pass # Catch Ctrl+C
# Disconnect from the robot
# bot.disconnect()
Statistics: Posted by DannyM — Sun Dec 07, 2014 10:09 pm