Still here? Hopefully that wasn’t too painful. If you wrote and ran and understood all of those programs then congratulations! – you are well on your way to becoming a ZR Master.
If you understood the sections above you already have all the tools you need to to solve the Circle Practice Game. Just to review what we’ve covered:
- Creating and Simulating programs.
- Writing Messages and Data to the DEBUG console.
- Keeping track of time.
- The purpose of the init() and loop() functions.
- Where to create/initialize variables.
- The basic satellite control API functions.
- Creating user functions.
- The basics of Vectors.
- Scaling Vectors.
- Determining the angle between vectors.
- Calculating a vector perpendicular to two others.
- Performing a sequence of actions at different times.
- Changing behaviors based on an event such as arriving at a location.
If any of those items make you scratch your head, please look back at what you did. Otherwise it is time to get back to the Circle.
Going back to the original problem Circle Practice Game, the goal is to fly in a circle around the other satellite located at the origin. You should also be flying around the x-axis. Moving the other satellite to the origin is accomplished by changing the simulation settings for the red satellite. That’s easy enough but what about our satellite?
Let me leave you with a story. A Physicist, a Trigonomitrist and a Vectorist hopped on the Soyuz, cruised over to the ISS and found themselves faced with the Circle Practice Game. After a few orbits the Physicist said, “I’ve got it! All I have to do is move tangentially to the circle and then once I’m moving, I simply need to apply a small constant push to the center of the circle to offset my centripetal force and I’m done.” Then the Trigonomitrist said, “Elegant, but that doesn’t correct for errors well, and if you’re off a little you’ll wobble all over the place. I think we should use some C function like atan2() to determine our angle in the y/z plane, then add some small angle to it and use that new angle to find our next target position. This method will add auto-correction.” Finally, the Vectorist said, “Also nice, but if we use the axis of rotation and our position and some very simple vector manipulation we can figure out roughly where to head and with a little correction to our desired radius we’ll be spot on. We’ll also save all of the memory used by those expensive trig. functions. Best of all, if some day we need to rotate around some other axis like the y-axis or even some arbitrary axis, nothing will change!” In the end they were all right.
I have roughed out three completely different approaches. Each one will work. You should try them all, but I recommend the vector method. Or come up with your own approach! There are definitely other ways to solve this problem.
As a ZR beginner, if you haven’t done this type of problem before it will be work, but it is doable. Also remember that while “In space no one can hear you scream,” in the ZR community help is just a post away. There are plenty of resources and there is plenty of support available. So work to beat this one on your own, but if you get too stuck, reach out.
And have fun!
Thanks for reading this tutorial, I hope that it was helpful. If you have any suggestions or comments please leave them below.
Mentor Team y0b0tics!
P. S. Some additional food for thought in solving the vector based orbit problem…