Announcement

Collapse
No announcement yet.

Can a program share or copy/paste Functions with another program?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can a program share or copy/paste Functions with another program?

    App Inventor has a 'backpack' where you can copy/paste a Function from one program to another. In Android Studio you can use classes to use code among many programs (my vocabulary might not be precise on that since I am not an Android Studio programmer). Does Blocks Programming have similar features? The only thing I can figure out is to back up your program to your computer which creates an XML file, open all your programs inside a powerful text editor like Notepad++, copy the functions and paste them into the other programs, save all, then import all the XML programs back into Blocks Programming. Cumbersome and error prone.

  • #2
    Check the tutorial video called Save and Save Often. It addresses this

    Comment


    • #3
      Hit enter before I should have. The video shows the ability to download individual modes to the laptop as backup so I am assuming that if there is a way to bring them back up on the original phone, it can be brought back up on any phone as it discusses if a phone is broken, the downloaded code is safe.

      Comment


      • #4
        Thank you for your good advice .. I will share it with others .. but that wasn't my question.

        Let me try giving a simple example of what I am asking: By tournament time, our competition robot will have many different Autonomous and Teleop programs loaded onto the robot. In Android Studio you can define the initialization routine once for that robot - setting up servos, motors, etc - and all the programs will call that routine. (I'm not referring to the robot configuration you make at the robot controller phone) You can make initialization changes once like changing the starting servo position then all the loaded programs will automatically use that new initialization. With Blocks Programming, you would need to edit the initialization routine of every program loaded onto the robot simply to change the servo starting position. There must be a better way!

        The simple example I gave is not that big of deal. But there are examples that are a big deal - like the motor power routines for 4 mecanum wheel drive robot that would be used in every Autonomous and Teleop program.

        Comment


        • #5
          Originally posted by benmcl View Post
          App Inventor has a 'backpack' where you can copy/paste a Function from one program to another. In Android Studio you can use classes to use code among many programs (my vocabulary might not be precise on that since I am not an Android Studio programmer). Does Blocks Programming have similar features? The only thing I can figure out is to back up your program to your computer which creates an XML file, open all your programs inside a powerful text editor like Notepad++, copy the functions and paste them into the other programs, save all, then import all the XML programs back into Blocks Programming. Cumbersome and error prone.
          Hi benmcl,

          The FTC Blocks Programming Tool doesn't have the backpack function yet, but you can use standard cut and paste operations to transfer blocks between op modes.

          There are two strategies you could use to transfer the blocks:

          1. If you have a single browser window opened to the Blocks Programming server, you open the first op mode (the one which has the blocks you would like to copy), select the blocks you want to transfer and use the copy command on your computer (CTRL+C on Windows, Command+C on Mac) to copy the selected blocks. Then close down that op mode (return to the main program listing) and then open your new op mode. Use the paste command on your computer (CTRL+V on Windows, Command+V on Mac) to paste the copied blocks from the clipboard to the new op mode.

          2. You can open two browser windows on your laptop to the Robot Controller Programming Server. in the first window, open your op mode that has the blocks you want to copy. Select and copy the blocks. Then in the second browser window, open your new op mode and use the paste function to paste the blocks into the second window.

          I hope this helps!

          Tom

          Comment


          • #6
            Yep - your suggestion works! I had two windows open in Chrome, each window showing a different program. Just like you said, I can copy and paste between them. Nice!

            I also updated to App Version 3.2 beta and you can now save & update programs while the robot is being used by others, all without invoking the "Program & Manage" option. You do have to use invoke the "Program & Manage" once at the very beginning of your session. This makes the programming workflow much nicer with a shared robot.

            Blocks Programming is just getting better and better :-) Thanks!

            Comment


            • #7
              Originally posted by benmcl View Post
              Yep - your suggestion works! I had two windows open in Chrome, each window showing a different program. Just like you said, I can copy and paste between them. Nice!

              I also updated to App Version 3.2 beta and you can now save & update programs while the robot is being used by others, all without invoking the "Program & Manage" option. You do have to use invoke the "Program & Manage" once at the very beginning of your session. This makes the programming workflow much nicer with a shared robot.

              Blocks Programming is just getting better and better :-) Thanks!
              Ben - glad you were able to upgrade to v3.2 and also verify the copy and paste mechanism.

              Note that v 3.3 is scheduled to be released soon.. This will add some improvements to Blocks. One thing that is a nice feature is the ability to enable/disable a Block op mode. By default newly created op modes will be enabled, but there is a simple check box that lets the user disable/re-enable an op mode.

              Comment

              Working...
              X