Please select Into the mobile phone version | Continue to access the computer ver.
Confirmed - you use math.sin() function to program wheel speeds
Uploading and Loding Picture ...(0/1)
o(^-^)o
MarkusXL
Second Officer
United States
Offline

This wee bit of sample code proves it.  You can use math.sin() and math.cos() to compute interesting wheel throttle curves.

from math import sin, radians

variable_X = 0
variable_T1 = 0
robot_ctrl.set_mode(rm_define.robot_mode_chassis_follow)
chassis_ctrl.move(0)

for variable_X in range(45, 90):
    variable_T1 = (1 + sin(radians(variable_X * 10)))
    chassis_ctrl.set_trans_speed(0.5 * variable_T1)
    time.sleep(0.1)


chassis_ctrl.move(0)

Result:  The S1 starts at speed zero then speeds up according to a sine function curve up to about .5 m/s then stops.

Now that we know that, we can maybe implement the mecanum wheels equations and come up with some interesting maneuvers:

https://www.roboteq.com/index.ph ... idirectional-robots

Whew, this ain't no kids stuff - this is going to be hard core math-to-Python coding to do what I have in mind, if I can even figure it out...


2019-7-27
Use props
DJI Stephen
Super Moderator

Offline

Hello and good day MarkusXL. Thank you for sharing this information with us and thank you for your valued support.
2019-7-28
Use props
Malibu Aerial
Second Officer
Flight distance : 143898 ft
United States
Offline

Good stuff.  What is your background?  How did you learn scratch programming?
2019-7-28
Use props
MarkusXL
Second Officer
United States
Offline

Malibu Aerial Posted at 7-28 09:05
Good stuff.  What is your background?  How did you learn scratch programming?

I've been a Test Engineer for the last 20 years, but am just now, due in part to an agreement between Operations and Software Engineering, learning Python.  I thought the S1 would be an interesting platform to learn on.  I actually have no interest in the game aspect of the thing, nor in live manual control of it.  It becomes a twitch game, which gets boring fast.  I would rather test my algorithms against others in tests of autonomous control.  We have an ai_robotics club at work on Slack, and I am blogging there and hoping another in the club buys an S1.

Scratch?  It's very much like the Lego Mindstorms blocks system that I remember, but these Scratch blocks translate 1-for-1 to Python code lines.  However, in Scratch there no return() or break and no way to pass variables into or out of Functions.  So I make a rough draft with Scratch on my PC, get the logic worked out, then switch to Python view, copy and paste into PyCharm, and test and finish it (commenting out the S1 hardware specific lines though.  But least you can see all the user variables and how they change).  Then, copy and paste back into the Robomaster app, uncomment the S1 command lines, upload to Cloud, then back down into my iPad Mini for testing on the S1.
2019-7-29
Use props
Malibu Aerial
Second Officer
Flight distance : 143898 ft
United States
Offline

MarkusXL Posted at 7-29 06:47
I've been a Test Engineer for the last 20 years, but am just now, due in part to an agreement between Operations and Software Engineering, learning Python.  I thought the S1 would be an interesting platform to learn on.  I actually have no interest in the game aspect of the thing, nor in live manual control of it.  It becomes a twitch game, which gets boring fast.  I would rather test my algorithms against others in tests of autonomous control.  We have an ai_robotics club at work on Slack, and I am blogging there and hoping another in the club buys an S1.

Scratch?  It's very much like the Lego Mindstorms blocks system that I remember, but these Scratch blocks translate 1-for-1 to Python code lines.  However, in Scratch there no return() or break and no way to pass variables into or out of Functions.  So I make a rough draft with Scratch on my PC, get the logic worked out, then switch to Python view, copy and paste into PyCharm, and test and finish it (commenting out the S1 hardware specific lines though.  But least you can see all the user variables and how they change).  Then, copy and paste back into the Robomaster app, uncomment the S1 command lines, upload to Cloud, then back down into my iPad Mini for testing on the S1.

Where are you located?

I noticed that Python and Scratch have different set of projects.  What I mean is you don't see the work that you've in Python when you go to Scratch and vice versa.
2019-7-29
Use props
MarkusXL
Second Officer
United States
Offline

Malibu Aerial Posted at 7-29 12:40
Where are you located?

I noticed that Python and Scratch have different set of projects.  What I mean is you don't see the work that you've in Python when you go to Scratch and vice versa.

San Francisco Bay Area, San Jose California

You can build a lot in Scratch - but then at some point you switch to Python View of your Scratch program.  Then, you can Select All and Copy.

Then, open a Python (beta) New Program, and Paste.  Once done though, you cannot go back to Scratch.  But, you unlock TONS more capability...
2019-7-30
Use props
Malibu Aerial
Second Officer
Flight distance : 143898 ft
United States
Offline

MarkusXL Posted at 7-30 07:26
San Francisco Bay Area, San Jose California

You can build a lot in Scratch - but then at some point you switch to Python View of your Scratch program.  Then, you can Select All and Copy.

Thanks.  I'll try that.
2019-7-30
Use props
Vasek1234
lvl.1

Russia
Offline

Thank for post
6-13 05:40
Use props
davidAnderson21
lvl.1

Russia
Offline

If your child struggles with numbers, you can download free math worksheets for her to practice. These worksheets teach her the rules of comparing fractions and percentages, and can be used in other math problems as well. Several word problems are included to help her practice relating fractions to specific decimals and percentages. The best part about word problems is that they put math facts into practice! This way, she'll understand why they're important.
6-15 03:01
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules