Closed Razbotics closed 6 years ago
You need to install both packages in the same workspace.
Alternatively, you can install the ros-kinetic-msp
package from the ROS repository. This package is also installed if you just use rosdep (rosdep install --from-paths src --ignore-src
) to resolve dependencies.
Ok so ros-kinetic-msp solved the problem of finding msp but now
error: ‘SonarAltitude’ in namespace ‘msp::msg’ does not name a type
void onSonarAltitude(const msp::msg::SonarAltitude &sonar_altitude) {
^
/home/razer/catkin_ws/src/ros-multiwii/src/multiwii_node.cpp: In member function ‘void MultiWiiNode::onSonarAltitude(const int&)’:
/home/razer/catkin_ws/src/ros-multiwii/src/multiwii_node.cpp:393:35: error: request for member ‘altitude’ in ‘sonar_altitude’, which is of non-class type ‘const int’
alt.data = sonar_altitude.altitude;
^
/home/razer/catkin_ws/src/ros-multiwii/src/multiwii_node.cpp:402:75: error: request for member ‘altitude’ in ‘sonar_altitude’, which is of non-class type ‘const int’
multiwii_transform.setOrigin(tf::Vector3(0.0, 0.0, sonar_altitude.altitude));
^
In file included from /opt/ros/kinetic/include/msp/FlightController.hpp:4:0,
from /home/razer/catkin_ws/src/ros-multiwii/src/multiwii_node.cpp:30:
/opt/ros/kinetic/include/msp/Client.hpp: In instantiation of ‘msp::client::SubscriptionBase* msp::client::Client::subscribe(const std::function<void(const T&)>&, double) [with T = int]’:
/opt/ros/kinetic/include/msp/Client.hpp:256:28: required from ‘msp::client::SubscriptionBase* msp::client::Client::subscribe(void (C::*)(const T&), C*, double) [with T = int; C = MultiWiiNode]’
/opt/ros/kinetic/include/msp/FlightController.hpp:45:54: required from ‘msp::client::SubscriptionBase* fcu::FlightController::subscribe(void (C::*)(const T&), C*, double) [with T = int; C = MultiWiiNode]’
/home/razer/catkin_ws/src/ros-multiwii/src/multiwii_node.cpp:496:62: required from here
/opt/ros/kinetic/include/msp/Client.hpp:274:35: error: request for member ‘id’ in ‘0’, which is of non-class type ‘int’
const msp::ID id = T().id();
^
/opt/ros/kinetic/include/msp/Client.hpp:280:33: error: cannot convert ‘int*’ to ‘std::map<msp::ID, msp::Request*>::mapped_type {aka msp::Request*}’ in assignment
subscribed_requests[id] = new T();
^
these errors are occurring...so what is the workaround for it
At the moment, it is not possible to mix the the current state of the source packages on github with the released binary packages in the ROS repo.
You either need to use both packages from the official ROS repo or build them from source. For the binary version, you can simply install ros-kinetic-msp
and ros-kinetic-multiwii
via the package manager but you will still need to create your own configuration file (e.g. for setting the serial port and baudrate). If building from source, you just need to checkout ros-multiwii
and msp
in the same catkin workspace (e.g. ~/multiwii_ws/src/
).
so how will i install both packages with catkin_make if msp is non catkin package and ros-multiwii is a catkin package
As I said, you just check out both packages into the same workspace:
mkdir -p ~/multiwii_ws/src/
cd ~/multiwii_ws/src/
git clone https://github.com/christianrauch/msp.git
git clone https://github.com/christianrauch/ros-multiwii.git
cd ~/multiwii_ws/
rosdep install --from-paths src --ignore-src
catkin build
catkin
can also build plain CMake packages (if they have a manifest).
Just make sure that you remove the binary packages before building.
Thanks sir it finally worked. But one cannot use catkin build directly first they have to install catkin tools by sudo apt-get install python-catkin-tools
this is just for reference.
Yes, you need to install catkin_tools
via package manager or pip. But building the workspace should also be possible by using the normal catkin catkin_make
.
Please close this issue when your problem is solved.
I guess you have installed msp ros packages on rpi zero as there is a launch file for rpizero made by you.. But how have you installed mavros on rpi zero on a raspbian os ...i have source installed ros indigo on my rpi zero but i am having hard time installing mavros from source in it...moreover i have ros barebone installed on my rpi zero...if possible guide me through it
I built the full ROS base and perception for Raspbian (https://github.com/christianrauch/ros-kinetic-raspbian-armhf) and the mavros
package from source. I simply included these dependencies in the same workspace. But you need to track down all dependencies manually, since rosdep only installs the binary packages.
so how to install your precompiled ros kinetic package in my raspberry pi zero
There are no precompiled binary packages for Raspbian.
If you want to use ROS on a Raspberry Pi Zero with Raspbian, you will have to compile ROS from source (http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi), including all the dependencies for additional packages you want to use. If you can use a Raspberry Pi 2 or 3, I would recommend to use Ubuntu with the binary ROS packages on it.
The betaflight_rpi_zero.launch
is just an example for using smaller update rates, since the Raspberry Pi Zero is less powerful and high update rates stress the CPU more. You can still use it on any other PC.
The only other dependency apart from the standard ROS distribution is mavros_msgs
(https://github.com/mavlink/mavros), which you will need to build (with all of its dependencies) yourself as part of the multiwii workspace. To extend the steps above:
mkdir -p ~/multiwii_ws/src/
cd ~/multiwii_ws/src/
git clone https://github.com/christianrauch/msp.git
git clone https://github.com/christianrauch/ros-multiwii.git
git clone https://github.com/mavlink/mavros.git
git clone -b upstream https://github.com/mavlink/mavlink-gbp-release.git
cd ~/multiwii_ws/
rosdep install --from-paths src --ignore-src
catkin build
Alternatively, you could just checkout the whole mavros_msgs
folder (https://github.com/mavlink/mavros/tree/master/mavros_msgs) into the workspace and skip building mavros
, mavros_extras
and libmavconn
:
mkdir -p ~/multiwii_ws/src/
cd ~/multiwii_ws/src/
git clone https://github.com/christianrauch/msp.git
git clone https://github.com/christianrauch/ros-multiwii.git
mkdir mavros
cd mavros
git init
git remote add -f origin https://github.com/mavlink/mavros.git
git config core.sparseCheckout true
echo mavros_msgs >> .git/info/sparse-checkout
git pull origin master
cd ~/multiwii_ws/
catkin build
For further information on how to build ROS and mavros, I would ask you to consult the official ROS forum at https://answers.ros.org and the mavros github project at https://github.com/mavlink/mavros.
Thanks for the instructions i will try that and get back to you the status.
I have successfully compiled and built everything after adding some dependencies into the rpi zero...also everything is working fine i am receiving imu data but publising rc inputs to the /multiwii/rc/override topic doesnt makes any changes also /actuator control doesnt works...i have set the msp_rx input
Can you control the motors or send RC commands using the Cleanflight/Betaflight/MultiWii GUI?
I have tested both cleanflight and betaflight Things i have tested
Master controlling of motors in Gui and the changes were updated while echoing the /multiwii/motor topic.
Imu message were succesfully published.
Controlling the rc values via GUI and was able to view them updated on /multiwii/rc/in topic.
Publishing on rc/override topic doesnt updating anything on GUI
Motor control by /actuator control topic wont running motors and updating gui.
I have set 2 ports for MSP configure...i am using usb or UART1 for connecting the fcu to GUI and UART 2 for ROS control via FTDI.....seems like unidirectional control...
I am not sure about the behaviour when using two MSP ports. Can you activate MSP only on the default port and try setting motors and RC commands via GUI and library again? RC commands should only activate motors after arming, but sending raw motors commands should work in any case.
E.g., first try that you can control the motors and send RC commands via GUI and verify that the motors are indeed turning (without propellers of course), and then do the same with the node again?
If possible, can you also try the example program fcu_motor_test
(https://github.com/christianrauch/msp/blob/master/examples/fcu_motor_test.cpp)? It should set all 4 motors to 10% speed for 1 second.
I have tried mcu motor test that works fine for 1 second but i got no luck in case of making the ros to work on the motor control even with direct usb connection with my pc....i am publishing values directly by terminal...do i need to create a loop in a program that continuously publishes along with header?
The example fcu_motor_test
works as expected, but sending motor commands to the topic actuator_control
does not work? If fcu->setMotors()
works in the example program, but not in the ROS node, I am not sure what the issues might be.
Can you make sure that the callback MultiWiiNode::motor_control
(that is supposed to set the motor values) actually receives the values that you sent? E.g. debug the function via gdb or just by printing the values in mavros_msgs::ActuatorControl
.
For sending raw motor commands, it is enough to set them once via FlightController::setMotors()
. However, for sending RC commands you first need to make sure that the flight controller is armed, and you need to send them periodically, to prevent the flight controller from going into fail safe mode (as it would do for a real RC). For the ROS node, you can check the arming and failsafe status on topic status/armed
and status/failsafe
.
Ok i will do some debugging and get back to you...thanks
I am getting issues compiling the ros-multiwii package as catkin cannot find msp. So where should i install your msp package so that catkin finds it?