-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial arm bridge for the simulator (#580)
* Init * Make pub and sub * Cleaner
- Loading branch information
Showing
6 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "sim_arm_bridge.hpp" | ||
|
||
#include <ros/init.h> | ||
#include <ros/node_handle.h> | ||
#include <sensor_msgs/JointState.h> | ||
|
||
ros::Subscriber subscriber; | ||
|
||
ros::Publisher jointStatePublisher; | ||
|
||
constexpr std::string_view ARM_THROTTLE_CMD_TOPIC = "arm_throttle_cmd"; | ||
constexpr std::string_view ARM_VELOCITY_CMD_TOPIC = "arm_velocity_cmd"; | ||
constexpr std::string_view ARM_POSITION_CMD_TOPIC = "arm_position_cmd"; | ||
|
||
int main(int argc, char* argv[]) { | ||
ros::init(argc, argv, "sim_arm_bridge"); | ||
ros::NodeHandle nh; | ||
|
||
subscriber = nh.subscribe(std::string{ARM_POSITION_CMD_TOPIC}, 1, positionCallback); | ||
|
||
ros::spin(); | ||
return EXIT_SUCCESS; | ||
} | ||
|
||
void positionCallback(mrover::Position const& positions) { | ||
sensor_msgs::JointState jointState; | ||
jointState.name = positions.names; | ||
jointState.position.assign(positions.positions.begin(), positions.positions.end()); | ||
jointStatePublisher.publish(jointState); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include <mrover/Position.h> | ||
|
||
void positionCallback(mrover::Position const& positions); |
File renamed without changes.
File renamed without changes.
File renamed without changes.