Servers by jDrones

Error after rebase because of missing MAV_GENERATOR_STATUS_... definition

After rebase of my formerly OK checked branch I’m running into an error, based on MAV_GENERATOR_…

The GitHub checks say “MAV_GENERATOR_STATUS_FLAG_WARMING_UP is missing”

and if I try to build the code I also run into an Errror:

[152/722] Compiling libraries/AP_GPS/AP_GPS_SBP2.cpp
[153/722] Compiling libraries/AP_GPS/AP_GPS_SIRF.cpp
[154/722] Compiling libraries/AP_Generator/AP_Generator_RichenPower.cpp
[155/722] Compiling libraries/AP_Gripper/AP_Gripper_Backend.cpp
[156/722] Compiling libraries/AP_Gripper/AP_Gripper_Servo.cpp
…/…/libraries/AP_Generator/AP_Generator_RichenPower.cpp: In member function ‘void AP_Generator_RichenPower::send_generator_status(const GCS_MAVLINK&)’:
…/…/libraries/AP_Generator/AP_Generator_RichenPower.cpp:437:27: error: ‘MAV_GENERATOR_STATUS_FLAG_WARMING_UP’ was not declared in this scope; did you mean ‘MAV_GENERATOR_STATUS_FLAG_CHARGING’?
437 | status |= MAV_GENERATOR_STATUS_FLAG_WARMING_UP;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| MAV_GENERATOR_STATUS_FLAG_CHARGING
compilation terminated due to -Wfatal-errors.

Waf: Leaving directory `/cygdrive/c/Users/Willy/Documents/GitHub/ardupilot/build/sitl’
Build failed
-> task in ‘objs/AP_Generator’ failed (exit status 1):
{task 123145240536200: cxx AP_Generator_RichenPower.cpp -> AP_Generator_RichenPower.cpp.0.o}
(run with -v to display more information)
“c:/cygwin64/bin/python2.7 waf plane” terminated with exit code 1. Build might be incomplete.

11:45:46 Build Failed. 1 errors, 0 warnings. (took 3m:40s.644ms)

I did a “git submodule update --init --recursive”, so MavLink should be up to date.

I had a look at the ardupilot-master code to find where that definition of MAV_GENERATOR_ is made, but I couldn’t find one.

So could anybody give me a hint where to find the rootcause of that error?

You will probably need to merge https://github.com/ArduPilot/ardupilot/pull/15404 befor you can compile

So I understand that It’s OK to have that errors in the moment and I just have to wait until 15404 is merged.
After it’s merged I have to rebase again and all should be OK.

Did I understand that correctly?

Yes. I hope that it will fix it, yes.

Since six weeks I’m not able to build without that error. So it’s hard to believe that it’s a general problem and every developer is not able to build since then.
I guess and hope that there’s a workaround till MavLink is up to date?
Could anybody give a hint how to deal with that?

@QuaxwillyI think the problem here is that you’re referencing a mavlink commit for your changes which doesn’t contain the new generator message stuff.

You’ll need to rebase your mavlink-change-containing-branch on top of ardupilot’s master branch, and then reference the newly created commit hash in your ardupilot repository.

Thank you @peterbarker, I will try that as soon as I understand what I’m doing. Sorry, I’m not so familiar with GitHub and repos and in the past I have learned that It’s better not to hurry here.
So could you give me a little deeper explanation of your last recommended doing, please.

Thank you @peterbarker, I will try that as soon as I understand what I¢m doing. Sorry, I¢m not so familiar with GitHub and repos and in the past I have
learned that It¢s better not to hurry here.

So one trick is to make it really, really easy to take backups. I use two
scripts, one to make a backup of a branch and one to take a backup of my
entire ArduPilot repo. The former takes milliseconds to run, the latter a
minute or so.

pbarker@bluebottle:~/rc$ ls -l which date-branch which date-tarball
-rwxrwxr-x 1 pbarker pbarker 142 Apr 17 2018
/home/pbarker/bin/date-branch
-rwxrwxr-x 1 pbarker pbarker 291 Mar 22 2017
/home/pbarker/bin/date-tarball
pbarker@bluebottle:~/rc$ ls ardupilot*tar
ardupilot-201901180845.tar ardupilot-202012081408.tar
ardupilot-202010011011.tar
pbarker@bluebottle:~/rc$ cd ardupilot
pbarker@bluebottle:~/rc/ardupilot((HEAD detached at
rmackay9/lthall-scurve4))$ git branch | grep backup/ | head -2
backup/AP_MAX_LOG_FILES-20200910135046
backup/DEBUG/f35-spi-20200409102304
pbarker@bluebottle:~/rc/ardupilot((HEAD detached at
rmackay9/lthall-scurve4))$

So could you give me a little deeper explanation of your last recommended doing, please.

So make a backup first :slight_smile:

Make sure you’re clean with

git status

Then checkout ardupilot’s master branch:

git fetch origin
git checkout remotes/origin/master

update the submodules:

git submodule update --init --recursive

rebase your mavlink commit:

cd modules/mavlink
git fetch origin
git checkout pr/my-branch-which-contains-custom-mavlink
git rebase remotes/origin/master

push your mavlink changes up to your github repo:

git push -f github pr/my-branch-which-contains-custom-mavlink

reference the commit in your ardupilot repo:

git checkout pr/my-branch-which-used-custom-mavlink
git add modules/mavlink
git commit -m “mavlink: reference my awesome new mavlink changes”

push your new branch up to github:

git push -f github pr/my-branch-which-used-custom-mavlink

Some commit messages may need tweaking. I’ve just done this off the top
of my head… let’s see how well I did…

1 Like

Today I worked through that, but with no success - same error as before.

Maybe we missunderstood - I never changed anything in MavLink.
So I replaced
“git checkout pr/my-branch-which-contains-custom-mavlink” by “git checkout MisRelSep”
“git push -f github pr/my-branch-which-contains-custom-mavlink” by “git push -f origin MisRelSep” and also
“git push -f github pr/my-branch-which-used-custom-mavlink” by “git push -f origin MisRelSep”.

It would help if you would have a look at https://github.com/ArduPilot/ardupilot/pull/14663 - was my doing on 17.Oct correct or is that the rootcause of my problems?

That’s my normal way to rebase:
starting Git Bash

cd Documents/GitHub/ardupilot

git checkout MisRelSep

git fetch upstream

git rebase upstream/master

just if something has to be decided manually:
git log
(edit necessary files)

git add --all
or
git add (e.g.) ArduPlane/config.h
git add (e.g.) libraries/AP_Mission/AP_Mission.h
git add …

git rebase --continue

git commit -m “some senseful text”

git submodule update --init --recursive

git log --oneline --decorate --all --graph (for checking)

git push -f origin MisRelSep

So where in that process is the correct line to merge the MavLink-Submodule rebase?
Or am I completely on the wrong way of thinking?

You need to do the submodule rebase after the git submodule update and before the git push -f

I get an error
Failed to merge submodule modules/mavlink (commits don’t follow merge-base)
after the first few commands and don’t have an idea how to solve that:

@peterbarker: I don’t understand what
pr/my-branch-which-contains-custom-mavlink
and
pr/my-branch-which-used-custom-mavlink
should say.
In the moment I have one branch MisRelSep with one PR based on it (https://github.com/ArduPilot/ardupilot/pull/14663)

So is it necesary to create a help/interim branch? And if yes, where?
Btw I never changed anything in MavLink.

fyi that are my remotes:
$ git remote -v
origin https://github.com/WillyZehnder/ardupilot.git (fetch)
origin https://github.com/WillyZehnder/ardupilot.git (push)
upstream https://github.com/ArduPilot/ardupilot.git (fetch)
upstream https://github.com/ArduPilot/ardupilot.git (push)
Ist that “standard”?

If you never changed anything in mavlink why do you want to compile with custom mavlink messages???

BTW there have been a lot of changes in ArduPilot`s mavlink branch lately. Maybee some of the stuff you wanted is already there.

