# Motor\_node at github doesnt behave like motor\_node on the robot

**URL:** <https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908>\
**Category:** Uncategorized\
**Created:** [October 28, 2021, 12:43pm UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908 "2021-10-28T12:43:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![asafanter](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/59ef9b/32.png) [@asafanter](https://forum.ubiquityrobotics.com/u/asafanter)\
**Post date:** [October 28, 2021, 12:43pm UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/1 "2021-10-28T12:43:57Z")

</div>

Hi,  
I’ve got a robot with pi and ROS installed(kinetic).  
the robot has a service which run ROS nodes and motor\_node between them.

when I writing “rostopic info” I can see there is a topic named “/odom” and when Im checking with  
“rostopic info odom” I can see that motor\_node is the one who publish it.

I need to edit some stuff at the node but the robot contains only exe of motor\_node so I’ve been told that I can download the code from git and compile it.

I’ve checked all the files in the git and there is no place the motor\_node publish this topic!  
no one publish this topic!

I even downloaded the source code and compile the motor\_node and when I replaced it with the robot motor\_node the odom topic dissapeard.

so my question is:  
where is the code that publish the “odom” topic ???

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [October 29, 2021, 6:23am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/2 "2021-10-29T06:23:43Z")

</div>

I have to ask if you have an actual Magni with its main board or if you are doing your own robot? I will proceed with your answer that is only a good answer if you have the real Magni robot. You are certainly welcome to use our Image but all the stuff o /odom publication is highly specific to our board and our motor\_node.

IF your robot is NOT a magni I first offer this page that is of value for our image:

> **[Using Our Raspberry Pi Image Without A Magni](https://learn.ubiquityrobotics.com/image_no_magni)**
>
> Tutorials for Magni

Read on IF you have a real magni because this ONLY applies for a real Magni that has the main motor control board (MCB).

When in ~/catkin\_ws/src you would run this command to clone our motor node:  
git clone [https://github.com/UbiquityRobotics/ubiquity\_motor](https://github.com/UbiquityRobotics/ubiquity_motor)

After that the location of /odom stuff is in catkin\_ws/src/ubiquity\_motor/src/motor\_hardware.cc  
What you seek is ‘near’ line 300. It is HIGHLY specific to our main product, Magni.

I hope this helps,  
Mark

---

<div class="post-metadata">

**Author:** ![asafanter](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/59ef9b/32.png) [@asafanter](https://forum.ubiquityrobotics.com/u/asafanter)\
**Post date:** [October 29, 2021, 10:45am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/3 "2021-10-29T10:45:10Z")

</div>

I have a real magni robot.  
and I already downloaded the git, and after reading your answer still, there is no odom publish.  
no around line 300 and not at all.

there is no ros subscriber with the topic “odom” at motor\_hardware or anywhere.  
in lines 343-344 you got this:  
leftError.publish(left);  
rightError.publish(right);

and those only the error of left and right on a different topics

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [October 31, 2021, 1:04am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/4 "2021-10-31T01:04:24Z")

</div>

I need to ask another basic set of questions here.  
To me I would now assume that you are not able to get your Magni to move at all, is that the case?  
If unable to move at all then what you describe is the motor\_node is not connecting to the MCB. If you have a rev 5.2 or rev 5.3 MCB (big board) tell me if you see both the SIN and SOUT leds blinking very fast after you have started the robot and waited lets say up to 5 minutes?  
Tell me (perhaps again) what version of MCB you have on the robot.  
We will proceed based on your answers.  
This is our troubleshooting page on our ‘learn’ site:

> **[Troubleshooting](https://learn.ubiquityrobotics.com/troubleshooting)**
>
> Tutorials for Magni

The key points on this page are near the middle of the page:

- Power Supply And Status Quick Reference Table focus on blink, 5M and 12M leds.
- The Serial Communications Status LEDS
- Verify The MCB Is Recognized Over Serial port
- List item

---

<div class="post-metadata">

**Author:** ![asafanter](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/59ef9b/32.png) [@asafanter](https://forum.ubiquityrobotics.com/u/asafanter)\
**Post date:** [October 31, 2021, 7:42am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/5 "2021-10-31T07:42:10Z")

</div>

I actually can drive this is not the problem.

Im trying to do some manipulation before sending the odom topic, thats it.  
few of the manipulation contains sending encoders ticks in addition to odom and reduce some time.

I talk with the support on phone and they told the code of motor\_node is on the git.

but it is not the same!!

the only thing I want to know is where is the source code corresponding to my robot.

If you also gonna say “on the git” and send me the same link so please, show me where is the /odom publish

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [October 31, 2021, 8:02am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/6 "2021-10-31T08:02:42Z")

</div>

You are then asking for exactly the same source. This is not something I know how to track down. It is ‘possible’ but really involved so I suggest getting known code. When you pull a repository and make the code one of the beauties of ROS is it ‘overlays’ that code and uses it next reboot.

This is why I think your easiest path is that you get your OWN ubiquity\_motor node code and THEN you have the same code.

cd ~/catkin\_ws/src  
git clone [https://github.com/UbiquityRobotics/ubiquity\_motor](https://github.com/UbiquityRobotics/ubiquity_motor)  
cd ~/catkin\_ws  
sudo systemctl stop magni-base (to avoid it taking FOREVER!)  
catkin\_make  
after done, reboot.

You can then use the tips I gave to find /odom publication from our motor node and know it is the matching code.

---

<div class="post-metadata">

**Author:** ![asafanter](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/59ef9b/32.png) [@asafanter](https://forum.ubiquityrobotics.com/u/asafanter)\
**Post date:** [October 31, 2021, 8:09am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/7 "2021-10-31T08:09:32Z")

</div>

I did exactly what you said.  
I stopped the service of magni-base and compiled to git node.

so now both the “odom” topic and the “cmd\_vel” topic dissapear.

it makes sense because the code at the git doesn’t subscribes/publishes them.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [October 31, 2021, 8:15am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/8 "2021-10-31T08:15:04Z")

</div>

Now I am going to go into some specifics that you will likely not like at all.  
The creators of our motor\_node wanted to use some very low level code rather than directly pubish /odom. So here we go … hold onto your hats!

In our motor node we periodically update what is called the robot ‘joints’ which in this case means the wheel rotations.

Deep in the depths of some OTHER shared ROS code lies the stuff that takes our wheel geometries and rotation rates in rad/sec and keeps track of ‘wheel odom frame’. This I ‘think’ is what you are asking about basically.

So we instantiate this module as hardware\_interface::JointStateHandle joint\_state\_handle How do do what YOU want to do will be really involved and require digging deep into the \_joints stuff.

I personally HATE that layer and NEVER use it on my robots. I leep all my odom frame stuff easily viewable in my own code. We could argue the ‘religion’ of use of pre-existing ROS standards all day and who am I to ‘pass judgement’. Frankly I myself feel it is such a wild abstration that it is if near zero value and was only done because it seemed like the right thing to do at the time.

I myself really have not followed it into the depths. It is a ‘ROS’ sort of ‘standard’ but IMHO is nearly unsupportable by anybody but a ROS Guru (WHICH the guy who did it certainly is). I prefer supportable code that is able to be followed over the ‘beauty of object oriented abstractions’. Again, that is me, hey, I am by title the hardware guy so ‘what do I know’?

There you have it. Such is the case. It works but we do not mess with it.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [October 31, 2021, 8:27am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/9 "2021-10-31T08:27:28Z")

</div>

I now see your reply. I have in a GREAT MANY cases overlaied the ubiquity\_motor node and made it, the made numerous changes in a branch and pushed the branch to Pull requests then after review merged them into ‘kinetic\_devel’.

So I am not sure what you ran into. It may be some recent change or other ‘real’ problem. I will have to let our ‘real software folk’ sort out if you cannot do a pull of the kinetic-devel branch on the Nov 2020 image.

One possibility is you ended up pulling our VERY recent noetic-devel branch in which case your image is all kinetic-devel but you pulled noetic-devel and yet, that would be totally likely to be a royal mess and not work. Recent changes in high level git may have made the ‘default’ branch of the ubiquity\_robotics repository be noetic-devel BAD IN YOUR CASE!

So since I think you said you used the 11 2020 image then in your ubiquity\_motor repository clone use ‘git status’ and see if you are in fact in noetic-devel. If so you need to do a ‘git checkout kinetic-devel’ and then re-make, perhaps with a ‘git pull’ for safety after the branch switch (not likely required but is good practice). This is quite likely your current issue.

---

<div class="post-metadata">

**Author:** ![asafanter](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/59ef9b/32.png) [@asafanter](https://forum.ubiquityrobotics.com/u/asafanter)\
**Post date:** [October 31, 2021, 8:41am UTC](https://forum.ubiquityrobotics.com/t/motor-node-at-github-doesnt-behave-like-motor-node-on-the-robot/908/10 "2021-10-31T08:41:43Z")

</div>

OK, I think I cannot go further from here.  
I asked my colleague to set support appointment.

I hope you can help me on the phone 🙂
