Git Product home page Git Product logo

pxt-robotis's Introduction

MakeCode ROBOTIS Actions Status

Live at https://5d8c71b7-aa36-4a68-a9cb-288b989efb08.pxt.io/

This is an experimental code editor for ROBOTIS boards. The installation guide below is written for internal developers. To be changed later.

Who is this for?

This editor is meant for micro-controllers that are friendly to breadboarding. The editor is based on Microsoft MakeCode.

Local Dev Server

The local server lets you to run the editor and serve the documentation from your own computer.

Setup

  1. Install Node.js 8.9.4 or higher.
  2. Install Docker if you are going to edit any .cpp files.
  3. Clone the pxt repository.
git clone https://github.com/microsoft/pxt
cd pxt
  1. Install the dependencies of Microsoft/pxt and build it
npm install
npm run build
cd ..
  1. Clone the Microsoft/pxt-common-packages repository
git clone https://github.com/microsoft/pxt-common-packages
cd pxt-common-packages
npm install
cd ..
  1. Clone the Microsoft/pxt-robotis repository
git clone https://github.com/ROBOTIS-GIT/pxt-robotis
cd pxt-robotis
  1. Install the PXT command line (add sudo for Mac/Linux shells).
npm install -g pxt
  1. Install the pxt-robotis dependencies.
npm install
  1. (optional) Link pxt-robotis back to base pxt repo (add sudo for Mac/Linux shells).
rm -Rf node_modules/pxt-core
rm -Rf node_modules/pxt-common-packages
pxt link ../pxt
pxt link ../pxt-common-packages

If you want to know if your folders are link, run ls -l and it will indicate them.

ls -l node_modules/

Note the above command assumes the folder structure of

       robotis.makecode.com
          |
  ----------------------------------
  |       |                        |
 pxt      pxt-common-packages  pxt-robotis

Refresh dal.d.ts files

Whenever you make changes to the #defines in the .cpp files, you will have to refresh the dal.d.ts files. For that, run

pxt builddaldts

CODAL changes

If you need to do changes to CODAL itself, follow these steps.

  • create a new project in the web editor, then close the web server. Select the hardware you want to work with.
  • using a command prompt, open the projects folder and find the subfolder with your new project
  • open the folder in Visual Studio Code
code .
  • open pxt.json and edit the dependencies to use the file:... path instead of *
   dependencies: {
        "robotis-cm-300": "file:../../libs/robotis-cm-300"
   }
  • from the command line, set the PXT_NODOCKER environment variable to 1
export PXT_NODOCKER=1
  • run a local build that will create a CODAL checkout automatically. If you are missing tools, you will be notified by the build script.
pxt build --local --force
  • go to the built/dockercodal folder and open all CODAL in a new Visual Studio Code instance
