MistyCommunity / Wrapper-Python

Python library to work with your Misty robot. Currently in BETA. Supported by the community and not Misty Robotics.
MIT License
11 stars 20 forks source link

Misty2: Python wrapper: failing to connect #10

Open jhielson opened 1 year ago

jhielson commented 1 year ago

Hi,

I have been following the instructions but I cannot get the robot connected. When I use the same IP in my browser it works fine, I can access Misty Studio.

Traceback (most recent call last):
  File "/home/jhielson/ros_ws/src/misty_wrapper/src/example.py", line 5, in <module>
    misty = Robot("192.168.1.108") # This is the IP of my misty. Replace with your IP
  File "/home/jhielson/anaconda3/envs/mistyWrapper/lib/python3.9/site-packages/mistyPy/__init__.py", line 27, in __init__
    self.populateImages()
  File "/home/jhielson/anaconda3/envs/mistyWrapper/lib/python3.9/site-packages/mistyPy/__init__.py", line 93, in populateImages
    for out in reply["result"]:
TypeError: string indices must be integers
Kakcalu13 commented 6 months ago

ohhh lol i LITERALLY just fixed this.

prob too late but im sharing for everyone in future

the solution: def populateImages(self): self.images_saved = [] resp = requests.get('http://' + self.ip + '/api/images/list') new_data = resp.json() for get_name in new_data['result']: self.images_saved.append(get_name['name'])

the code was probably extremely outdated. I updated the code to latest