Browser Streaming Robot Example - Help


#1

Hello,

I am having a blast with the Streaming Robot Example
everything runs great, but I would like to change the code
so that I can control the servo motor also from the webpage.

While looking at the code I’m having trouble modifying anything because of inexperience. Can anyone help me out?

Thanks


#2

Hey dawizard, are you having trouble with the javascript interface or the python code behind it?


#3

Hey John,

Im guessing both just cant figure out where i can make another round controller on the webpage to control the servo with servo functions instead of motor control functions

could i just copy the motorcontroller file and then import the servo functions and use them in place of the motor functions

thanks for replying


#4

Hey,
There were 2 joysticks initially and we updated to the one Jostick code after that. If you have only one joystick available, then it might be easy to checkout to the last commit on March 19 (https://github.com/DexterInd/GoPiGo/blame/master/Software/Python/Examples/Browser%20Streaming%20Robot/www/index.html) which should enable 2 joysticks.

When you have 2 joysticks available, you can simple use one to control the GoPiGo and the other to control the servo.

Do let us know how it goes.

-Karan


#5

I’ve used Karan’s link to try this myself. I am very new to linux in general so i’m having some basic problems like figuring out how to modify the files in the GoPiGo directory using the custom gopigo image provided by the site.

I did however copy the original folder and create a new one just in the pi directory. I updated the index.html file with the one provided in your link above. I saw the code there for the pan function so i thought it was the right one. However, when I run the code to start the server it still uses (I was sure to reference the new directory) the web server files from the pi/Desktop/GoPiGo instead of the pi/GoPiGo2 directory I created. I will continue to pore over the other files used in this example to see what I am missing but any tips would be helpful.

Thank you.


#6

By comparing the difference, I found to make two joysticks available in the webpage, you just need to make the following change to the latest index.html file:
Change

<!–
<div class=“joystick” id=“pan_tilt_stick”>
<div class=“inner_circle”></div>
<div class=“handle”></div>
</div>
//–>

to be
<div class=“joystick” id=“pan_tilt_stick”>
<div class=“inner_circle”></div>
<div class=“handle”></div>
</div>

Simba


#7

Hey Simba,
Thanks a lot for sharing the information. Do share the project on the forums once you are done with it.

-Karan