MD25 driver motor on PIXHAWK

Hi,

I would like to use the MD25 drive motor board made by DEVANTECH and I see an existing librarie in PIXHAWK software.
Someone knows how can I use it?
There is no existing parameters to select this driver in APM PLANNER 2 neither in QGroundControl.
Any help will be welcomed.
My project aims to make ground robots to test new collaborative algorithms before testing on quadcopters .

You need to create a new vehicle config and start it: http://dev.px4.io/airframes-adding-a-new-frame.html

Hi,

Thanks for your reply, I started by trying to rebuild the Firmware on RaspBerry PI2 but I have got the following error:
Makefile:59: *** Fatal. Arret.
Apparently check_cmake.sh return 1 instead of 0 (dont know why
)
Then if I change the code to pass trought this line (ie CMAKE_VER =0)
I have got this message: make: *** [posix_rpi2_release] Erreur 127
Same error with posix_rpi2_default
Any Idea?

Best Regards

Have you tried?

make clean

Yes I tried “make clean” but no change. cmake 3.3.2 is well installed on my Raspi.
I changed check_cmake.sh it return only 0 now and its working, but

I have the following error now: CMake Error at cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmke:53 (message): could not find GENROMFS

I would say:

sudo apt-get install genromfs

according to: http://dev.px4.io/starting-installing-linux.html

Hi,

I tried since two days to install all the necessary tools on Raspberry to build the Firmware but nothing goes right.
Then I decided to follow the Windows installation
 but when I look at the directory /px4 it miss several sub directory (libopencm3,bootloader,mavlink)and when I try to make the “consol build” I have the following error : cmake command not found
 I going to be crasy (I have done git submodule update)

cmake command not found would point to install cmake.

I can’t help for windows though, and I advise you to get in contact with whoever made the Raspberry Pi port. I myself have not played with it yet.

Hi,

Thank you for your help.
Could you tell me the procedure you followed to install all the necessary tools to rebuild the Firmare on Raspberry?
I tried to follow the instructions to install the “development environment on linux” but without success:
I used the last version of Wheezy.

sudo add-apt-repository ppa:george-edison55/cmake-3.x -y// add-apt-reposytory command not found
sudo apt-get update
sudo apt-get install python-argparse git-core wget zip
python-empy qtcreator cmake build-essential genromfs -y
// simulation tools
sudo apt-get install ant protobuf-compiler libeigen3-dev libopencv-dev openjdk-7-jdk openjdk-7-jre clang-3.5 lldb-3.5 -y
error unknown lldb-3.5 and clang-3.5 libraries

after that I tried to do :

git clone https://github.com/pixhawk/rpi_toolchain.git
cd rpi_toolchain
chmod +x install_cross.sh
./install_cross.sh
but I have got the error : line 40: /opt/rpi_toolchain/gcc-linearo-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: cannot execute binary file

Ok, I managed to run: sudo add -apt -repository ACH: George- edison55 / cmake - 3.x -y
after apt-get install sudo Python- software-properties
After sudo upgrade I have many errors
!?

but I still cannot rebuild the firmware

