Joysticks not working

Hi I have been attempting to use the browser streaming robot example. I used the GITHUB download on an existing image and ran the install. After reboot I discovered I needed to change the port and now have a nice visual through my camera. Also I am not using the GoPiGo actually, but an adafruit I2C to PWM hat, so I replaced all instances of GoPiGo in the robot_controller.py file with my adafruit call. Now I don’t seem to get anything from the on-screen joystick. I looked through the robot_controller.py and see a number of print statements that should be calling the GoPiGo script when the joystick is activated, but I never see those prints statements in the terminal, which would explain why the robot doesn’t move. So is there something wrong with the joystick code? Or perhaps my setup?

Thanks

I’ve done some more testing and it seems that the onmessage definition never runs. actually nothing but the update function appears to be running. I set the debug variable and added more print statements and nothing appears to be running except the camera feed and the update method… so how is this supposed to work again?

Are you using the GoPiGo? If you’re having trouble with the software, have you tried downloading our image?

I am using the software but not the hardware. I replaced the gopigo.py with my own for an adafruit hat I already had. I used git instead of the image, I’m curious why there would be a difference, the install.sh seemed to run ok… but I’ll try that next I guess.

Hey,
You basically use this script to run the code: https://github.com/DexterInd/GoPiGo/blob/master/Software/Python/Examples/Browser_Streaming_Robot/robot_web_server.py and you have to execute it from the terminal and not run with the python interpreter as mentioned in the readme to make it work. The values coming from the joystick on the browser are fed to another program: https://github.com/DexterInd/GoPiGo/blob/master/Software/Python/Examples/Browser_Streaming_Robot/robot_controller.py and handled by setMotorJoystickPos() and setNeckJoystickPos() . So you should be able to get it to work by changing these. But as John had mentioned earlier, we had fine tuned the settings a lot to make this work with our image, so it might be better if you could try it out on our image first.

-Karan

Thanks Karan. Yeah I just wasn’t getting anything from either of the set motor pos functions. Last night I finally found time to try the image. I noticed that everything is owned by root, so maybe it was permissions related? In whatever case, it’s working now :slight_smile: though I did still have to edit the directory path in robot_web_server.py to include underscores instead of spaces for the Browser_Streaming_Robot folder.

Thanks!