A conclusion for better understanding:

  • I had a green/OK checked PR.
  • After four months I thought it’s a good idea to rebase, to be prepared when the PR will be reviewed.
  • So I did a rebase
  • After the rebase the PR run into an error (see first post) and naturally also the build run into an error (in libraries/AP_Generator/AP_Generator_RichenPower.cpp the defines MAV_GENERATOR_STATUS_FLAG_… are used, but there is no declaration for them)

In the meantime I found that in common.xml of the new mavlink-submodule (that is the base for common.h) that declarations are done.

Now all I need is the actual mavlink-code in my repo, because thats necessary for the new master-code.

I thougt, that a “git submodule update --init --recursive” will do that, but it seems that’s not the case.

In former times a copy and paste of that code had been the sufficient solution, but in a version-control system that should not be a good idea.

In the meantime I tried different things and looked at the PR - and I’m very sure that my mavlink-problem is not a problem, but the result of a horrible mistake I did at rebase on Oct 17


Don’t know how that happened, but it seems to be horrible.

So could an experienced developer give me a briefing or a hint how to proceed, please?

I safed all my files and I could do a complete restart - but in a version-control system there should be a smarter solution.

Is it possible to rollback to the former state and restart here e.g.?

I already tried

$ git checkout -b MisRel_Test  d34d5c2

and that MisRel_Test branch is buildable without error.

Tomorrow, if I have time, I will clone your branch and rebase it on master.

I would appreciate that very much - thank you Amilcar - and no need to hurry.
It would also be great if you could describe how you have done that. So I’am able to understand and learn.

cd modules/mavlink
git checkout master
git pull internet master
cd ../..
git submodule update --recursive
git fetch internet master
git remote add WillyZehnder https://github.com/WillyZehnder/ardupilot.git
git fetch WillyZehnder MisRelSep
git checkout MisRelSep
git rebase internet/master
git gui  -> remove modules/gbenchmark and modules/mavlink commits
./Tools/gittools/git-subsystems-split
git checkout -b MisRelDec

For more info:
https://ardupilot.org/dev/docs/git-rebase.html
https://ardupilot.org/dev/docs/git-branch.html
and
https://ardupilot.org/dev/docs/git-interactive-rebase.html

I have done a PR to your repo now, the trick is to not commit any changes to the gbenckmark or mavlink repos. I re-formated your commits to match Ardupilot guidelines

1 Like

Many thanks Amilcar!
As you know I’m an experienced developer but dont have experience with git, I’m very uncertain what I have to do next - I don’t want to nearly kill my repo again.


My favorite is to create just a merge commit, but I don’t understand the other options - so i will be careful.

Servers by jDrones