Connecting to the GoPiGo robot

Wifi Connection: First, connect to the WiFi router that we've set up specifically for communicating with the robots:

Connect to your robot: Then, use a browser (whichever's available on the laptop) to connect to your robot only!

Creating a directory for your team:

Connecting to the Python directory and to your team's directory:

Python Programming for the GoPiGo Robot

Testing the robot's Python functions:

Dexter Industries' Python Function page:

fwd() run the wheel motors forward
stop() stops the wheel motors
enable_com_timeout(timeout-time) Turn off robot's motors if no communication within timeout-time.
timeout-time is in milliseconds
enable_com_timeout(1500)  will turn off the motors if you don't communicate with the robot within 1.5 seconds
returns 1 on success, -1 on failure
volt() returns the voltage seen by the robot (12 volts with fresh batteries, lower after usage)
bwd() run the wheel motors backward
left() turn left
right() turn right
set_speed(the_speed) set wheel speeds (range: 0 - 255)
set_left_speed(left_speed) set left wheel speed (range: 0 - 255)
set_right_speed(right_speed) set right whell speed (range: 0 - 255)
increase_speed() increase speed by 10
decrease_speed() decrease speed by 0
enable_encoders() (enabled by default): the wheel encoders will be counting rotational steps (18 steps per complete revolution)
enc_read(motor) reads the current encoder number (how many steps the encoder has gone) since the last enc_tgt() (see below).  Motor number is either 0 or 1.
enc_tgt(motor1,motor2,target) Move robot until one of the motors has turned a "target" number of encoder steps (there are 18 steps per complete rotation).
If m1==1 then motor1 will step after "target" number of steps.  If m1==0, then motor1 will not be stopped by this command.
The same with motor2.
I think motor1 is the left motor, but you'll have to figure that out.
The encoders for both motors will be set to 0.
us_dist(15) return the distance (in centimeters) from the ultrasonic sensors to the obstacle in front of it
enabled_servo() enables the servo (the rotatable platform that the ultrasonic sensor is on).
servo(angle) rotate the servo to the desired angle (range: 0 - 180).  Suggestion from the manual: "This function moves the servo to the position that is given. You will have to manually add a very small delay when trying to do a servo sweep or when moving the servo because the servo moves much slower than the code so you will have to account for the delay."
trim_write(amount) Automatically drives one motor slightly faster than the other to compensate for physical differences between the motors (otherwise the robot will go slightly to the right or left).  -100 <= amount <= 100.   Set the trim through trial-and-error.

Details from the manual:
  • A trim value of 0 means that the left motor will run at the same speed as the right motor.
  • A trim value of 50 means that the left motor will run at the 150% the speed of the right motor and the GoPiGo will turn more towards the right. This can be used to compensate for the GoPiGo normally turning left when it is supposed to go right.
  • A trim value of -50 means that the left motor will run at the 50% the speed of the right motor and the GoPiGo will turn more towards the left. This can be used to compensate for the GoPiGo normally turning right when it is supposed to go left.
  • Start with small trim values in multiple of 5 and find out the value that works for you
  • Give w to move forward and x to stop to test the trim values