Here is the view when I try to build the Firmware:
– posix-rpi2-default
– The CXX compiler identification is GNU 4.6.3
– The C compiler identification is GNU 4.6.3
– The ASM compiler identification is GNU
– Found assembler: /usr/bin/gcc
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working C compiler: /usr/bin/gcc
– Check for working C compiler: /usr/bin/gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Found PythonInterp: /usr/bin/python (found version “2.7.3”)
– GIT_DESC = 9d5728b96ff7020b9b78acfa1d98391b89002f8f
– Configuring done
– Generating done
– Build files have been written to: /home/pi/src/Firmware/build_posix_rpi2_default
make -C /home/pi/src/Firmware/build_posix_rpi2_default -j4 --no-print-directory
Scanning dependencies of target git_genmsg
Scanning dependencies of target git_gencpp
Scanning dependencies of target git_uavcan
Scanning dependencies of target df_driver_framework
[ 2%] [ 2%] [ 2%] Generating git_init_Tools_genmsg.stamp
Generating git_init_src_modules_uavcan_libuavcan.stamp
Generating git_init_Tools_gencpp.stamp
Submodule ‘Tools/genmsg’ () registered for path ‘Tools/genmsg’
Submodule ‘Tools/gencpp’ () registered for path ‘Tools/gencpp’
Submodule ‘src/modules/uavcan/libuavcan’ () registered for path ‘src/modules/uavcan/libuavcan’
[ 2%] Building CXX object src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DriverFramework.cpp.o
[ 2%] In file included from /home/pi/src/Firmware/src/lib/DriverFramework/framework/include/DriverFramework.hpp:43:0,
from /home/pi/src/Firmware/src/lib/DriverFramework/framework/src/DriverFramework.cpp:40:
/home/pi/src/Firmware/src/lib/DriverFramework/framework/include/HandleObj.hpp:69:2: error: a class-key must be used when declaring a friend
compilation terminated due to -Wfatal-errors.
Built target git_genmsg
[ 2%] Built target git_gencpp
[ 3%] [ 3%] Building CXX object src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DevMgr.cpp.o
Building CXX object src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DevObj.cpp.o
src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/build.make:54: recipe for target ‘src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DriverFramework.cpp.o’ failed
make[3]: *** [src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DriverFramework.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs

Scanning dependencies of target git_mavlink
[ 4%] In file included from /home/pi/src/Firmware/src/lib/DriverFramework/framework/include/DriverFramework.hpp:43:0,
from /home/pi/src/Firmware/src/lib/DriverFramework/framework/src/DevMgr.cpp:38:
/home/pi/src/Firmware/src/lib/DriverFramework/framework/include/HandleObj.hpp:69:2: error: a class-key must be used when declaring a friend
compilation terminated due to -Wfatal-errors.
Generating git_init_mavlink_include_mavlink_v1.0.stamp
Submodule ‘mavlink/include/mavlink/v1.0’ () registered for path ‘mavlink/include/mavlink/v1.0’
src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/build.make:77: recipe for target ‘src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DevMgr.cpp.o’ failed
make[3]: *** [src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DevMgr.cpp.o] Error 1
Scanning dependencies of target prebuild_targets
In file included from /home/pi/src/Firmware/src/lib/DriverFramework/framework/include/DriverFramework.hpp:43:0,
from /home/pi/src/Firmware/src/lib/DriverFramework/framework/include/DevObj.hpp:37,
from /home/pi/src/Firmware/src/lib/DriverFramework/framework/src/DevObj.cpp:39:
/home/pi/src/Firmware/src/lib/DriverFramework/framework/include/HandleObj.hpp:69:2: error: a class-key must be used when declaring a friend
compilation terminated due to -Wfatal-errors.
[ 4%] Built target prebuild_targets
Scanning dependencies of target git_matrix
[ 4%] Built target git_mavlink
[ 4%] Scanning dependencies of target generate_topic_listener
src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/build.make:100: recipe for target ‘src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DevObj.cpp.o’ failed
Generating git_init_src_lib_matrix.stamp
make[3]: *** [src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/DevObj.cpp.o] Error 1
CMakeFiles/Makefile2:4640: recipe for target ‘src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/all’ failed
make[2]: *** [src/lib/DriverFramework/framework/src/CMakeFiles/df_driver_framework.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs

[ 4%] Generating topic_listener.cpp
Submodule ‘src/lib/matrix’ () registered for path ‘src/lib/matrix’
[ 4%] [ 4%] Built target git_matrix
Built target generate_topic_listener
error: The requested URL returned error: 403 while accessing https://github.com/UAVCAN/dsdl/info/refs
fatal: HTTP request failed
Unable to fetch in submodule path ‘dsdl’
Failed to recurse into submodule path ‘libuavcan/dsdl_compiler/pyuavcan’
Failed to recurse into submodule path ‘src/modules/uavcan/libuavcan’
CMakeFiles/git_uavcan.dir/build.make:49: recipe for target ‘CMakeFiles/git_uavcan’ failed
make[3]: *** [CMakeFiles/git_uavcan] Error 1
CMakeFiles/Makefile2:463: recipe for target ‘CMakeFiles/git_uavcan.dir/all’ failed
make[2]: *** [CMakeFiles/git_uavcan.dir/all] Error 2
Makefile:102: recipe for target ‘all’ failed
make[1]: *** [all] Error 2
Makefile:176: recipe for target ‘posix_rpi2_default’ failed
make: *** [posix_rpi2_default] Error 2

There seem to be a couple of errors. One is about the driver framework (unrelated to RPi) that doesn’t compile and another one git failing to access something on github.

What is your OS on the Raspberry Pi? And have you tried to contact whoever has added the Raspberry Pi port? That person should be able to help you.

Hi,

I use the last version of Raspbian Wheezy. My Rapsberry is an RPi 2 B+.

I might give this a try sometime, earliest next week. Until then I can only advise you to contact https://github.com/mhkabir who worked on the port, see https://github.com/PX4/Firmware/pull/3527.

Hi,
After having spent a week studying the firmware code , I have few questions to ask :
If I understand I have to create a new frame in which I declare to want to use the MD25 library.
Like this?
set MAV_TYPE 10
external I2C bus
md25 start 2 0x59
Where 2 is the external I2C bus (I guess) and 0x59 the I2C md25 board address

I think in the function:
int md25_thread_main(int argc, char *argv[])
{
printf("[MD25] starting\n");
if (argc < 5) {
// extra md25 in arg list since this is a thread
printf(“usage: md25 start bus address\n”);
exit(0);
}

const char *deviceName = “/dev/md25”;
uint8_t bus = strtoul(argv[3], nullptr, 0);
uint8_t address = strtoul(argv[4], nullptr, 0);
It should be
uint8_t bus = strtoul(argv[2], nullptr, 0);
uint8_t address = strtoul(argv[3], nullptr, 0);
regarding the usage. No?

Then I need to create an app in order to send the right commands to the motors through uORB messages via “void MD25::update()” function . Am I right?

Adding a frame like you did makes sense, however, you’ll also need to add some lines in rcS probably similar to what was done for the mkblctrl driver.

A motor driver (like fmu.cpp) works as follows:

  1. Copy the actuator control topic(s)
  2. Use the mixer to do the mixing
  3. Send the motors commands to the device (in this case PWM)

Does that clear things up?