View: 3103|Reply: 5

Robot Kit PiCar-B - Software Queries

[Copy link]

1

Threads

3

Posts

13

Credits

Newbie

Rank: 1

Credits
13
Post time 2019-2-11 22:12:08 | Show all posts |Read mode
I have assembled this robot kit but it is not behaving as expected when I use the bundled software. For example, the controls for moving the camera left and right and up and down cause the opposite to happen, i.e. the left button causes the camera to move right.

I have looked at the mechanical setup and it seems to be okay. Note: I could still be wrong about this.

I started looking at the bundled software and a few things don't make sense to me. The servo motors in this kit are these

http://www.ee.ic.ac.uk/pcheung/t ... /sg90_datasheet.pdf

so a 1msec pulse = full left, 1.5msec = middle and 2.0msec = full right, based on a 50Hz period.

The first thing is that the PWM frequency which is set in the file turn.py is set to 60 which does not look to be correct?

Also, the logic of the turn left and turn right commands as shown below looks to be the opposite of what I would expect. To turn further left, it looks like the duration of the pulse is increased up to a maximum value. Based on the spec above, I would be expecting this to be the other way around?

        elif 'l_le' in data:                   #Camera look left
            if hoz_mid< look_left_max:
                hoz_mid+=turn_speed
            turn.ultra_turn(hoz_mid)
            tcpCliSock.send('7'.encode())

        elif 'l_ri' in data:                   #Camera look right
            if hoz_mid> look_right_max:
                hoz_mid-=turn_speed
            turn.ultra_turn(hoz_mid)
            tcpCliSock.send('8'.encode())

Reply

Use magic Report

0

Threads

5

Posts

39

Credits

Newbie

Rank: 1

Credits
39
Post time 2019-2-12 15:35:31 | Show all posts
Hello,
if the commands are opposite of what you expect, you can simply replace 'l_le' and 'l_ri' as below
        elif 'l_ri' in data:                   #Camera look left
            if hoz_mid< look_left_max:
                hoz_mid+=turn_speed
            turn.ultra_turn(hoz_mid)
            tcpCliSock.send('7'.encode())

        elif 'l_le' in data:                   #Camera look right
            if hoz_mid> look_right_max:
                hoz_mid-=turn_speed
            turn.ultra_turn(hoz_mid)
            tcpCliSock.send('8'.encode())


you can change PWM frequency to 50, but remenber to reset the default PWM so the camera would look forward

thanks
Reply

Use magic Report

1

Threads

5

Posts

53

Credits

Registered member

Rank: 2

Credits
53
Post time 2019-4-5 06:45:57 | Show all posts
Edited by Dr Pelforth at 2019-4-5 10:39 PM

Hi
Same for me, every single command get the reverse response from the 4 motors. Rear wheels, front wheels, head up/down, head right-left. First I switched the constant values in the motor.py file:
Dir_forward = 1
Dir_backward = 0
Reply

Use magic Report

1

Threads

13

Posts

49

Credits

Newbie

Rank: 1

Credits
49
Post time 2020-2-5 12:37:07 | Show all posts
yes, i found same problem, EVERYTHING is backwards, you can either reverse the battery connection, or fix it in code
Reply

Use magic Report

23

Threads

223

Posts

814

Credits

Senior member

Rank: 4

Credits
814
Post time 2021-2-7 17:41:37 | Show all posts
cangaceiro replied at 2019-4-5 06:45 AM
Hi
Same for me, every single command get the reverse response from the 4 motors. Rear wheels, front  ...

Your method is good
Reply

Use magic Report

23

Threads

223

Posts

814

Credits

Senior member

Rank: 4

Credits
814
Post time 2021-2-7 17:42:10 | Show all posts
1563743830 replied at 2020-2-5 12:37 PM
yes, i found same problem, EVERYTHING is backwards, you can either reverse the battery connection, o ...

Please provide us with a detailed problem report (including product model, problem picture, etc.): support@adeept.com
Reply

Use magic Report

You have to log in before you can reply Login | Sign Up

Points Rules