cd built/dockercodal
code libraries/*
  • go to the Git tab in VS Code, and change the branch of the CODAL repository to work on to master. You can create a new branch to start doing your work and pull requests.

  • to build CODAL directly, run built/codal

python build.py
  • to rebuild your project from pxt, run pxt build --local --force from the project folder

Running

Run this command from inside pxt-robotis to open a local web server

pxt serve

If the local server opens in the wrong browser, make sure to copy the URL containing the local token. Otherwise, the editor will not be able to load the projects.

If you need to modify the .cpp files (and have installed yotta), enable yotta compilation using the --localbuild flag:

pxt serve --localbuild

Updates

Make sure to pull changes from all repos regularly. More instructions are at https://github.com/microsoft/pxt#running-a-target-from-localhost

Repos

The pxt-robotis target depends on several other repos. The main ones are:

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

pxt-robotis's People

Contributors

ajtwlsdlqp avatar irarykim avatar kigateg avatar kjsii123 avatar microsoft-github-operations[bot] avatar microsoftopensource avatar pelikhan avatar robotisapp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pxt-robotis's Issues

Update icon

Attach a SVG icon for robotis so that we can update the skin of this editor.

It seems that the modified CODAL code is not properly applied as a runtime HEX file.

Hi, @pelikhan, @mmoskal.

Describe the bug
Although the member function of a specific class not implemented in codal-core was implemented in a class that inherited the class, MakeCode does not link the proper runtime HEX file.
Of course, these work without problems when using only the CODAL build system.

The CODAL code related to the previously modified Serial package or the newly added DYNAMIXEL worked well.
Is there anything different about the core package?

To Reproduce
Steps to reproduce the behavior:

  1. Modify member function of CODAL Core Class
  2. Commit & Push to GitHub.
  3. pxt serve or pxt serve --localbuild
  4. Write code at MakeCode (eg. MakeCode ROBOTIS)
forever(function () {
    serial.writeValue("V", pins.VOLTAGE.analogRead())
    pause(500)
})
  1. Download & Upload to target board (The code has changed, so it must be compiled, not the cached hex file, but it is not recompiled. If you delete the "built/hexcache" folder and clear the browser's cache, it will be recompiled, but the hex hash value is the same.)
  2. Look at the behavior of the board (The changed member function was not applied)

Expected behavior
I wrote it as a more specific example.

  1. The getAnalogValue() function in Pin.h of codal-core is not implemented.
  2. Therefore, we implemented getAnalogValue() in NRF52Pin of codal-nrf52.
  3. We implemented to print 4444 instead of -1013(DEVICE_NOT_IMPLEMENTED) value.
  4. Now it is applied. (We have confirmed that this compiles normally through various methods and creates a .hex file in the dockercodal or codal folder. We made sure that this compiles normally, such as by creating additional functions, inserting error codes or checking the .map file.)
  5. Now, the value that was output as -1013 should be output as 4444. But...

Screenshots

  • Before
int NRF52Pin::getAnalogValue()
{
    return DEVICE_NOT_IMPLEMENTED;
}
  • After
int NRF52Pin::getAnalogValue()
{
    int data = 4444;
    return data;//DEVICE_NOT_IMPLEMENTED;
}

image

  • But...
    image

Desktop:

  • OS: Windows10 Pro
  • Browser: chrome / NAVER whale(based on chrome)
  • Version: chrome 80.0.3987.149

Additional context

Skin the editor

It is possible to tune the skin of the editor via many LESS variables. Do you already have a design in mind?

In general, you cannot move buttons around but you can device about colors and shapes (as long as it can be done in CSS).

When adding an item to bannedCategories, the related block is not visible.

<robotis-cm-550/pxt.json>
스크린샷 2020-04-03 오후 12 31 51

<screen-st7735/targetoverrides.ts>
스크린샷 2020-04-03 오후 12 32 31

<pxtarget.json>
스크린샷 2020-04-03 오후 12 32 55

result:
스크린샷 2020-04-03 오후 12 35 10

I created an image related block (using targetoverrides on screen--st7735).
And if don't put any items in bannedCategories like the image above, the block will be exposed.

[Issue]
스크린샷 2020-04-03 오후 12 48 02
스크린샷 2020-04-03 오후 12 48 07

After that, the image category was unnecessary, so I applied “image” to the forbidden category.
Then the "image" category was successfully removed, but I had the problem that the blocks I made were not exposed.

Does this issue occur when a class related to a category entered in bannedCategories is used in a block? If so, what should I do to expose the blocks I create and not the Image category?

Thanks in advance for your help.

We need a way to communicate!

My Korean is unfortunately non-existent. Are you ok doing some kind of online meeting in English every week to track progress?

"...more" category is not refreshed.

I clicked "... more" of "PINS" category on local PC.
But blocks are not refreshed like below.

Working fine on the website "maker.makecode.com".
Working fine on another local PC.

image
image

Display bread board

Hi.

How does it work to display the bread board in simulator area.

for example...
The BB is displayed only when the block is connected in case of LCD extension.

image

But The BB is displayed by adding Game extension. (even though blocks are not connected.)

Questions about making simulation

Is it possible to make a triangle or star shaped buttons by modifying the data of "buttons" of board.json in Makecode?
image

Or do I need to parse svg data like lego or brainpad way to create simulation ui like button, screen, motor etc.
image

Thanks.

[Workflow] GitHub workflow

Hi, @pelikhan.

Below is the question I asked about the GitHub workflow I asked you after you gave me write permission previously.

Can you explain how you would like to collaborate with us about the following?


Hi, @pelikhan

During the development period, would you like to proceed with the way we merge PR when you approve it?
Or, would you only want to make a review if we requested it? (That is, if the PR does pass the CI if we did not request a review, are we merging without your review?)

Also, in the case of release, what do you want to do?

All of these questions are about the development stage.

Originally posted by @OpusK in #28 (comment)

[Error] Cannot read property

@pelikhan,

The issue below (#23) has not been resolved.
And even though it is declared as below in shims.d.ts, it still shows 'of undefined', not 'of dynamixel' ...
Strangely, despite this error, the board works fine.

declare namespace dynamixel {
    /**
     * Opens a DYNAMIXEL communication driver
     */
    //% shim=dynamixel::internalCreateDXLDevice
    function internalCreateDXLDevice(tx: DigitalInOutPin, rx: DigitalInOutPin, dir: DigitalInOutPin, id: int32): DynamixelDevice;
}

image

And, the below .png file is the example code with the above error.

ROBOTIS-DYNAMIXEL-Velocity


Originally posted by @OpusK in #23

What you need to do is to implement a javascript version of the C++ call.

I think I wrote a shim through the code above as per the manual.

See serial shim: https://github.com/microsoft/pxt-common-packages/blob/76fe391800fd44825839573da32cdca3ca5076ed/libs/core/sim/serial.ts#L40

Your link is not a shim, but a sim file (for simulation). Isn't it right to refer to shims.d.ts for shim?
Of course, I haven't implemented simulation yet, so when implementing sim it's right to refer to the file you gave the link to.
I've also seen errors related to simulation, so I know I need to implement sim someday. However, the current error is about shim.

