Skip to content

Commit

Permalink
Merge branch 'master' of github.com:KlemenDEV/VisionDrone
Browse files Browse the repository at this point in the history
  • Loading branch information
KlemenDEV committed May 17, 2021
2 parents 7cde309 + b63525f commit 9f75c76
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ sudo make install

## 5. Build the custom workspace

Run catkin_make in the workspace
Run `catkin_make` in the workspace. For release, use `catkin_make -DCMAKE_BUILD_TYPE=Release`

# WiFi configuration

Expand Down
21 changes: 8 additions & 13 deletions src/orb_slam3/src/ros_mono.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ int main(int argc, char **argv) {
}

void ImageGrabber::GrabImage(const sensor_msgs::ImageConstPtr &msg) {
// Copy the ros image message to cv::Mat.
cv_bridge::CvImageConstPtr cv_ptr;
try {
cv_ptr = cv_bridge::toCvShare(msg);
Expand All @@ -70,32 +69,28 @@ void ImageGrabber::GrabImage(const sensor_msgs::ImageConstPtr &msg) {
cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image, cv_ptr->header.stamp.toSec());

if (Tcw.rows == 4 && Tcw.cols == 4) { // valid data
std::cout << "data" << std::endl;
cv::Mat Twc(4, 4, CV_32F);
cv::invert(Tcw, Twc);

nav_msgs::Odometry odom;

geometry_msgs::PoseWithCovariance posevc;

geometry_msgs::Pose pose;

geometry_msgs::Point pt;
pt.x = Tcw.at<double>(0,3);
pt.y = Tcw.at<double>(1,3);
pt.z = Tcw.at<double>(2,3);

pt.x = Twc.at<float>(0, 3);
pt.y = Twc.at<float>(1, 3);
pt.z = Twc.at<float>(2, 3);
pose.position = pt;

posevc.pose = pose;

odom.pose = posevc;
odom.header.seq = 1;
odom.header.stamp = ros::Time::now();
odom.header.frame_id = "map";
odom.child_frame_id = "map";

point_pub.publish(odom);

std::cout << Tcw.at<double>(0,3) << " : " << Tcw.at<double>(1,3) << " : " << Tcw.at<double>(2,3) << std::endl;
std::cout << std::to_string(Twc.at<float>(0, 3)) << ", "
<< std::to_string(Twc.at<float>(1, 3)) << ", "
<< std::to_string(Twc.at<float>(2, 3)) << std::endl;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/runs/launch/bag_play_orb_slam3.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<launch>
<!-- PLAY ROSBAG -->
<node pkg="rosbag" type="play" name="data_loader" args="/home/pylo/Desktop/walk2.bag" required="true"/>
<node pkg="rosbag" type="play" name="data_loader" args="/home/pylo/Desktop/kalibr.bag" required="true"/>

<node pkg="tf"
type="static_transform_publisher"
Expand Down

0 comments on commit 9f75c76

Please sign in to comment.