VEX programming tips

VEX programming tips

使用万能的电机控制自定义函数

由于电机的端口是一个motor类型的变量,所以我们可以将电机当作变量传参。

模板

1
2
3
4
5
void m(motor motorname,int speed=100,int tor=100) //定义一个名为m的函数,三个参数分别是电机端口、速度(默认100)、力矩(默认100)。
{
motorname.setMaxTorque(tor,percentUnits::pct);
motorname.spin(directionType::fwd,speed,percentUnits::pct);
}

实例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 底盘四个电机全功率向前1000ms
using namespace vex;
void test()
{
//四个电机同时以速度100,力矩100向前
m(MotorLF,100,100);
m(MotorLB,100,100);
m(MotorRF,100,100);
m(MotorRB,100,100);
//延时1000ms
task::sleep(1000);
//四个电机同时停
m(MotorLF,0);//由于在这里(一般情况下)力矩默认都为100,所以可以直接不传入力矩这个参数,跳过即可)
m(MotorLB,0);
m(MotorRF,0);
m(MotorRB,0);
}
Read More
Summary of 2019 VEX Robotics World Championship

Summary of 2019 VEX Robotics World Championship

VEX 2019世锦赛总结


img

难忘的一次经历。

久别重逢

作为刚刚转入国际班的新生,我很荣幸被韩老师选中参加VEX2019世锦赛。赛前,有激动、欣喜,也有紧张与茫然。VEX,于我而言是一个既熟悉又陌生的竞赛项目。初中时在韩老师的带领下参加了“一网打尽”和“星光璀璨”两个赛季,也收获了很多。本以为与VEX在此分道扬镳,没想到如今的久别重逢。与熟悉的金属结构件相遇、与机器人对抗电机高速旋转的齿轮声相遇,更重要的,更重要的是与初中时有着共同热爱与梦想的同学们和老师重逢。这一切都让我激动不已,就像是星星之火在无数个暴风雪夜之后重新成为熊熊烈火一样,照亮了我的心。

当然,新的问题接踵而至。VEX推出了全新的V5主控套装,新的编程环境,这一切都是需要我去学习和尽快掌握新的知识;这里有了更多陌生的面孔,有身经百战的学姐和学长、还有已经征战将近一个赛季的国一的同学们。而我,作为一个新加入机器人社团大家庭的人,如何让大家认识我、了解我、信任我是亟待解决的问题。

在赛前,我努力地尝试编写自动程序,当小球被精准地吸入机器人的储球仓时、当小球射中旗杆的那一刹那,那种久违的激动与喜悦再次涌上心头,每一行代码,都是自己思考过后的体现,每一次正确编译和执行,都有着小小的成就感。

我找回了那种感觉,拾起了彼时的梦想,找寻到了志同道合的朋友们。同时也学习了新的知识,结识了新的朋友,更有了新的体悟。

我们在一起

Read More
A perfect event

A perfect event

A fantastic and amazing event that I will never forget

I was in the front of the lobby hanging our robot with my teammate

I was in the front of the lobby hanging our robot with my teammate

img

The VEX Worlds Champion is held in the expo of Kentucky. It’s really big and great. When I first stepped into the west wing that our competition will be held, a strong feeling of achievement and happiness came to my heart suddenly. You’ll never know how excited I was at that time.

As soon as we had finished the preparation, the team across from us came and talk with us, they are really friendly and fantastic. I don’t know why I was very pleasured to speak with them in English although my English is not very well. They are interested in China, they said that the most impressive thing for them of China is the High Speed Train. They even call it bullet train. Then we talked a lot about the differences between China and America.

guys from Texas

guys from Texas

guys from UK, we even talked about the Brexit. :)

guys from UK, we even talked about the Brexit. :)

Read More
The true first day of 2019 VEX Worlds

The true first day of 2019 VEX Worlds

Fantastic & Unsatisfactory flights

The marvellous sun rising in the morning on the flight from Xi'an to Beijing

The marvellous sun rising in the morning on the flight from Xi’an to Beijing

The first trip begin at 6:00 in the morning, it’s the most intensive boarding for me, which we arrived the airport an hour earlier and boarded before the taking off for just 30 minutes.
Also, the huge robots are carrying to the special channel. I heard the obvious noise when the conveyor belt was running.

On the flight, everybody was very tired because of staying up the whole night. But I didn’t feel sleepy, looking at the outside of the windows. It was charming and moving and also I have never seen the sunrise before.

Chicago O'Hare Airport

Chicago O’Hare Airport

The second flight from Beijing to Chicago operated by The United Airlines. To be honest, it was not as good as I thought before. The food, space, comfortability and so on were not very good.

And I deemed that I was able to review my schoolwork during the flight period, but I was totally wrong. I just played with Jessica and had lots of fun. We talked about a lot about school, life and many other things. I thought she is a really nice girl, a little bit like QBS. Having feasible childish is the most attractive aspect to me.

We went around the Outlets in the afternoon but I bought nothing. It’s totally the same as the Outlets in Seattle. I don’t think that I belong to this kind of places.

Read More
Chicago day trip
May be the FIRST DAY?

May be the FIRST DAY?

It’s 2:51 now. I am in the robot laboratory in the school with my team members.

Everything is prepared. We’ll set out at 3:30. It’s surely the earliest time that I get to school and the earliest time to leave school. My classmates will have the mid term examination. I am a little fortunate but also a bit regretful.

I deem that today’s work about programming of autonomous is greater than any other day. I have debugged 4 kind of programs in different position. You know that, the feeling of hit the ball completely is really fantastic.

The 9 days VEX Worlds trip is beginning from now. There must be something exciting and also depressing. But everything will become the most valuable and forgettable memories and experiences for me.

By the way, perhaps I can be the one who waving the flag in the central stage at the VEX Worlds opening ceremony.

I don’t know why I am not sleepy at all now, although I was so sleepy right now. Hope it can be a good starts!

We’ll go to Beijing at first, and go to Chicago maybe one day later.

Read More