Problems between VMX and VS Code

119 views
Skip to first unread message

alex ho

unread,
Aug 9, 2020, 10:14:01 PM8/9/20
to vmx-pi
Hello,

I‘ve had some problems while using FRC VS Code 2020. 
I use Robotbuilder to build the system of my robot then generate the C++ code. The code is compiled successfully in this time and there're 6 problems in main.cpp file. And I have no idea of how to import the <hal/HAL.h> and "gtest/gtest.h".

1.png


When I open VMX-Pi Command Palette then choose the feature Modifying your project to deploy to a VMX-pi. It occurs a problem which is displayed in the following screenshot. I have followed the step in here but it still doesn't work.

2.png

In the last time I build robot code again, but the code build failed in this time cuz it's been downloading the file named vmxpi-hal-1.1.230-linuxraspbiandebug.zip(which will be failed later). I have downloaded the .zip in the other website but don't know where to put this file.

3.png



Thanks

alex





jrothr...@hdsd.org

unread,
Aug 9, 2020, 10:47:31 PM8/9/20
to vmx-pi
Alex,
I think you are having a similar problem as with this thread.  Perhaps take a look there.  
The Run WPILib update issue happens when you try to switch the build.gradle while not connected to the internet.

It requires you to build the project while connected only the first time though per project.

Good luck.
~Jacob

alex ho

unread,
Aug 10, 2020, 1:34:15 AM8/10/20
to vmx-pi
Thank you. I have connected to the internet before building the robot code. The first two problems still leave me with no idea. >_<

在 2020年8月10日星期一 UTC+8上午10:47:31,jrothr...@hdsd.org写道:

jrothr...@hdsd.org

unread,
Aug 10, 2020, 10:17:36 AM8/10/20
to vmx-pi
I wonder if the first (and possibly the second) issue are related to robot builder. Robot builder does not really work anymore as WPI has changed how the command framework works.  In my CPP code, I do not have a main.cpp.  Edit: I do have a Main.cpp file with the same error in my test directory, but it does not prevent my code from working. I still think that the issue is with the new v old commands framework. You can see the differences here, but try following the steps below to see if you can get a project to build.

Also, there seems to be a bug with the VMX-Pi plugin. It seems to be skipping a line in the CPP build.gradle change...

You need to manually add "toolchainsPlugin.withRaspbian()" on its own line around line 7.

Here is my recommendation.
1) Use the WPILib plugin to create a new project from example.
Annotation 2020-08-10 094829.jpg
2) Follow the wizard selecting one of the command examples (I chose the mecanum example).
3) Add the line "toolchainsPlugin.withRaspbian()"
4) Try building and using that.

If that works, you can try modifying the robot builder created project. I know there has been some work done on that that you can see on Charlie's thread over here.

Of note, I think the old command framework imported a different set of headers than they do now (or they have moved location), and many of the file names are not the same. Be aware that most tutorials still use the old framework as the new one was a recent change.

Good luck,
~Jacob



Scott Libert

unread,
Aug 10, 2020, 5:04:45 PM8/10/20
to vmx-pi
> I have no idea how to import <hal/HAL.h>

DIrectly importing HAL.h should not be necessary in a FRC Robot Applicaiton.  And (see below) a WPI Library-based Robot Application should not directly initialize the HAL.

When I run RobotBuilder, the code it generates does not look like the code you have displayed.

RobotBuilder should generate a main robot class that inherits from frc::TimedRobot, like this:

class Robot : public frc::TimedRobot {

Noe that the RobotBuilder-generated main robot class ~does~ have a main() in it, but it looks very different from what you are showing.  Here it is:

#ifndef RUNNING_FRC_TESTS
int main(int argc, char** argv) {
    return frc::StartRobot<Robot>();
}
#endif

Please note that during frc::StartRobot(), the HAL initialization occurs.  This is why it is not necessary to initialize the HAL directly (e.g, by invoking HAL_Initialize()).

Can you please help us understand what you are attempting to do?  The structure of the code you have attached is not typical.

Thanks,

- scott

Why is necessary? Your code has a call to HAL_Initialize(), this code should not be added here.  The reason why is that the HAL is initialized by the Robot Framework.

Scott Libert

unread,
Aug 10, 2020, 5:20:41 PM8/10/20
to vmx-pi
Hi Alex,

I did a little more research into the code that you attached, and I believe I understand it better now.  This code appears to be test code that is being generated by RobotBuilder.

This "test code" is only used if you invoke "Test Robot Code" in the WPI Library VSCode Extension; this code is not intended to run on the robot, instead it runs on your development computer.  This test code is a simulation-based approach to programming so it doesn't actually run on hardware.

So in summary when you are working with VMX-pi (or RoboRIO) directly, you cannot use the "Test Robot Code" and simulation options; you should use the actual robot code instead.

Hope that clarifies things,

- scott

alex ho

unread,
Aug 11, 2020, 3:01:33 AM8/11/20
to vmx-pi
Hi, 
I've noticed the difference between elder version and version 20, and now I'm trying to combine the code generated by RobotBuilder with the template of the wpilib. 
Cheers.

在 2020年8月10日星期一 UTC+8下午10:17:36,jrothr...@hdsd.org写道:

alex ho

unread,
Aug 11, 2020, 3:23:57 AM8/11/20
to vmx-pi
Hi Scott,

I figured out that even without the HAL library, the functionality of the code will not be affected last night. So I don't have to focus on the main.cpp.
I've seen this before so I plan to build the code to RoboRIO directly after the RobotBuilder generates the code.

Thank you
Alex

在 2020年8月11日星期二 UTC+8上午5:20:41,Scott Libert写道:
Reply all
Reply to author
Forward
0 new messages