I think it was implemented properly except for simulation, isn't it?
Like docs, should it be uploaded to the cloud to be recognized as a namespace called dynamixel, not undefined?
If so, please merge. I will implement the simulator later.

Originally posted by @OpusK in #23

Display same blocks in different categories.

I have "block_1", "block_2"
I want to display "block_1", "block_2" in "category_1" for "robot_1".
I want to display "block_1" in "category_1", "block_2" in "category_2" for "robot_2".

Is it possible to create common blocks and display them in different category of different robots?

Now I made the code as shown below.

Set "dependencies: file:../robot_1_blocks" for "robot_1".
Make a ".ts file" in "robot_1_blocks" and defile "namespace c1 {b1, b2}"

Set "dependencies: file:../robot_2_blocks" for "robot_2".
Make a ".ts file" in "robot_2_blocks" and defile "namespace c1 {b1}, namespace c2 {b2}"

Thank you.

[pxt-ci] Bad HTTP status code: 412 at https://www.makecode.com/api/compile/extension

Hi, @pelikhan

This is not yet PR on Microsoft.
Currently, the base-code merge operation is pending, so I'm asking about the result from ROBOTIS-GIT. (This is what happened in #3 earlier.)

The link below is a PR from ROBOTIS-GIT.

And below is the result.
https://github.com/ROBOTIS-GIT/pxt-robotis/runs/486499666

This problem does not exist when the --localbuild option is used, but if we use the pxt serve command without any options we get this error.
Since it's an HTTP 412 error, it looks like something needs to be configured in the cloud running build. Is there anything we need to fix in pxt-robotis? Or is it something Microsoft has to deal with?

Display "On Start" block.

Hi,

To set up a category to display "On Start" block.
I found this..... "onStartNamespace": "loops" in "pxtarget.json"
It shows "On Start" block in "loops" category.

Can I set different categories to display "On start" block.
for example,
"basic" category for "Robot A".
"loops" category for "Robot B".

Thank you.

Size of image buffer is 38400 rather than 9600

Describe the bug
If I want to use ILI9341 LCD (320x240), the value of img->pixLength() in updateScreen() in libs/st7735---screen/scree.cpp is 38400. But it should be 9600.

To Reproduce
Steps to reproduce the behavior:

  1. Set LCD related parameters as follows in config.ts. (If I use parameters of ST7735, LCD works fine)
export const PIN_DISPLAY_SCK = DAL.P0_1;
export const PIN_DISPLAY_MISO = DAL.P0_24;
export const PIN_DISPLAY_MOSI = DAL.P1_2;
export const PIN_DISPLAY_CS = DAL.P0_5;
export const PIN_DISPLAY_DC = DAL.P1_5;
export const PIN_DISPLAY_RST = DAL.P1_3;
export const PIN_DISPLAY_BL = DAL.P1_7;

export const DISPLAY_TYPE = 9341
export const DISPLAY_WIDTH = 320
export const DISPLAY_HEIGHT = 240
export const DISPLAY_CFG0 = 0x08
export const DISPLAY_CFG1 = 0x0010ff
export const DISPLAY_CFG2 = 50
  1. Add "game": "file:../game" to "dependencies" category of pxt.json.
  2. Then from the makecode editor, I can use [Scene] category. If I use [Set background image to ()] block and download uf2 file to my board, my board blinks LED irregularly.
  3. I found it entered target_panic(PANIC_GC_TOO_BIG_ALLOCATION). It is because it satisfies if (numbytes > GC_MAX_ALLOC_SIZE) condition in void *gcAllocate(int numbytes) in libs/base/gc.cpp. The value of GC_MAX_ALLOC_SIZE is 16k while numbytes is 38416.
  4. If I change GC_MAX_ALLOC_SIZE to larger value, like 64k, then this panic doesn't happen.
  5. But target_panic(PANIC_SCREEN_ERROR) happens. Because img->width() * mult != display->width condition and img->height() * mult != display->displayHeight condition are satisfied in updateScreen() of libs/st7735---screen/scree.cpp.
  6. Followings are related values:
    For the explanation why img->pixLength() should be 9600, please refer to lancaster-university/codal-core#118. This PR is closed but I think the calculation result is correct.
display->doubleSize : 1
mult : 2
img->bpp : 4
img->width() : 320   ---> it should be 160, since actually use LCD as 160x120 resolutuion
img->height() : 240   ---> it should be 120, since actually use LCD as 160x120 resolutuion
display->width : 320
display->height : 240
img->pixLength() : 38400 ---> it should be 9600, since actually use LCD as 160x120 resolutuion
  1. I think if the image buffer size is corrected, the PANIC_GC_TOO_BIG_ALLOCATION panic will not happen.

Selection of extension exposure.

How can I expose only the items I want when exposing extensions?

For example:
If you look at the capture below, libs / base, libs / core, etc. are included in the extension and exposed.
extension_robotis

However, as shown below, the extension is not exposed in the case of Lego. Which part should I change? Or is there a reference you can refer to?
extension_lego

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.